I need a shell where I can run (not develop) some some Haskell programs I wrote. So I created the following shell.nix.
with (import <nixpkgs> {});
let
pandoc-linear-table = haskellPackages.callCabal2nix "pandoc-linear-table" /home/amy/github/pandoc-linear-table {};
pandoc-logic-proof = haskellPackages.callCabal2nix "pandoc-logic-proof" /home/amy/github/pandoc-logic-proof {};
pandoc-columns = haskellPackages.callCabal2nix "pandoc-columns" /home/amy/github/pandoc-columns {};
pandoc-maths-web = haskellPackages.callCabal2nix "pandoc-maths-web" /home/amy/github/pandoc-maths-web {};
in
mkShell {
buildInputs = [
pkgs.lighttpd
pkgs.python310Packages.httpserver
pkgs.pandoc
pandoc-linear-table
pandoc-logic-proof
pandoc-columns
# pandoc-maths-web
];
}
This works fine with that one line commented out.
Now, the pandoc-linear-table
, pandoc-logic-proof
, and pandoc-columns
packages provide libraries as well as executables. I only need the executable in my shell.
The problem is that pandoc-maths-web
depends on those libraries in order to build, so if I uncomment that line, I get an error message. How can I include pandoc-maths-web
in my shell?
What I’ve tried: I guess what I need to do is to add overrides
to the arguments for callCabal2nix
. So I tried this, but I wasn’t really sure of the syntax.
with (import <nixpkgs> {});
let
pandoc-linear-table = haskellPackages.callCabal2nix "pandoc-linear-table" /home/amy/github/pandoc-linear-table {};
pandoc-logic-proof = haskellPackages.callCabal2nix "pandoc-logic-proof" /home/amy/github/pandoc-logic-proof {};
pandoc-columns = haskellPackages.callCabal2nix "pandoc-columns" /home/amy/github/pandoc-columns {};
pandoc-maths-web = haskellPackages.callCabal2nix "pandoc-maths-web" /home/amy/github/pandoc-maths-web
{
overrides = {
pandoc-linear-table = haskellPackages.callCabal2nix "pandoc-linear-table" /home/amy/github/pandoc-linear-table {};
pandoc-logic-proof = haskellPackages.callCabal2nix "pandoc-logic-proof" /home/amy/github/pandoc-logic-proof {};
pandoc-columns = haskellPackages.callCabal2nix "pandoc-columns" /home/amy/github/pandoc-columns {};
};
};
in
mkShell {
buildInputs = [
pkgs.lighttpd
pkgs.python310Packages.httpserver
pkgs.pandoc
pandoc-linear-table
pandoc-logic-proof
pandoc-columns
pandoc-maths-web
];
}
However, it still can’t seem to find my libraries.
✦ ❯ nix-shell
error: anonymous function at /nix/store/030vdxsj21cwlzzga61ncrgk552m9ssm-cabal2nix-pandoc-maths-web/default.nix:1:1 called without required argument 'pandoc-linear-table'
at /nix/store/g0xys7v6as2jaifxp1lkr9d7pbaksr03-nixos/nixos/pkgs/development/haskell-modules/make-package-set.nix:97:40:
96| # this wraps the `drv` function to add a `overrideScope` function to the result.
97| drvScope = allArgs: ensureAttrs (drv allArgs) // {
| ^
98| overrideScope = f:
(use '--show-trace' to show detailed location information)