hydra/flake.nix

97 lines
2.8 KiB
Nix
Raw Normal View History

2019-05-08 11:28:02 +00:00
{
description = "A Nix-based continuous build system";
2024-05-10 16:49:27 +00:00
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
2024-05-28 21:10:27 +00:00
inputs.nix.url = "git+https://git@git.lix.systems/lix-project/lix";
inputs.nix.inputs.nixpkgs.follows = "nixpkgs";
2024-05-10 16:49:27 +00:00
outputs = { self, nixpkgs, nix }:
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-01-25 16:54:44 +00:00
overlayList = [ self.overlays.default nix.overlays.default ];
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
});
2022-02-09 15:43:40 +00:00
in
rec {
2019-05-08 11:28:02 +00:00
# A Nixpkgs overlay that provides a 'hydra' package.
2022-07-12 13:03:27 +00:00
overlays.default = final: prev: {
hydra = final.callPackage ./package.nix {
2024-05-10 16:49:27 +00:00
inherit (final.lib) fileset;
rawSrc = self;
};
};
hydraJobs = {
2022-11-02 10:19:33 +00:00
build = forEachSystem (system: packages.${system}.hydra);
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
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/
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
'');
tests = import ./nixos-tests.nix {
inherit forEachSystem nixpkgs pkgsBySystem nixosModules;
};
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;
});
2024-01-25 16:54:44 +00:00
nixosModules = import ./nixos-modules {
overlays = overlayList;
};
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules =
2022-02-09 15:43:40 +00:00
[
self.nixosModules.hydra
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
{
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 11:10:50 +00:00
};
2019-05-08 11:28:02 +00:00
}