-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
62 lines (53 loc) · 1.89 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
{
inputs = {
opam-repository.url = "github:ocaml/opam-repository";
opam-repository.flake = false;
opam-nix.url = "github:tweag/opam-nix";
opam-nix.inputs.nixpkgs.follows = "nixpkgs";
opam-nix.inputs.opam-repository.follows = "opam-repository";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, utils, opam-nix, nixpkgs, opam-repository }:
let
package = "scrutiny";
repos = [
opam-repository
];
overlay = pkgs: _: let
opam = opam-nix.lib.${pkgs.system};
project = opam.buildOpamProject {
inherit pkgs repos;
resolveArgs = { dev = false; };
overlays = [opam.defaultOverlay];
} package ./. {
ocaml-base-compiler = "*";
};
scrutiny = project.${package}.overrideAttrs(oa: {
buildInputs = oa.buildInputs ++ [pkgs.systemdMinimal];
removeOcamlReferences = true;
propagateInputs = false;
});
mkSingleExe = { name, exe ? name }: pkgs.stdenv.mkDerivation {
inherit name;
inherit (scrutiny) version;
unpackPhase = ":";
installPhase = ''
mkdir -p $out/bin
cp "${scrutiny}/bin/${exe}" "$out/bin/${exe}"
'';
disallowedRequisites = [scrutiny];
};
in {
inherit scrutiny;
scrutiny-infra-tunnel = mkSingleExe { name = "scrutiny-infra-tunnel"; };
scrutiny-systemd-exporter = mkSingleExe { name = "scrutiny-systemd-exporter"; exe = "systemd_exporter"; };
};
in {
inherit overlay;
} // utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; overlays = [overlay]; }; in {
packages.default = pkgs.scrutiny;
packages.scrutiny-infra-tunnel = pkgs.scrutiny-infra-tunnel;
packages.scrutiny-systemd-exporter = pkgs.scrutiny-systemd-exporter;
});
}