forked from philipp-zahn/open-games-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
50 lines (44 loc) · 1.57 KB
/
flake.nix
File metadata and controls
50 lines (44 loc) · 1.57 KB
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
{
description = "Opt-in Stack Flake";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
hPkgs =
pkgs.haskell.packages."ghc925"; # need to match Stackage LTS version from stack.yaml resolver
myDevTools = [
hPkgs.ghc # GHC compiler in the desired version (will be available on PATH)
stack-wrapped
pkgs.zlib # External C library needed by some Haskell packages
];
stack-wrapped = pkgs.symlinkJoin {
name = "stack"; # will be available as the usual `stack` in terminal
paths = [ pkgs.stack ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/stack \
--add-flags "\
--no-nix \
--system-ghc \
--no-install-ghc \
"
'';
};
in {
devShells.default = pkgs.mkShell {
buildInputs = myDevTools;
# Make external Nix c libraries like zlib known to GHC, like
# pkgs.haskell.lib.buildStackProject does
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath myDevTools;
shellHook = ''
if test -f "REPO_UNINITIALIZED.sh"; then
chmod +x REPO_UNINITIALIZED.sh
./REPO_UNINITIALIZED.sh
rm REPO_UNINITIALIZED.sh
fi
'';
};
});
}