-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
61 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
{
description = "MemoryMaster";
nixConfig.bash-prompt = "[nix(MemoryMaster)] ";
inputs = {
hspkgs.url =
"github:podenv/hspkgs/f6893161b29a8086c7e1232c886a99a5d815ffae";
flake-utils.url = "github:numtide/flake-utils";
butler.url =
"github:TristanCacqueray/haskell-butler/16e6ffc28ede3191807b4207362cdaa86972b89c";
};
outputs = { self, hspkgs, flake-utils, butler }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = hspkgs.pkgs;
packageName = "MemoryMaster";
haskellExtend = hpFinal: hpPrev: {
appPackage = hpPrev.callCabal2nix packageName self { };
butler = pkgs.haskell.lib.dontHaddock hpPrev.butler;
};
hsPkgs = (pkgs.hspkgs.extend butler.haskellExtend).extend haskellExtend;
appExe = pkgs.haskell.lib.justStaticExecutables hsPkgs.appPackage;
containerHome = "var/lib/${packageName}";
mkContainerHome = "mkdir -p -m 744 ${containerHome}";
container = pkgs.dockerTools.buildLayeredImage {
name = "localhost/memory-master";
contents = [ pkgs.coreutils pkgs.bash pkgs.openssl appExe ];
extraCommands = "${mkContainerHome} && mkdir -p -m 777 tmp";
tag = "latest";
created = "now";
config = {
Env = [
"HOME=/${containerHome}"
# Use fakeroot to avoid `No user exists for uid` error
"LD_PRELOAD=${pkgs.fakeroot}/lib/libfakeroot.so"
];
};
};
in {
defaultExe = appExe;
defaultPackage = hsPkgs.appPackage;
packages.container = container;
devShell = hsPkgs.shellFor {
packages = p: [ p.appPackage ];
buildInputs = with pkgs; [
ghcid
fourmolu
cabal-install
hlint
haskell-language-server
];
};
});
}