基本上我正在使用这个:
默认.nix
{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc864" }:
nixpkgs.pkgs.haskell.packages.${compiler}.callPackage ./gitchapter.nix { }
Run Code Online (Sandbox Code Playgroud)
gitapter.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;
}
Run Code Online (Sandbox Code Playgroud)
但是pandoc-include-code,构建失败存在一个问题,此问题似乎已在 git 存储库中修复。如何覆盖包以指向 git 存储库或本地目录?
我会按照https://nixos.org/nixos/nix-pills/nixpkgs-overriding-packages.html 上的说明进行操作,还是会因使用该nixpkgs.pkgs.haskell.packages.${compiler}.callPackage功能而有所不同?
编辑: 感谢@sara 的回答,我现在有了:
{ 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) { }
Run Code Online (Sandbox Code Playgroud)
所以我想现在是确定现在如何覆盖该依赖项的问题。
考虑使用callCabal2nixfrom haskell.packages.${compiler}!
它将遍历您的 .cabal 文件并生成一个 nix 表达式以从中派生(从而使 gitchapter.nix 变得不必要),然后您可以以与正常派生覆盖类似的方式使用该overrideCabal函数haskell.lib覆盖它。然后,您可以从 git 获取更新的 pandoc 派生,并将其作为 buildInput 添加到您的覆盖表达式中。
| 归档时间: |
|
| 查看次数: |
1350 次 |
| 最近记录: |