From 59a5db0684922f1318e9c36970290f17a6d7f7ed Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 4 Jun 2024 14:06:57 +0200 Subject: modernize build system --- shell.nix | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 shell.nix (limited to 'shell.nix') 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 {} +}: 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" \ + "$@" + } + ''; + }) -- cgit v1.2.3