flake-module.nix
1 { self, ... }: 2 { 3 perSystem = 4 { 5 config, 6 lib, 7 system, 8 ... 9 }: 10 { 11 checks = 12 let 13 # System configuration checks (filter by current system) 14 nixosChecks = 15 lib.mapAttrs' (name: cfg: lib.nameValuePair "nixos-${name}" cfg.config.system.build.toplevel) 16 ( 17 lib.filterAttrs (_: cfg: cfg.pkgs.stdenv.hostPlatform.system == system) ( 18 self.nixosConfigurations or { } 19 ) 20 ); 21 22 darwinChecks = lib.mapAttrs' (name: cfg: lib.nameValuePair "darwin-${name}" cfg.system) ( 23 lib.filterAttrs (_: cfg: cfg.pkgs.stdenv.hostPlatform.system == system) ( 24 self.darwinConfigurations or { } 25 ) 26 ); 27 28 # Home-manager configuration checks 29 homeChecks = lib.mapAttrs' ( 30 name: cfg: lib.nameValuePair "home-manager-${name}" cfg.activationPackage 31 ) (config.legacyPackages.homeConfigurations or { }); 32 in 33 nixosChecks // darwinChecks // homeChecks; 34 }; 35 }