haskellPackages: take (more) tool dependencies from buildPackages

Fix instances of tool dependencies coming from `self` or `pkgs`
instead of `self.buildHaskellPackages` or `pkgs.buildPackages`
respectively. This makes sure cross-evaluation and -compilation will
work although their may still be more kinks to work out (or cases I
missed). This change was mostly created by searching for `[tTool]` and
`\${` in the respective files.

Note that this has intentionally not been for test tool dependencies:
Like in `stdenv.mkDerivation` we need to view tests as being executed
on the *host platform* which is why we can't run tests while cross
compiling anyways. In practice this is not an important distinction,
though: `pkgs.buildPackages` and `pkgs` are almost identical in the
native case.

Resolves #127232.
This commit is contained in:
sternenseemann 2021-06-19 22:12:32 +02:00 committed by sterni
parent 0917e2ae27
commit 377924dd7b
2 changed files with 19 additions and 19 deletions

View file

@ -564,7 +564,7 @@ self: super: {
preCheck = "export HOME=$TMPDIR";
testToolDepends = drv.testToolDepends or [] ++ [self.cabal-install];
doCheck = false; # https://github.com/kazu-yamamoto/ghc-mod/issues/335
executableToolDepends = drv.executableToolDepends or [] ++ [pkgs.emacs];
executableToolDepends = drv.executableToolDepends or [] ++ [pkgs.buildPackages.emacs];
postInstall = ''
local lispdir=( "$data/share/${self.ghc.name}/*/${drv.pname}-${drv.version}/elisp" )
make -C $lispdir
@ -765,7 +765,7 @@ self: super: {
# $PATH. Also, cryptol needs a version of sbl that's newer than what we have
# in LTS-13.x.
cryptol = overrideCabal super.cryptol (drv: {
buildTools = drv.buildTools or [] ++ [ pkgs.makeWrapper ];
buildTools = drv.buildTools or [] ++ [ pkgs.buildPackages.makeWrapper ];
postInstall = drv.postInstall or "" + ''
for b in $out/bin/cryptol $out/bin/cryptol-html; do
wrapProgram $b --prefix 'PATH' ':' "${pkgs.lib.getBin pkgs.z3}/bin"
@ -791,7 +791,7 @@ self: super: {
preCheck = ''
export HOME="$TMPDIR"
'' + (drv.preCheck or "");
libraryToolDepends = drv.libraryToolDepends or [] ++ [pkgs.postgresql];
libraryToolDepends = drv.libraryToolDepends or [] ++ [pkgs.buildPackages.postgresql];
testToolDepends = drv.testToolDepends or [] ++ [pkgs.procps];
});
@ -1205,7 +1205,7 @@ self: super: {
EdisonAPI = appendPatch super.EdisonAPI (pkgs.fetchpatch {
url = "https://github.com/robdockins/edison/pull/16/commits/8da6c0f7d8666766e2f0693425c347c0adb492dc.patch";
postFetch = ''
${pkgs.patchutils}/bin/filterdiff --include='a/edison-api/*' --strip=1 "$out" > "$tmpfile"
${pkgs.buildPackages.patchutils}/bin/filterdiff --include='a/edison-api/*' --strip=1 "$out" > "$tmpfile"
mv "$tmpfile" "$out"
'';
sha256 = "0yi5pz039lcm4pl9xnl6krqxyqq5rgb5b6m09w0sfy06x0n4x213";
@ -1214,7 +1214,7 @@ self: super: {
EdisonCore = appendPatch super.EdisonCore (pkgs.fetchpatch {
url = "https://github.com/robdockins/edison/pull/16/commits/8da6c0f7d8666766e2f0693425c347c0adb492dc.patch";
postFetch = ''
${pkgs.patchutils}/bin/filterdiff --include='a/edison-core/*' --strip=1 "$out" > "$tmpfile"
${pkgs.buildPackages.patchutils}/bin/filterdiff --include='a/edison-core/*' --strip=1 "$out" > "$tmpfile"
mv "$tmpfile" "$out"
'';
sha256 = "097wqn8hxsr50b9mhndg5pjim5jma2ym4ylpibakmmb5m98n17zp";
@ -1293,7 +1293,7 @@ self: super: {
# Fixed upstream but not released to Hackage yet:
# https://github.com/k0001/hs-libsodium/issues/2
libsodium = overrideCabal super.libsodium (drv: {
libraryToolDepends = (drv.libraryToolDepends or []) ++ [self.c2hs];
libraryToolDepends = (drv.libraryToolDepends or []) ++ [self.buildHaskellPackages.c2hs];
});
# https://github.com/kowainik/policeman/issues/57
@ -1386,7 +1386,7 @@ self: super: {
update-nix-fetchgit = let deps = [ pkgs.git pkgs.nix pkgs.nix-prefetch-git ];
in generateOptparseApplicativeCompletion "update-nix-fetchgit" (overrideCabal
(addTestToolDepends super.update-nix-fetchgit deps) (drv: {
buildTools = drv.buildTools or [ ] ++ [ pkgs.makeWrapper ];
buildTools = drv.buildTools or [ ] ++ [ pkgs.buildPackages.makeWrapper ];
postInstall = drv.postInstall or "" + ''
wrapProgram "$out/bin/update-nix-fetchgit" --prefix 'PATH' ':' "${
pkgs.lib.makeBinPath deps
@ -1612,7 +1612,7 @@ self: super: {
feed = dontCheck super.feed;
spacecookie = overrideCabal super.spacecookie (old: {
buildTools = (old.buildTools or []) ++ [ pkgs.installShellFiles ];
buildTools = (old.buildTools or []) ++ [ pkgs.buildPackages.installShellFiles ];
# let testsuite discover the resulting binary
preCheck = ''
export SPACECOOKIE_TEST_BIN=./dist/build/spacecookie/spacecookie
@ -1884,7 +1884,7 @@ EOT
] ++ (drv.patches or []);
# fix line endings preventing patch from applying
prePatch = ''
${pkgs.dos2unix}/bin/dos2unix hashable.cabal
${pkgs.buildPackages.dos2unix}/bin/dos2unix hashable.cabal
'' + (drv.prePatch or "");
});

View file

@ -243,7 +243,7 @@ self: super: builtins.intersectAttrs super {
llvm-hs = super.llvm-hs.override { llvm-config = pkgs.llvm_9; };
# Needs help finding LLVM.
spaceprobe = addBuildTool super.spaceprobe self.llvmPackages.llvm;
spaceprobe = addBuildTool super.spaceprobe self.buildHaskellPackages.llvmPackages.llvm;
# Tries to run GUI in tests
leksah = dontCheck (overrideCabal super.leksah (drv: {
@ -336,7 +336,7 @@ self: super: builtins.intersectAttrs super {
# https://github.com/deech/fltkhs/issues/16
fltkhs = overrideCabal super.fltkhs (drv: {
libraryToolDepends = (drv.libraryToolDepends or []) ++ [pkgs.autoconf];
libraryToolDepends = (drv.libraryToolDepends or []) ++ [pkgs.buildPackages.autoconf];
librarySystemDepends = (drv.librarySystemDepends or []) ++ [pkgs.fltk13 pkgs.libGL pkgs.libjpeg];
});
@ -495,8 +495,8 @@ self: super: builtins.intersectAttrs super {
Frames-beam = dontCheck super.Frames-beam;
# Compile manpages (which are in RST and are compiled with Sphinx).
futhark = with pkgs;
overrideCabal (addBuildTools super.futhark [makeWrapper python3Packages.sphinx])
futhark =
overrideCabal (addBuildTools super.futhark (with pkgs.buildPackages; [makeWrapper python3Packages.sphinx]))
(_drv: {
postBuild = (_drv.postBuild or "") + ''
make -C docs man
@ -511,7 +511,7 @@ self: super: builtins.intersectAttrs super {
git-annex = with pkgs;
if (!stdenv.isLinux) then
let path = lib.makeBinPath [ coreutils ];
in overrideCabal (addBuildTool super.git-annex makeWrapper) (_drv: {
in overrideCabal (addBuildTool super.git-annex buildPackages.makeWrapper) (_drv: {
# This is an instance of https://github.com/NixOS/nix/pull/1085
# Fails with:
# gpg: can't connect to the agent: File name too long
@ -631,7 +631,7 @@ self: super: builtins.intersectAttrs super {
# mplayer-spot uses mplayer at runtime.
mplayer-spot =
let path = pkgs.lib.makeBinPath [ pkgs.mplayer ];
in overrideCabal (addBuildTool super.mplayer-spot pkgs.makeWrapper) (oldAttrs: {
in overrideCabal (addBuildTool super.mplayer-spot pkgs.buildPackages.makeWrapper) (oldAttrs: {
postInstall = ''
wrapProgram $out/bin/mplayer-spot --prefix PATH : "${path}"
'';
@ -643,7 +643,7 @@ self: super: builtins.intersectAttrs super {
cut-the-crap =
let path = pkgs.lib.makeBinPath [ pkgs.ffmpeg pkgs.youtube-dl ];
in overrideCabal (addBuildTool super.cut-the-crap pkgs.makeWrapper) (_drv: {
in overrideCabal (addBuildTool super.cut-the-crap pkgs.buildPackages.makeWrapper) (_drv: {
postInstall = ''
wrapProgram $out/bin/cut-the-crap \
--prefix PATH : "${path}"
@ -660,7 +660,7 @@ self: super: builtins.intersectAttrs super {
neuron = overrideCabal (super.neuron) (drv: {
# neuron expects the neuron-search script to be in PATH at built-time.
buildTools = [ pkgs.makeWrapper ];
buildTools = [ pkgs.buildPackages.makeWrapper ];
preConfigure = ''
mkdir -p $out/bin
cp src-bash/neuron-search $out/bin/neuron-search
@ -879,7 +879,7 @@ self: super: builtins.intersectAttrs super {
(justStaticExecutables super.cabal2nix-unstable)
(drv: {
buildTools = (drv.buildTools or []) ++ [
pkgs.makeWrapper
pkgs.buildPackages.makeWrapper
];
postInstall = ''
wrapProgram $out/bin/cabal2nix \
@ -902,7 +902,7 @@ self: super: builtins.intersectAttrs super {
# Runtime dependencies and CLI completion
nvfetcher = generateOptparseApplicativeCompletion "nvfetcher" (overrideCabal
super.nvfetcher (drv: {
buildTools = drv.buildTools or [ ] ++ [ pkgs.makeWrapper ];
buildTools = drv.buildTools or [ ] ++ [ pkgs.buildPackages.makeWrapper ];
postInstall = drv.postInstall or "" + ''
wrapProgram "$out/bin/nvfetcher" --prefix 'PATH' ':' "${
pkgs.lib.makeBinPath [ pkgs.nvchecker pkgs.nix-prefetch-git ]