31 lines
		
	
	
	
		
			967 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
	
		
			967 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
| { nixpkgs, ... }:
 | |
| {
 | |
|   generateColmenaHost = name: {
 | |
|     site,
 | |
|     modules,
 | |
|     ...
 | |
|   }: {
 | |
|     deployment = {
 | |
|       targetHost = "${name}.${site}.grzb.de";
 | |
|       targetUser = "colmena-deploy";
 | |
|     };
 | |
| 
 | |
|     # Set imports and optionally import colmena secrets configuration
 | |
|     imports = modules ++ nixpkgs.lib.optional (builtins.pathExists ./config/hosts/${name}/secrets.nix) ./config/hosts/${name}/secrets.nix;
 | |
|   };
 | |
| 
 | |
|   generateNixConfiguration = name: specialArgs: {
 | |
|     hostNixpkgs,
 | |
|     system,
 | |
|     modules,
 | |
|     ...
 | |
|   }:
 | |
|   let
 | |
|     # Filter attritubes starting with _ to avoid infinite recursion when building with hydra
 | |
|     # TODO: Why does this happen?
 | |
|     filter = name: host: (builtins.substring 0 1 name) != "_";
 | |
|   in
 | |
|     (nixpkgs.lib.filterAttrs filter (hostNixpkgs.lib.nixosSystem {
 | |
|       inherit system modules specialArgs;
 | |
|     })).config.system.build.toplevel; # Builds the entire NixOS system, see: https://nixos.org/manual/nixos/stable/#sec-building-parts
 | |
| }
 |