summaryrefslogtreecommitdiffstats
path: root/shell.nix
diff options
context:
space:
mode:
Diffstat (limited to 'shell.nix')
-rw-r--r--shell.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 0000000..48d4bf4
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,31 @@
+{ compiler ? "default"
+, nixpkgs ? import <nixpkgs> {}
+}: let
+
+ inherit (nixpkgs) lib pkgs;
+
+ haskellPackages =
+ if compiler == "default" then
+ pkgs.haskellPackages
+ else
+ pkgs.haskell.packages.${compiler};
+
+ drv = haskellPackages.callPackage (import ./package.nix) {};
+
+in
+
+ lib.overrideDerivation drv.env (oldAttrs: {
+ buildInputs = [
+ pkgs.cabal-install
+ ];
+ shellHook = ''
+ CABAL_BUILD_DIR=$HOME/tmp/cache/${drv.pname}
+ cabal() {
+ command=$1; shift
+ ${pkgs.cabal-install}/bin/cabal \
+ "$command" \
+ --builddir="$CABAL_BUILD_DIR" \
+ "$@"
+ }
+ '';
+ })