-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflake.nix
50 lines (42 loc) · 1.59 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
{
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 }:
utils.lib.eachDefaultSystem (system:
let
package = "illuaminate";
pkgs = import nixpkgs { inherit system; };
illuaminate-full = (opam-nix.lib.${system}.buildDuneProject {
inherit pkgs;
repos = [opam-repository];
resolveArgs = { dev = false; "with-test" = true; };
} package ./. {
}).${package}.overrideAttrs(oa: {
nativeBuildInputs = oa.nativeBuildInputs ++ [pkgs.upx pkgs.git];
# We can't run tests here, as flakes don't have access to the full Git
# history (see https://github.com/NixOS/nix/issues/6900). This also
# breaks %VERSION%.
doCheck = false;
removeOcamlReferences = true;
propagateInputs = false;
});
mkSingleExe = { name, exe ? name }: pkgs.stdenv.mkDerivation {
inherit name;
inherit (illuaminate-full) version;
unpackPhase = ":";
installPhase = ''
mkdir -p $out/bin
cp "${illuaminate-full}/bin/${exe}" "$out/bin/${exe}"
'';
};
in {
packages.illuaminate-full = illuaminate-full;
packages.default = mkSingleExe { name = "illuaminate"; };
});
}