citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

nix-cabal-build (514B)


      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 && ! -f Setup.lhs ]]; then
     11     cat > Setup.hs <<EOF
     12 import Distribution.Simple
     13 main = defaultMain
     14 EOF
     15 fi
     16 
     17 nix-build "$@" -E 'let pkgs = import <nixpkgs> {}; in pkgs.stdenv.lib.callPackageWith (pkgs // pkgs.haskellngPackages // pkgs.haskellPackages) ./default.nix {}'