diff --git a/flake.nix b/flake.nix index a933e95..91c7211 100644 --- a/flake.nix +++ b/flake.nix @@ -75,6 +75,7 @@ ]; in { + hydraJobs = import ./hydra.nix { inherit inputs outputs; }; nixosConfigurations = { "durincore" = nixpkgs-unstable.lib.nixosSystem { system = "x86_64-linux"; diff --git a/hydra.nix b/hydra.nix new file mode 100644 index 0000000..0c48da9 --- /dev/null +++ b/hydra.nix @@ -0,0 +1,18 @@ +{ inputs, outputs }: +let + inherit (inputs.nixpkgs.lib) filterAttrs mapAttrs elem; + + notBroken = pkg: !(pkg.meta.broken or false); + isDistributable = pkg: + (pkg.meta.license or { redistributable = true; }).redistributable; + hasPlatform = sys: pkg: elem sys (pkg.meta.platforms or [ ]); + filterValidPkgs = sys: pkgs: + filterAttrs + (_: pkg: hasPlatform sys pkg && notBroken pkg && isDistributable pkg) pkgs; + getCfg = _: cfg: cfg.config.system.build.toplevel; + getHomeCfg = _: cfg: cfg.config.home.activationPackage; +in { + # pkgs = mapAttrs filterValidPkgs outputs.packages; + hosts = mapAttrs getCfg outputs.nixosConfigurations; + # homes = mapAttrs getHomeCfg outputs.homeConfigurations; +} \ No newline at end of file