-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
default.nix
46 lines (37 loc) · 1.4 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
39
40
41
42
43
44
45
46
# Note: This is just a minimal example. For proper usage, see the README.
{ nixpkgs ? (import ./nixpkgs.nix).pkgsMusl, compiler ? "ghc8107", strip ? true }:
let
pkgs = nixpkgs.pkgsMusl;
example-scotty-app = { mkDerivation, base, scotty, stdenv }:
mkDerivation {
pname = "example-scotty-app";
version = "0.1.0.0";
src = pkgs.lib.sourceByRegex ./. [
".*\\.cabal$"
"^Setup.hs$"
"^Main.hs$"
];
isLibrary = false;
isExecutable = true;
enableSharedExecutables = false;
enableSharedLibraries = false;
executableHaskellDepends = [ base scotty ];
license = pkgs.lib.licenses.bsd3;
configureFlags = [
"--ghc-option=-optl=-static"
"--extra-lib-dirs=${pkgs.gmp6.override { withStatic = true; }}/lib"
"--extra-lib-dirs=${pkgs.zlib.static}/lib"
"--extra-lib-dirs=${pkgs.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib"
] ++ pkgs.lib.optionals (!strip) [
"--disable-executable-stripping"
] ;
};
normalHaskellPackages = pkgs.haskell.packages.${compiler};
haskellPackages = with pkgs.haskell.lib; normalHaskellPackages.override {
overrides = self: super: {
# Dependencies we need to patch
};
};
drv = haskellPackages.callPackage example-scotty-app {};
in
if pkgs.lib.inNixShell then drv.env else drv