nix-cabal-shell (472B)
1 #!/usr/bin/env bash 2 3 cabal=$(echo *.cabal) 4 5 if [[ ! -f default.nix ]]; then 6 cabal2nix --sha256=X ./$cabal > default.nix 7 sed -i 's#sha.*#src = builtins.filterSource (path: type: type != "unknown") ./.;#' default.nix 8 fi 9 10 if [[ ! -f Setup.hs ]]; then 11 cat > Setup.hs <<EOF 12 import Distribution.Simple 13 main = defaultMain 14 EOF 15 fi 16 17 nix-shell -E 'let pkgs = import <nixpkgs> {}; in pkgs.stdenv.lib.callPackageWith (pkgs // pkgs.haskellngPackages) ./default.nix {}' "$@"