diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | shell.nix | 21 |
3 files changed, 21 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 6162045..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/shell.nix diff --git a/Makefile b/Makefile deleted file mode 100644 index 5c267ec..0000000 --- a/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -.PHONY: nix-shell -nix-shell: shell.nix - nix-shell --command 'cd src && exec ghci' - -shell.nix: scanner.cabal - cabal2nix --shell --sha256=0 $< \ - | sed 's:sha256 = "0":src = ./.:' > $@ diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..30c2872 --- /dev/null +++ b/shell.nix @@ -0,0 +1,21 @@ +{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }: + +let + + inherit (nixpkgs) pkgs; + + 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.callCabal2nix "terminal-scanner" ./. {}); + +in + + pkgs.lib.overrideDerivation drv.env (oldAttrs: { + buildInputs = [ + pkgs.cabal-install + ]; + }) |