Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Latest commit

 

History

History
21 lines (18 loc) · 924 Bytes

README.md

File metadata and controls

21 lines (18 loc) · 924 Bytes

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