about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorThiago Kenji Okada <thiagokokada@gmail.com>2024-01-14 16:34:33 +0000
committerGitHub <noreply@github.com>2024-01-14 16:34:33 +0000
commit9b3e68356ca009e28cb70935086479ba465cc2bf (patch)
treebce17929e58102ec914a245e32c21313b8a7eb4f /pkgs
parenta292058564022422d26461512a1fd18bdd4f87ec (diff)
parente05a981d057a66b0e5885ac496039ebd4d6ca70d (diff)
downloadnixlib-9b3e68356ca009e28cb70935086479ba465cc2bf.tar
nixlib-9b3e68356ca009e28cb70935086479ba465cc2bf.tar.gz
nixlib-9b3e68356ca009e28cb70935086479ba465cc2bf.tar.bz2
nixlib-9b3e68356ca009e28cb70935086479ba465cc2bf.tar.lz
nixlib-9b3e68356ca009e28cb70935086479ba465cc2bf.tar.xz
nixlib-9b3e68356ca009e28cb70935086479ba465cc2bf.tar.zst
nixlib-9b3e68356ca009e28cb70935086479ba465cc2bf.zip
Merge pull request #254766 from SuperSandro2000/xxd-closure-size
xxd: reduce closure size by splitting it into it's own output
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/editors/vim/common.nix24
-rw-r--r--pkgs/applications/editors/vim/default.nix9
-rw-r--r--pkgs/applications/editors/vim/full.nix4
-rw-r--r--pkgs/top-level/unixtools.nix4
4 files changed, 23 insertions, 18 deletions
diff --git a/pkgs/applications/editors/vim/common.nix b/pkgs/applications/editors/vim/common.nix
index d041601445f2..9ebe4d7acd49 100644
--- a/pkgs/applications/editors/vim/common.nix
+++ b/pkgs/applications/editors/vim/common.nix
@@ -2,6 +2,8 @@
 rec {
   version = "9.1.0004";
 
+  outputs = [ "out" "xxd" ];
+
   src = fetchFromGitHub {
     owner = "vim";
     repo = "vim";
@@ -14,12 +16,21 @@ rec {
 
   hardeningDisable = [ "fortify" ];
 
-  postPatch =
-    # Use man from $PATH; escape sequences are still problematic.
-    ''
-      substituteInPlace runtime/ftplugin/man.vim \
-        --replace "/usr/bin/man " "man "
-    '';
+  # Use man from $PATH; escape sequences are still problematic.
+  postPatch = ''
+    substituteInPlace runtime/ftplugin/man.vim \
+      --replace "/usr/bin/man " "man "
+  '';
+
+  # man page moving is done in postFixup instead of postInstall otherwise fixupPhase moves it right back where it was
+  postFixup = ''
+    moveToOutput bin/xxd "$xxd"
+    moveToOutput share/man/man1/xxd.1.gz "$xxd"
+    for manFile in $out/share/man/*/man1/xxd.1*; do
+      # moveToOutput does not take full paths or wildcards...
+      moveToOutput "share/man/$(basename "$(dirname "$(dirname "$manFile")")")/man1/xxd.1.gz" "$xxd"
+    done
+  '';
 
   meta = with lib; {
     description = "The most popular clone of the VI editor";
@@ -28,5 +39,6 @@ rec {
     maintainers = with maintainers; [ das_j equirosa ];
     platforms   = platforms.unix;
     mainProgram = "vim";
+    outputsToInstall = [ "out" "xxd" ];
   };
 }
diff --git a/pkgs/applications/editors/vim/default.nix b/pkgs/applications/editors/vim/default.nix
index c5b9a607f20d..d04fa241ba73 100644
--- a/pkgs/applications/editors/vim/default.nix
+++ b/pkgs/applications/editors/vim/default.nix
@@ -15,7 +15,7 @@ in
 stdenv.mkDerivation {
   pname = "vim";
 
-  inherit (common) version src postPatch hardeningDisable enableParallelBuilding enableParallelInstalling meta;
+  inherit (common) version outputs src postPatch hardeningDisable enableParallelBuilding enableParallelInstalling postFixup meta;
 
   nativeBuildInputs = [ gettext pkg-config ];
   buildInputs = [ ncurses bash gawk ]
@@ -62,11 +62,4 @@ stdenv.mkDerivation {
   '';
 
   __impureHostDeps = [ "/dev/ptmx" ];
-
-  # To fix the trouble in vim73, that it cannot cross-build with this patch
-  # to bypass a configure script check that cannot be done cross-building.
-  # http://groups.google.com/group/vim_dev/browse_thread/thread/66c02efd1523554b?pli=1
-  # patchPhase = ''
-  #   sed -i -e 's/as_fn_error.*int32.*/:/' src/auto/configure
-  # '';
 }
diff --git a/pkgs/applications/editors/vim/full.nix b/pkgs/applications/editors/vim/full.nix
index cfb8b84560cb..263f8d2984d0 100644
--- a/pkgs/applications/editors/vim/full.nix
+++ b/pkgs/applications/editors/vim/full.nix
@@ -66,7 +66,7 @@ in stdenv.mkDerivation {
 
   pname = "vim-full";
 
-  inherit (common) version postPatch hardeningDisable enableParallelBuilding meta;
+  inherit (common) version outputs postPatch hardeningDisable enableParallelBuilding meta;
 
   src = builtins.getAttr source {
     default = common.src; # latest release
@@ -181,7 +181,7 @@ in stdenv.mkDerivation {
     ln -sfn '${nixosRuntimepath}' "$out"/share/vim/vimrc
   '';
 
-  postFixup = lib.optionalString wrapPythonDrv ''
+  postFixup = common.postFixup + lib.optionalString wrapPythonDrv ''
     wrapProgram "$out/bin/vim" --prefix PATH : "${python3}/bin" \
       --set NIX_PYTHONPATH "${python3}/${python3.sitePackages}"
   '';
diff --git a/pkgs/top-level/unixtools.nix b/pkgs/top-level/unixtools.nix
index 40faa7642129..bcbbd6799d88 100644
--- a/pkgs/top-level/unixtools.nix
+++ b/pkgs/top-level/unixtools.nix
@@ -174,8 +174,8 @@ let
       darwin = pkgs.darwin.basic_cmds;
     };
     xxd = {
-      linux = pkgs.vim;
-      darwin = pkgs.vim;
+      linux = pkgs.vim.xxd;
+      darwin = pkgs.vim.xxd;
     };
   };