Skip to content
Haskell and nix example project
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE
Makefile
README.md
Setup.hs
default.nix
haskell-nix-example.cabal
nixpkgs.json
pkgs.nix
project.nix
release.nix
shell.nix

README.md

haskell-nix-example

Steps to reproduce

  1. λ mkdir my-project && cd $_
  2. λ nix-shell --packages ghc --run 'cabal init'
  3. answer cabal init CLI questions
  4. copy default.nix, pkgs.nix, release.nix and shell.nix files
  5. copy Makefile, but update run to use the project's executable name
  6. pin nixpkgs and save to a .json file
    • using latest commit sha: λ nix-prefetch-git https://github.com/NixOS/nixpkgs.git > nixpkgs.json
    • or at a specific one: λ nix-prefetch-git https://github.com/NixOS/nixpkgs.git 05z8iqgpv0pzrwxvjkjwn03kz07dq2y4bv9wdclb2i4f2sh75dlh > nixpkgs.json
  7. λ make cabal (runs cabal2nix to generate project.nix)
  8. λ make build (runs nix-build)
  9. wait for a while
  10. λ make test (run the tests)
  11. λ make run (test it out!)

Resources

You can’t perform that action at this time.