-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathflake.nix
57 lines (55 loc) · 1.83 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
{
description = "lorem-markdownum";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = inputs:
inputs.flake-utils.lib.eachDefaultSystem (system:
let
pkgs = inputs.nixpkgs.legacyPackages.${system};
haskell = pkgs.haskell.packages.ghc96;
package = haskell.callCabal2nix "lorem-markdownum" ./. { };
packageExes = pkgs.haskell.lib.justStaticExecutables package;
share = pkgs.stdenv.mkDerivation {
name = "share";
src = ./.;
installPhase = ''
mkdir -p $out/usr/share/lorem-markdownum
cp -r data/ $out/usr/share/lorem-markdownum/data/
cp -r static/ $out/usr/share/lorem-markdownum/static/
'';
};
in {
packages = {
default = package;
docker = pkgs.dockerTools.buildLayeredImage {
name = "jaspervdj/lorem-markdownum";
tag = "latest";
contents = [ share ];
config = {
Cmd = "${packageExes}/bin/lorem-markdownum-web";
Env = [
"LOREM_MARKDOWNUM_DATA_DIR=/usr/share/lorem-markdownum/data"
"LOREM_MARKDOWNUM_STATIC_DIR=/usr/share/lorem-markdownum/static"
"LOREM_MARKDOWNUM_BIND_ADDRESS=0.0.0.0"
"LOREM_MARKDOWNUM_BIND_PORT=80"
];
};
};
};
devShells = {
default = pkgs.mkShell {
buildInputs = [ pkgs.zlib.dev ];
packages = [
pkgs.cabal-install
pkgs.entr
haskell.stylish-haskell
(haskell.ghc.withPackages
(p: package.buildInputs ++ [ p.random ]))
];
};
};
formatter = pkgs.nixfmt;
});
}