Dummy, no-brainer configuration for pinning nixpkgs over caba2nix for haskell startups.
Assuming you have a haskell project initialized in the monorepo, you can follow the steps below.
Minimal requirements for the setup is to have a cabal file and haskell module, like:
cabal-version: 2.4
name: foobar
version: 0.1.0.0
library
exposed-modules: FooBar
build-depends: base >= 4 && < 5
and:
module FooBar where
git remote add nix https://github.com/placek/hnix.git
git subtree add --prefix nix nix master --squash
Create a shell.nix
file:
import ./nix/shell.nix {
name = "foobar";
}
If you want to define more tools to be used:
import ./nix/shell.nix {
name = "foobar";
devTools = { pkgs }: with pkgs; [
gawk # add gnu awk
];
}
To pin souces to one specific revision add sources.json
file and place there
some details about the nixpkgs version, like:
{
"url": "https://github.com/NixOS/nixpkgs.git",
"rev": "a1a6472993e44c44c437f6b5004e53289bc8399c",
"ref": "refs/tags/21.11",
"allRefs": true
}
echo "use nix" > .envrc && direnv allow