-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
38 lines (33 loc) · 1.07 KB
/
default.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
{ compiler ? "ghc902"
, doStatic ? false
, ...
}:
let
## Import sources:
sources = import ./nix/sources.nix;
## Import nixpkgs:
pkgs = import sources.nixpkgs { };
## Get the haskell set:
haskell = pkgs.haskell.packages.${compiler};
## Define a function that makes this application statically compiled:
makeAppStatic = drv: pkgs.haskell.lib.compose.overrideCabal
(_: {
enableSharedExecutables = false;
enableSharedLibraries = false;
doCheck = false;
configureFlags = [
"--ghc-option=-optl=-static"
"--ghc-option=-optl=-pthread"
# "--ghc-option=-fPIC"
"--extra-lib-dirs=${pkgs.glibc.static}/lib"
"--extra-lib-dirs=${pkgs.gmp6.override { withStatic = true; }}/lib"
"--extra-lib-dirs=${pkgs.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib"
];
})
drv;
## Get this package:
thisPackage = haskell.callCabal2nixWithOptions "habulara" ./. "--no-check --no-haddock" { };
in
if doStatic
then makeAppStatic thisPackage
else pkgs.haskell.lib.justStaticExecutables thisPackage