2019-05-08 11:28:02 +00:00
|
|
|
{
|
|
|
|
description = "A Nix-based continuous build system";
|
|
|
|
|
2024-06-24 18:25:35 +00:00
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
|
2019-09-24 17:58:10 +00:00
|
|
|
|
2024-07-16 01:59:38 +00:00
|
|
|
inputs.lix.url = "git+https://git.lix.systems/lix-project/lix";
|
|
|
|
inputs.lix.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
2024-07-16 02:01:14 +00:00
|
|
|
inputs.nix-eval-jobs.url = "git+https://git.lix.systems/lix-project/nix-eval-jobs";
|
|
|
|
inputs.nix-eval-jobs.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.nix-eval-jobs.inputs.lix.follows = "lix";
|
|
|
|
|
2024-07-16 01:59:38 +00:00
|
|
|
outputs = { self, nixpkgs, lix }:
|
2019-08-09 11:10:50 +00:00
|
|
|
let
|
2022-11-02 10:19:33 +00:00
|
|
|
systems = [ "x86_64-linux" "aarch64-linux" ];
|
|
|
|
forEachSystem = nixpkgs.lib.genAttrs systems;
|
|
|
|
|
2024-07-16 01:59:38 +00:00
|
|
|
overlayList = [ self.overlays.default lix.overlays.default ];
|
2024-01-25 16:54:44 +00:00
|
|
|
|
2022-11-02 10:19:33 +00:00
|
|
|
pkgsBySystem = forEachSystem (system: import nixpkgs {
|
|
|
|
inherit system;
|
2024-01-25 16:54:44 +00:00
|
|
|
overlays = overlayList;
|
2022-11-02 10:19:33 +00:00
|
|
|
});
|
2019-09-17 15:25:59 +00:00
|
|
|
|
2022-02-09 15:43:40 +00:00
|
|
|
in
|
|
|
|
rec {
|
2019-05-08 11:28:02 +00:00
|
|
|
|
2019-09-17 15:25:59 +00:00
|
|
|
# A Nixpkgs overlay that provides a 'hydra' package.
|
2022-07-12 13:03:27 +00:00
|
|
|
overlays.default = final: prev: {
|
2024-01-25 16:20:27 +00:00
|
|
|
hydra = final.callPackage ./package.nix {
|
2024-05-10 16:49:27 +00:00
|
|
|
inherit (final.lib) fileset;
|
2024-01-25 17:21:13 +00:00
|
|
|
rawSrc = self;
|
2019-09-17 15:25:59 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
hydraJobs = {
|
|
|
|
|
2022-11-02 10:19:33 +00:00
|
|
|
build = forEachSystem (system: packages.${system}.hydra);
|
2019-09-17 15:25:59 +00:00
|
|
|
|
2024-01-25 16:32:00 +00:00
|
|
|
buildNoTests = forEachSystem (system:
|
|
|
|
packages.${system}.hydra.overrideAttrs (_: {
|
|
|
|
doCheck = false;
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
2022-11-02 10:19:33 +00:00
|
|
|
manual = forEachSystem (system:
|
|
|
|
let pkgs = pkgsBySystem.${system}; in
|
2024-01-25 16:20:27 +00:00
|
|
|
pkgs.runCommand "hydra-manual-${pkgs.hydra.version}" { }
|
2022-02-09 15:43:40 +00:00
|
|
|
''
|
|
|
|
mkdir -p $out/share
|
|
|
|
cp -prvd ${pkgs.hydra}/share/doc $out/share/
|
2019-09-17 15:25:59 +00:00
|
|
|
|
2022-02-09 15:43:40 +00:00
|
|
|
mkdir $out/nix-support
|
|
|
|
echo "doc manual $out/share/doc/hydra" >> $out/nix-support/hydra-build-products
|
2022-11-02 10:19:33 +00:00
|
|
|
'');
|
2019-09-17 15:25:59 +00:00
|
|
|
|
2024-05-03 16:07:05 +00:00
|
|
|
tests = import ./nixos-tests.nix {
|
|
|
|
inherit forEachSystem nixpkgs pkgsBySystem nixosModules;
|
|
|
|
};
|
2021-01-03 17:47:05 +00:00
|
|
|
|
2019-09-24 19:48:28 +00:00
|
|
|
container = nixosConfigurations.container.config.system.build.toplevel;
|
2019-08-09 11:10:50 +00:00
|
|
|
};
|
2019-06-03 10:29:42 +00:00
|
|
|
|
2022-11-02 10:19:33 +00:00
|
|
|
checks = forEachSystem (system: {
|
|
|
|
build = hydraJobs.build.${system};
|
|
|
|
install = hydraJobs.tests.install.${system};
|
|
|
|
validate-openapi = hydraJobs.tests.validate-openapi.${system};
|
|
|
|
});
|
2019-05-08 11:28:02 +00:00
|
|
|
|
2022-11-02 10:19:33 +00:00
|
|
|
packages = forEachSystem (system: {
|
|
|
|
hydra = pkgsBySystem.${system}.hydra;
|
|
|
|
default = pkgsBySystem.${system}.hydra;
|
|
|
|
});
|
2019-05-08 16:12:24 +00:00
|
|
|
|
2024-01-25 16:54:44 +00:00
|
|
|
nixosModules = import ./nixos-modules {
|
|
|
|
overlays = overlayList;
|
2019-09-24 17:58:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
modules =
|
2022-02-09 15:43:40 +00:00
|
|
|
[
|
2024-05-03 16:07:05 +00:00
|
|
|
self.nixosModules.hydra
|
2024-05-03 16:41:17 +00:00
|
|
|
self.nixosModules.overlayNixpkgsForThisHydra
|
2022-02-09 15:43:40 +00:00
|
|
|
self.nixosModules.hydraTest
|
2019-11-07 17:46:32 +00:00
|
|
|
self.nixosModules.hydraProxy
|
2022-02-09 15:43:40 +00:00
|
|
|
{
|
2022-07-12 12:58:25 +00:00
|
|
|
system.configurationRevision = self.lastModifiedDate;
|
2019-09-24 17:58:10 +00:00
|
|
|
|
|
|
|
boot.isContainer = true;
|
|
|
|
networking.useDHCP = false;
|
|
|
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
|
|
|
networking.hostName = "hydra";
|
|
|
|
|
|
|
|
services.hydra-dev.useSubstitutes = true;
|
|
|
|
}
|
|
|
|
];
|
2019-09-17 15:25:59 +00:00
|
|
|
};
|
2019-08-09 11:10:50 +00:00
|
|
|
|
|
|
|
};
|
2019-05-08 11:28:02 +00:00
|
|
|
}
|