Last active
October 30, 2019 21:27
-
-
Save matthewess/03d833431b5855a3bc212861242bfaca to your computer and use it in GitHub Desktop.
Nix-based Unison Development Environment
This file contains 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
# this file is consumed by `nix-shell` to provide ghc+stack, as well as whatever development tools you need | |
# hlint is provided as an example | |
# this file can and should be customized with whatever development tools you want to use. | |
let | |
pkgs = import <nixpkgs> { }; | |
in | |
pkgs.mkShell { | |
# include build or development tools here | |
buildInputs = [ pkgs.stack pkgs.ghc pkgs.haskellPackages.hlint ]; | |
} |
This file contains 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
# this file is consumed by stack + nix to provide the right libraries for the unison build. it can probably be left alone. | |
{ ghc }: | |
with (import <nixpkgs> {}); | |
let | |
libs = [ | |
gmp | |
ncurses | |
zlib | |
]; | |
native_libs = lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ | |
Cocoa | |
CoreServices | |
]); | |
in haskell.lib.buildStackProject { | |
inherit ghc; | |
nativeBuildInputs = native_libs; | |
buildInputs = libs; | |
name = "unisonBuildEnv"; | |
src = if lib.inNixShell then null else ./.; | |
} |
This file contains 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
# ... | |
# add the following stanza to your stack.yaml to tell stack to build dependencies using nix. | |
nix: | |
enable: true | |
shell-file: stack-shell.nix | |
# alternatively, create a separate file like stack-nix.yaml, and invoke stack with `stack --stack-yaml stack-nix.yaml ...` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment