-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
84 lines (80 loc) · 2.98 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{
description = "Description for the project";
inputs = {
flake-parts.inputs.nixpkgs.follows = "nixpkgs";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
dist.url = "https://hercules-ci-enterprise.cachix.org/serve/6jcx2iijjdn3srvvl4gxrxsv377mlwsx/hercules-ci-enterprise.tar";
dist.flake = false;
};
outputs = { self, flake-parts, dist, ... }:
flake-parts.lib.mkFlake { inherit self; } ({ config, lib, ... }:
let
mkPackage = name: path: {
inherit name;
type = "derivation";
outputs = [ "out" ];
outPath = postulateStorePath path;
drvPath = throw "hercules-ci-enterprise: ${path} is not buildable. It can only be substituted.";
};
postulateStorePath = path: builtins.appendContext path { "${path}" = { path = true; }; };
in
{
imports = [
];
systems = [ "x86_64-linux" ];
perSystem = { config, self', inputs', pkgs, system, ... }: {
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
config.packages.hercules-jwkgen
config.packages.hercules-generate-config
pkgs.jq
];
message = ''
Welcome to the Hercules CI Enterprise setup shell!
To generate a configuration, run
hercules-generate-config
'';
shellHook = ''
echo "$message"
'';
};
apps.hercules-generate-config.program = config.packages.hercules-generate-config;
packages = lib.mapAttrs mkPackage (lib.importJSON (dist + "/hercules-ci-dependencies.json")) // {
hercules-generate-config = pkgs.callPackage ./src/generate-config.nix { };
};
checks.example = (lib.nixosSystem {
modules = [ ./example/configuration.nix self.nixosModules.single-machine ];
}).config.system.build.toplevel;
};
flake = {
nixosModules.packages = { config, lib, pkgs, ... }: {
key = "hercules-ci-enterprise-packages";
config = {
hercules.packages = self.packages.x86_64-linux;
assertions = [
{
assertion = pkgs.stdenv.hostPlatform.system == "x86_64-linux";
message = ''
Hercules CI Enterprise can currently only run on x86_64-linux.
'';
}
];
};
};
nixosModules.single-machine-age = {
imports = [
self.nixosModules.single-machine
"${dist}/enterprise/single-machine-age.nix"
];
};
nixosModules.single-machine = { pkgs, ... }: {
imports = [
self.nixosModules.packages
"${dist}/enterprise/single-machine.nix"
"${dist}/web/module.nix"
"${dist}/backend/module.nix"
];
};
};
});
}