Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Improve stack workflow/UX with haskell.nix #689

Copy link
Copy link
Closed
@codygman

Description

@codygman
Issue body actions
  • 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.