hydra/flake.nix

118 lines
3.6 KiB
Nix
Raw Permalink Normal View History

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";
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";
outputs = { self, nix-eval-jobs, 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;
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
});
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;
nix-eval-jobs = nix-eval-jobs.packages.${final.system}.default;
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;
});
devShells = forEachSystem (system: let
pkgs = pkgsBySystem.${system};
lib = pkgs.lib;
mkDevShell = stdenv: (pkgs.mkShell.override { inherit stdenv; }) {
inputsFrom = [ (self.packages.${system}.default.override { inherit stdenv; }) ];
packages =
lib.optional (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) pkgs.clang-tools;
};
in {
default = mkDevShell pkgs.stdenv;
clang = mkDevShell pkgs.clangStdenv;
});
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
}