-
-
Save DeCentN2Madness/20cc9a74af8abcc93112c2bcae9a2031 to your computer and use it in GitHub Desktop.
Basic nix haskell setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -Eeuxo pipefail | |
| # Set up niv | |
| niv init | |
| niv update nixpkgs -b nixos-unstable | |
| niv add Infinisil/all-hies | |
| # Create cabal project | |
| export currentdir=${PWD##*/} | |
| cabal init -n -m --is-libandexe --source-dir src --main-is Main.hs -p $currentdir | |
| # Add default.nix | |
| cat << 'EOF' > ./default.nix | |
| let | |
| compilerVersion = "ghc865"; | |
| sources = import ./nix/sources.nix; | |
| pkgs = import sources.nixpkgs {}; | |
| hie = (import sources.all-hies {}).versions."${compilerVersion}"; | |
| in | |
| with pkgs; | |
| let | |
| hpkgs = haskell.packages."${compilerVersion}"; | |
| btools = [ | |
| hpkgs.cabal-install | |
| hpkgs.ghcid | |
| hpkgs.hoogle | |
| hpkgs.stylish-cabal | |
| hie | |
| ]; | |
| modifier = drv: haskell.lib.addBuildTools drv btools; | |
| in | |
| hpkgs.developPackage { root = ./.; inherit modifier; } | |
| EOF | |
| # Create direnv file | |
| cat << 'EOF' > .envrc | |
| use nix | |
| EOF | |
| direnv allow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment