diff --git a/.gitignore b/.gitignore index 80bd4ac..e956db6 100644 --- a/.gitignore +++ b/.gitignore @@ -47,8 +47,12 @@ tags # Emacs *# +.\#* .dir-locals.el TAGS +# direnv +.envrc + # other .DS_Store diff --git a/nix/stack-integration.nix b/nix/stack-integration.nix new file mode 100644 index 0000000..6893d71 --- /dev/null +++ b/nix/stack-integration.nix @@ -0,0 +1,14 @@ +let + pkgs = import {}; +in + +pkgs.haskell.lib.buildStackProject { + ghc = pkgs.haskell.compiler.ghc8107; + name = "piece-of-cake-slayer"; + # System dependencies needed at compilation time + buildInputs = [ + pkgs.zlib + pkgs.postgresql + pkgs.protobuf + ]; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..140b836 --- /dev/null +++ b/shell.nix @@ -0,0 +1,23 @@ +let + pkgs = import {}; + + stack-wrapped = pkgs.symlinkJoin { + name = "stack"; + paths = [ pkgs.stack ]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/stack \ + --add-flags "\ + --nix \ + --no-nix-pure \ + --nix-shell-file=nix/stack-integration.nix \ + " + ''; + }; + +in +pkgs.mkShell { + # Do NOT use `stack`, otherwise system dependencies like `zlib` are missing at compilation + buildInputs = [ stack-wrapped ]; + NIX_PATH = "nixpkgs=" + pkgs.path; +}