3
0
Fork 0
forked from mirrors/nixpkgs

haskellPackages.git-annex: refactor configuration-nix.nix overrides

Move everything into a single overrideCabal and express conditionality
using optionalAttrs. This should make it easier to add
more (un)conditional overrides in the future.
This commit is contained in:
sternenseemann 2021-11-14 11:19:51 +01:00 committed by sterni
parent 53d4ee4074
commit 3266c51421

View file

@ -516,25 +516,26 @@ self: super: builtins.intersectAttrs super {
})
(addBuildTools (with pkgs.buildPackages; [makeWrapper python3Packages.sphinx]) super.futhark);
git-annex = with pkgs;
if (!stdenv.isLinux) then
let path = lib.makeBinPath [ coreutils ];
in overrideCabal (_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
postPatch = lib.optionalString stdenv.isDarwin ''
substituteInPlace Test.hs \
--replace ', testCase "crypto" test_crypto' ""
'';
# On Darwin, git-annex mis-detects options to `cp`, so we wrap the
# binary to ensure it uses Nixpkgs' coreutils.
postFixup = ''
wrapProgram $out/bin/git-annex \
--prefix PATH : "${path}"
'';
}) (addBuildTool buildPackages.makeWrapper super.git-annex)
else super.git-annex;
git-annex = let
pathForDarwin = pkgs.lib.makeBinPath [ pkgs.coreutils ];
in overrideCabal (drv: pkgs.lib.optionalAttrs (!pkgs.stdenv.isLinux) {
# 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
postPatch = pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
substituteInPlace Test.hs \
--replace ', testCase "crypto" test_crypto' ""
'' + (drv.postPatch or "");
# On Darwin, git-annex mis-detects options to `cp`, so we wrap the
# binary to ensure it uses Nixpkgs' coreutils.
postFixup = ''
wrapProgram $out/bin/git-annex \
--prefix PATH : "${pathForDarwin}"
'' + (drv.postFixup or "");
buildTools = [
pkgs.buildPackages.makeWrapper
] ++ (drv.buildTools or []);
}) super.git-annex;
# The test suite has undeclared dependencies on git.
githash = dontCheck super.githash;