p4v: wrap derivation to avoid polluting PATH

P4V includes a bunch of extra binaries in its bin directory that are
only useful as part of their wrapper scripts. They really belong in a
libexec-style directory, but their wrappers hardcode bin, so we take the
easier approach of wrapping their wrappers.

+68 -46
+68 -46
pkgs/applications/version-management/p4v/default.nix
··· 27 , xcbutilwm 28 }: 29 30 - stdenv.mkDerivation { 31 pname = "p4v"; 32 version = "2022.2.2336701"; 33 34 - src = fetchurl { 35 - url = "https://web.archive.org/web/20220902181457/https://ftp.perforce.com/perforce/r22.2/bin.linux26x86_64/p4v.tgz"; 36 - sha256 = "8fdade4aafe25f568a61cfd80823aa90599c2a404b7c6b4a0862c84b07a9f8d2"; 37 - }; 38 39 - nativeBuildInputs = [ autoPatchelfHook ]; 40 - buildInputs = [ 41 - cups 42 - dbus 43 - fontconfig 44 - gccForLibs 45 - libX11 46 - libXcomposite 47 - libXcursor 48 - libXdamage 49 - libXext 50 - libXi 51 - libXrandr 52 - libXrender 53 - libXtst 54 - libinput 55 - libxcb 56 - libxkbcommon 57 - nss 58 - qttools 59 - qtwebengine 60 - xcbutilimage 61 - xcbutilkeysyms 62 - xcbutilrenderutil 63 - xcbutilwm 64 - ]; 65 66 - dontBuild = true; 67 68 - # Don't wrap the Qt apps; upstream has its own wrapper scripts. 69 - dontWrapQtApps = true; 70 71 - installPhase = '' 72 - mkdir -p $out 73 - cp -r bin lib $out 74 - addAutoPatchelfSearchPath $out/lib 75 ''; 76 77 - meta = { 78 - description = "Perforce Helix Visual Client"; 79 - homepage = "https://www.perforce.com"; 80 - sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 81 - license = lib.licenses.unfreeRedistributable; 82 - platforms = [ "x86_64-linux" ]; 83 - maintainers = with lib.maintainers; [ impl nathyong nioncode ]; 84 - }; 85 }
··· 27 , xcbutilwm 28 }: 29 30 + let 31 pname = "p4v"; 32 version = "2022.2.2336701"; 33 34 + unwrapped = stdenv.mkDerivation { 35 + pname = "${pname}-unwrapped"; 36 + inherit version; 37 38 + src = fetchurl { 39 + url = "https://web.archive.org/web/20220902181457/https://ftp.perforce.com/perforce/r22.2/bin.linux26x86_64/p4v.tgz"; 40 + sha256 = "8fdade4aafe25f568a61cfd80823aa90599c2a404b7c6b4a0862c84b07a9f8d2"; 41 + }; 42 43 + nativeBuildInputs = [ autoPatchelfHook ]; 44 + buildInputs = [ 45 + cups 46 + dbus 47 + fontconfig 48 + gccForLibs 49 + libX11 50 + libXcomposite 51 + libXcursor 52 + libXdamage 53 + libXext 54 + libXi 55 + libXrandr 56 + libXrender 57 + libXtst 58 + libinput 59 + libxcb 60 + libxkbcommon 61 + nss 62 + qttools 63 + qtwebengine 64 + xcbutilimage 65 + xcbutilkeysyms 66 + xcbutilrenderutil 67 + xcbutilwm 68 + ]; 69 70 + dontBuild = true; 71 + 72 + # Don't wrap the Qt apps; upstream has its own wrapper scripts. 73 + dontWrapQtApps = true; 74 + 75 + installPhase = '' 76 + mkdir -p $out 77 + cp -r bin lib $out 78 + addAutoPatchelfSearchPath $out/lib 79 + ''; 80 + 81 + meta = { 82 + description = "Perforce Helix Visual Client"; 83 + homepage = "https://www.perforce.com"; 84 + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 85 + license = lib.licenses.unfreeRedistributable; 86 + platforms = [ "x86_64-linux" ]; 87 + maintainers = with lib.maintainers; [ impl nathyong nioncode ]; 88 + }; 89 + }; 90 + in 91 + stdenv.mkDerivation { 92 + inherit pname version; 93 94 + # Build a "clean" version of the package so that we don't add extra ".bin" or 95 + # configuration files to users' PATHs. We can't easily put the unwrapped 96 + # package files in libexec (where they belong, probably) because the upstream 97 + # wrapper scripts have the bin directory hardcoded. 98 + buildCommand = '' 99 + mkdir -p $out/bin 100 + for f in p4admin p4merge p4v p4vc; do 101 + ln -s ${unwrapped}/bin/$f $out/bin 102 + done 103 ''; 104 + preferLocalBuild = true; 105 106 + inherit (unwrapped) meta passthru; 107 }