hydra/flake.nix

105 lines
3.3 KiB
Nix
Raw Permalink Normal View History

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