mirror of
https://github.com/simplex-chat/haskell.nix.git
synced 2026-06-03 09:17:32 +00:00
8ee6fcfba7
* Rename pkg-def-overlays to pkg-def-extras Fixes #75
1.6 KiB
1.6 KiB
User Guide (cabal project)
Here we will look into how to generate the pkgs.nix file for a
cabal.project project. For the full integration please see the User
Guide
Using plan-to-nix
We currently don't have a project-to-nix tool yet, as such creating
the relevant pkgs.nix file for a cabal.project is slightly more
involved than for a corresponding stack project.
With nix-tools in
PATH, we can simply run the following command on a cabal package:
# make sure the cabal project is configured (the plan.json file is generated)
cabal new-configure
# convert the plan.json file into a pkgs.nix file
plan-to-nix dist-newstyle/cache/plan.json > nix/plan.nix
This will produce a nix/plan.nix file that looks like the following:
hackage:
{
packages = {
"o-clock" = hackage.o-clock."0.1.1".revisions.default;
...
};
compiler = { ... };
}
it specifically does not include any of our local packages yet. We will need to run
cabal-to-nix $path > nix/$pkg.nix
or
cabal-to-nix $url $rev > nix/$pkg.nix
for each local (or source) package.
With this in place we can then proceed to build the nix/pkgs.nix
file as follows:
let plan = import ./plan.nix; in
{ pkg-def = plan;
extras =
{ local-package-a = ./local-package-a.nix;
local-package-b = ./local-package-b.nix;
source-import-a = ./source-import-a.nix;
source-import-b = ./source-import-b.nix;
...
};
}
If you came here from the User Guide, go back and complete the setup.