A peer-to-peer stack for code collaboration
Add shell.nix and README for building and developing with nix. (#124)
Julian Arni6cd8e7a86b75
diff --git a/.gitignore b/.gitignoreindex 2c2b5fe..bed8cbd 100644--- a/.gitignore+++ b/.gitignore@@ -9,3 +9,6 @@ radicle.cabal.cabal-sandbox/cabal.sandbox.configout/+result/+result+.stack-work/diff --git a/nix/README.md b/nix/README.mdnew file mode 100644index 0000000..8e8d882--- /dev/null+++ b/nix/README.md@@ -0,0 +1,29 @@+You can use the `shell.nix` from this directory to build radicle (and+optionally the documentation):++Just radicle:++``` sh+$ nix-shell nix/shell.nix+```++Everything needed for the documentation too:++``` sh+$ nix-shell nix/shell.nix --arg doc true+```++The `shell.nix` file also supports specifying a particular ghc version, e.g:++``` sh+$ nix-shell nix/shell.nix --argstr compiler ghcHEAD+```++(Since stack 1.n7 is not currently on the stable channel, you may need to add+the flag `--arg pkgs "import <nixos-unstable> {}`)++And then, inside the shell:++``` sh+stack build --system-ghc --nix-packages zlib+```diff --git a/nix/shell.nix b/nix/shell.nixnew file mode 100644index 0000000..167b4e7--- /dev/null+++ b/nix/shell.nix@@ -0,0 +1,22 @@+{ pkgs ? import <nixpkgs> {}+, compiler ? "ghc843"+, doc ? false+}:++with pkgs;++let+ ghc = haskell.packages.${compiler}.ghcWithPackages (_: []);+ docstuffs = python3.withPackages (ps: with ps; [ recommonmark sphinx sphinx_rtd_theme ]);+in++stdenv.mkDerivation {+ name = "radicle-dev";+ buildInputs = [ ghc zlib python3 wget stack ]+ ++ (if doc then [docstuffs postgresql] else []);+ libraryPkgconfigDepends = [ zlib ];+ shellHook = ''+ eval $(grep export ${ghc}/bin/ghc)+ export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH;+ '';+}