Closed
Description
- update the docs with a minimal copy-pastable example for stack (moving extra stuff to "appendix" or something)
- figure out if we want to work with stack to disable their nix support when in nix-shell (NIX_SHELL=impure)
This is a WIP proposal of sorts, but is trying to record learnings from hacking around with haskell.nix's stack support during ZuriHac 2020. I think the ideal UX for a stack user starting to use haskell.nix would be.
Create a new stack project:
stack new myproj
Add a default.nix:
let
haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
nixpkgsSrc = haskellNix.sources.nixpkgs-2003;
nixpkgsArgs = haskellNix.nixpkgsArgs;
in
{ pkgs ? import nixpkgsSrc nixpkgsArgs
, haskellCompiler ? "ghc883"
}:
pkgs.haskell-nix.stackProject {
src = pkgs.haskell-nix.haskellLib.cleanGit { name = "myproj"; src = ./.; };
compiler-nix-name = haskellCompiler;
}
Build it with haskell.nix:
nix build -f . myproj.components.library
That takes care of building your binaries, but then what about general development? Ideally I think you would do:
nix-shell -A shellFor
stack ghci
In practice though, this doesn't work out. I'm working on creating a repo with a readme that logs what happens when you try this.
Metadata
Metadata
Assignees
Labels
No labels