Essentially I'm using this:
default.nix
{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc864" }:
nixpkgs.pkgs.haskell.packages.${compiler}.callPackage ./gitchapter.nix { }
gitchapter.nix
{ mkDerivation, base, directory, extra, filepath, foldl, hpack
, HUnit, mtl, optparse-applicative, pandoc-include-code, parsec
, pretty-simple, process, QuickCheck, rainbow, regex-pcre
, regex-posix, safe, stdenv, string-conversions, system-filepath
, template-haskell, text, transformers, turtle, unix
, unordered-containers
}:
mkDerivation {
pname = "gitchapter";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
libraryToolDepends = [ hpack ];
executableHaskellDepends = [
base directory extra filepath foldl HUnit mtl optparse-applicative
pandoc-include-code parsec pretty-simple process QuickCheck rainbow
regex-pcre regex-posix safe string-conversions system-filepath
template-haskell text transformers turtle unix unordered-containers
];
preConfigure = "hpack";
license = stdenv.lib.licenses.bsd3;
}
However there is an issue with the pandoc-include-code
failing to build, which seems to have since been fixed in the git repository. How can I override the package either to point to git repository or a local directory?
Would I follow the instructions at https://nixos.org/nixos/nix-pills/nixpkgs-overriding-packages.html or would this work differently due to using the nixpkgs.pkgs.haskell.packages.${compiler}.callPackage
function?
Edit: Thanks to @sara's answer I now have:
{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc864" } :
let
gitchapter = nixpkgs.pkgs.haskell.packages.${compiler}.callCabal2nix "gitchaper" (./.) {};
zzzzz = nixpkgs.pkgs.haskell.lib.overrideCabal gitchapter;
in
nixpkgs.pkgs.haskell.packages.${compiler}.callPackage (zzzzz) { }
So it I suppose now it's a matter of determining how to override that dependency now.