From 9c98a3908de7bf4bf48009bfc5045ba8c43a3ed0 Mon Sep 17 00:00:00 2001 From: Atemu Date: Mon, 18 Jul 2022 17:31:13 +0200 Subject: [PATCH 1/2] git-annex: wrap with coreutils on all platforms Co-authored-by: sternenseemann --- .../development/haskell-modules/configuration-nix.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index c05a207e89e9..3679e6d891bd 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -535,9 +535,7 @@ self: super: builtins.intersectAttrs super { }) (addBuildTools (with pkgs.buildPackages; [makeWrapper python3Packages.sphinx]) super.futhark); - git-annex = let - pathForDarwin = pkgs.lib.makeBinPath [ pkgs.coreutils ]; - in overrideCabal (drv: pkgs.lib.optionalAttrs (!pkgs.stdenv.isLinux) { + git-annex = 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 @@ -545,11 +543,12 @@ self: super: builtins.intersectAttrs super { 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. + # Ensure git-annex uses the exact same coreutils it saw at build-time. + # This is especially important on Darwin but also in Linux environments + # where non-GNU coreutils are used by default. postFixup = '' wrapProgram $out/bin/git-annex \ - --prefix PATH : "${pathForDarwin}" + --prefix PATH : "${pkgs.lib.makeBinPath [ pkgs.coreutils ]}" '' + (drv.postFixup or ""); buildTools = [ pkgs.buildPackages.makeWrapper From 7e9e6145e68face7eeab9be4466743001fce5882 Mon Sep 17 00:00:00 2001 From: Atemu Date: Mon, 18 Jul 2022 17:35:25 +0200 Subject: [PATCH 2/2] git-annex: wrap with lsof Required by the assistant at runtime: ``` $ nix-shell --pure -p git git-annex $ git annex assistant git-annex: The lsof command is needed for watch mode to be safe, and is not in PATH. To override lsof checks to ensure that files are not open for writing when added to the annex, you can use --force Be warned: This can corrupt data in the annex, and make fsck complain. ``` --- pkgs/development/haskell-modules/configuration-nix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index 3679e6d891bd..f16a2c439f1a 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -548,7 +548,7 @@ self: super: builtins.intersectAttrs super { # where non-GNU coreutils are used by default. postFixup = '' wrapProgram $out/bin/git-annex \ - --prefix PATH : "${pkgs.lib.makeBinPath [ pkgs.coreutils ]}" + --prefix PATH : "${pkgs.lib.makeBinPath (with pkgs; [ coreutils lsof ])}" '' + (drv.postFixup or ""); buildTools = [ pkgs.buildPackages.makeWrapper