54 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
| {
 | |
|   inputs,
 | |
|   outputs,
 | |
|   systems,
 | |
| }:
 | |
| let
 | |
|   inherit (inputs.nixpkgs) lib;
 | |
|   pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
 | |
| 
 | |
|   getCfg = _: cfg: cfg.config.system.build.toplevel;
 | |
|   hostToAgg = _: cfg: cfg;
 | |
| 
 | |
|   getHome = _: cfg: cfg.config.home.activationPackage;
 | |
|   homeToAgg = _: cfg: cfg;
 | |
| 
 | |
|   # get per-system check derivation (with optional postfix)
 | |
|   mapSystems =
 | |
|     {
 | |
|       check,
 | |
|       postfix ? "",
 | |
|     }:
 | |
|     (map (system: if postfix == "" then check.${system} else check.${system}.${postfix}) systems);
 | |
| in
 | |
| rec {
 | |
|   inherit (outputs) formatter devShells checks;
 | |
| 
 | |
|   host = lib.mapAttrs getCfg outputs.nixosConfigurations;
 | |
|   home = lib.mapAttrs getHome outputs.homeConfigurations; # homeConfigurations.alice.config.home.activationPackage
 | |
| 
 | |
|   hosts = pkgs.releaseTools.aggregate {
 | |
|     name = "hosts";
 | |
|     constituents = lib.mapAttrsToList hostToAgg host;
 | |
|   };
 | |
|   homes = pkgs.releaseTools.aggregate {
 | |
|     name = "homes";
 | |
|     constituents = lib.mapAttrsToList homeToAgg home;
 | |
|   };
 | |
| 
 | |
|   devChecks = pkgs.releaseTools.aggregate {
 | |
|     name = "devChecks";
 | |
|     constituents = lib.flatten [
 | |
|       (mapSystems { check = formatter; })
 | |
|       (mapSystems {
 | |
|         check = checks;
 | |
|         postfix = "pre-commit-check";
 | |
|       })
 | |
|       (mapSystems {
 | |
|         check = devShells;
 | |
|         postfix = "default";
 | |
|       })
 | |
|     ];
 | |
|   };
 | |
| }
 |