diff --git a/flake.lock b/flake.lock index 246b5380..897785ed 100644 --- a/flake.lock +++ b/flake.lock @@ -1,73 +1,5 @@ { "nodes": { - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-parts": { - "inputs": { - "nixpkgs-lib": [ - "nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1712014858, - "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "git-hooks-nix": { - "inputs": { - "flake-compat": [ - "nix" - ], - "gitignore": [ - "nix" - ], - "nixpkgs": [ - "nix", - "nixpkgs" - ], - "nixpkgs-stable": [ - "nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1726745158, - "narHash": "sha256-D5AegvGoEjt4rkKedmxlSEmC+nNLMBPWFxvmYnVLhjk=", - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "4e743a6920eab45e8ba0fbe49dc459f1423a4b74", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" - } - }, "libgit2": { "flake": false, "locked": { @@ -87,15 +19,17 @@ }, "nix": { "inputs": { - "flake-compat": "flake-compat", - "flake-parts": "flake-parts", - "git-hooks-nix": "git-hooks-nix", - "libgit2": "libgit2", + "flake-compat": [], + "flake-parts": [], + "git-hooks-nix": [], + "libgit2": [ + "libgit2" + ], "nixpkgs": [ "nixpkgs" ], - "nixpkgs-23-11": "nixpkgs-23-11", - "nixpkgs-regression": "nixpkgs-regression" + "nixpkgs-23-11": [], + "nixpkgs-regression": [] }, "locked": { "lastModified": 1726787955, @@ -128,40 +62,9 @@ "type": "github" } }, - "nixpkgs-23-11": { - "locked": { - "lastModified": 1717159533, - "narHash": "sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", - "type": "github" - } - }, - "nixpkgs-regression": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, "root": { "inputs": { + "libgit2": "libgit2", "nix": "nix", "nixpkgs": "nixpkgs" } diff --git a/flake.nix b/flake.nix index 19381efd..c06b5f62 100644 --- a/flake.nix +++ b/flake.nix @@ -2,21 +2,23 @@ description = "A Nix-based continuous build system"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05-small"; + + inputs.libgit2 = { url = "github:libgit2/libgit2/v1.8.1"; flake = false; }; inputs.nix.url = "github:NixOS/nix/2.24-maintenance"; inputs.nix.inputs.nixpkgs.follows = "nixpkgs"; + inputs.nix.inputs.libgit2.follows = "libgit2"; - outputs = { self, nixpkgs, nix }: + # hide nix dev tooling from our lock file + inputs.nix.inputs.flake-parts.follows = ""; + inputs.nix.inputs.git-hooks-nix.follows = ""; + inputs.nix.inputs.nixpkgs-regression.follows = ""; + inputs.nix.inputs.nixpkgs-23-11.follows = ""; + inputs.nix.inputs.flake-compat.follows = ""; + + outputs = { self, nixpkgs, nix, ... }: let systems = [ "x86_64-linux" "aarch64-linux" ]; forEachSystem = nixpkgs.lib.genAttrs systems; - - overlayList = [ self.overlays.default nix.overlays.default ]; - - pkgsBySystem = forEachSystem (system: import nixpkgs { - inherit system; - overlays = overlayList; - }); - in rec { @@ -30,7 +32,6 @@ }; hydraJobs = { - build = forEachSystem (system: packages.${system}.hydra); buildNoTests = forEachSystem (system: @@ -39,19 +40,21 @@ }) ); - manual = forEachSystem (system: - let pkgs = pkgsBySystem.${system}; in - pkgs.runCommand "hydra-manual-${pkgs.hydra.version}" { } + manual = forEachSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + hydra = self.packages.${pkgs.hostPlatform.system}.hydra; + in + pkgs.runCommand "hydra-manual-${hydra.version}" { } '' mkdir -p $out/share - cp -prvd ${pkgs.hydra}/share/doc $out/share/ + cp -prvd ${hydra}/share/doc $out/share/ mkdir $out/nix-support echo "doc manual $out/share/doc/hydra" >> $out/nix-support/hydra-build-products ''); tests = import ./nixos-tests.nix { - inherit forEachSystem nixpkgs pkgsBySystem nixosModules; + inherit forEachSystem nixpkgs nixosModules; }; container = nixosConfigurations.container.config.system.build.toplevel; @@ -64,12 +67,17 @@ }); packages = forEachSystem (system: { - hydra = pkgsBySystem.${system}.hydra; - default = pkgsBySystem.${system}.hydra; + hydra = nixpkgs.legacyPackages.${system}.callPackage ./package.nix { + inherit (nixpkgs.lib) fileset; + rawSrc = self; + nix = nix.packages.${system}.nix; + nix-perl-bindings = nix.hydraJobs.perlBindings.${system}; + }; + default = self.packages.${system}.hydra; }); nixosModules = import ./nixos-modules { - overlays = overlayList; + inherit self; }; nixosConfigurations.container = nixpkgs.lib.nixosSystem { @@ -77,7 +85,6 @@ modules = [ self.nixosModules.hydra - self.nixosModules.overlayNixpkgsForThisHydra self.nixosModules.hydraTest self.nixosModules.hydraProxy { diff --git a/nixos-modules/default.nix b/nixos-modules/default.nix index dac705c3..62b18406 100644 --- a/nixos-modules/default.nix +++ b/nixos-modules/default.nix @@ -1,11 +1,10 @@ -{ overlays }: +{ self }: { - hydra = import ./hydra.nix; - - overlayNixpkgsForThisHydra = { pkgs, ... }: { - nixpkgs = { inherit overlays; }; - services.hydra.package = pkgs.hydra; + hydra = { pkgs, lib,... }: { + _file = ./default.nix; + imports = [ ./hydra.nix ]; + services.hydra-dev.package = lib.mkDefault self.packages.${pkgs.hostPlatform.system}.hydra; }; hydraTest = { pkgs, ... }: { diff --git a/nixos-modules/hydra.nix b/nixos-modules/hydra.nix index 6a2390c4..c471b0ef 100644 --- a/nixos-modules/hydra.nix +++ b/nixos-modules/hydra.nix @@ -68,8 +68,6 @@ in package = mkOption { type = types.path; - default = pkgs.hydra; - defaultText = literalExpression "pkgs.hydra"; description = "The Hydra package."; }; diff --git a/nixos-tests.nix b/nixos-tests.nix index 19a9ba35..9efe68c8 100644 --- a/nixos-tests.nix +++ b/nixos-tests.nix @@ -1,13 +1,12 @@ -{ forEachSystem, nixpkgs, pkgsBySystem, nixosModules }: +{ forEachSystem, nixpkgs, nixosModules }: let # NixOS configuration used for VM tests. hydraServer = - { config, pkgs, ... }: + { pkgs, ... }: { imports = [ nixosModules.hydra - nixosModules.overlayNixpkgsForThisHydra nixosModules.hydraTest ]; @@ -44,11 +43,10 @@ in }); notifications = forEachSystem (system: - let pkgs = pkgsBySystem.${system}; in with import (nixpkgs + "/nixos/lib/testing-python.nix") { inherit system; }; simpleTest { name = "hydra-notifications"; - nodes.machine = { pkgs, ... }: { + nodes.machine = { imports = [ hydraServer ]; services.hydra-dev.extraConfig = '' @@ -89,7 +87,7 @@ in # Setup the project and jobset machine.succeed( - "su - hydra -c 'perl -I ${pkgs.hydra.perlDeps}/lib/perl5/site_perl ${./t/setup-notifications-jobset.pl}' >&2" + "su - hydra -c 'perl -I ${config.services.hydra-dev.package.perlDeps}/lib/perl5/site_perl ${./t/setup-notifications-jobset.pl}' >&2" ) # Wait until hydra has build the job and @@ -103,7 +101,7 @@ in }); gitea = forEachSystem (system: - let pkgs = pkgsBySystem.${system}; in + let pkgs = nixpkgs.legacyPackages.${system}; in with import (nixpkgs + "/nixos/lib/testing-python.nix") { inherit system; }; makeTest { name = "hydra-gitea"; @@ -298,7 +296,7 @@ in }); validate-openapi = forEachSystem (system: - let pkgs = pkgsBySystem.${system}; in + let pkgs = nixpkgs.legacyPackages.${system}; in pkgs.runCommand "validate-openapi" { buildInputs = [ pkgs.openapi-generator-cli ]; } ''