diff options
-rw-r--r-- | shell.nix | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..733234f --- /dev/null +++ b/shell.nix @@ -0,0 +1,25 @@ +{ compiler ? "default", doBenchmark ? false }: + +let + config = { + packageOverrides = pkgs: rec { + haskellPackages = pkgs.haskellPackages.override { + overrides = haskellPackagesNew: haskellPackagesOld: rec { + hedgehog-fn = haskellPackagesNew.callPackage ./nix/hedgehog-fn.nix {}; + tomland = haskellPackagesNew.callPackage ./nix/tomland.nix {}; + parser-combinators = haskellPackagesNew.callPackage ./nix/parser-combinators.nix {}; + }; + }; + }; + }; + pkgs = import <nixpkgs> { inherit config; }; + + haskellPackages = if compiler == "default" + then pkgs.haskellPackages + else pkgs.haskell.packages.${compiler}; + + variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id; + + drv = variant (haskellPackages.callPackage (import ./.) {}); +in + if pkgs.lib.inNixShell then drv.env else drv |