forked from tweag/opam-nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
41 lines (34 loc) · 1.36 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
# We can build GUI stuff!
# Don't try to build it statically though
{
inputs.opam-nix.url = "github:tweag/opam-nix";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, opam-nix, flake-utils }:
flake-utils.lib.eachDefaultSystem (system: {
legacyPackages = let
inherit (opam-nix.lib.${system}) queryToScope;
pkgs = opam-nix.inputs.nixpkgs.legacyPackages.${system};
pkgs' = if pkgs.stdenv.isDarwin then pkgs else pkgs.pkgsStatic;
scope = queryToScope { } {
frama-c = null;
lablgtk3 = null; # Use lablgtk3 when appropriate
lablgtk3-sourceview3 = null;
ocaml-base-compiler = "4.12.0";
};
overlay = self: super: {
# opam is adamant about using gtk2 :/
frama-c = super.frama-c.overrideAttrs (oa: {
nativeBuildInputs = oa.nativeBuildInputs ++ [ pkgs.makeWrapper ];
NIX_LDFLAGS = with pkgs;
"-L${pkgs'.fontconfig.lib}/lib -L${pkgs'.pkgsStatic.expat}/lib -lfontconfig -lfreetype -lexpat";
postInstall = ''
for i in $(find $out/bin -type f); do
wrapProgram "$i" --prefix OCAMLPATH : "$OCAMLPATH"
done
'';
});
};
in scope.overrideScope' overlay;
defaultPackage = self.legacyPackages.${system}.frama-c;
});
}