nexusmods-app: fix desktop entry (#421259)

authored by David McFarland and committed by GitHub 08ed4a9c 50948eb6

+34 -3
+34 -3
pkgs/by-name/ne/nexusmods-app/package.nix
··· 2 2 _7zz, 3 3 avalonia, 4 4 buildDotnetModule, 5 - copyDesktopItems, 6 5 desktop-file-utils, 7 6 dotnetCorePackages, 8 7 fetchgit, ··· 51 50 nativeCheckInputs = [ _7zz ]; 52 51 53 52 nativeBuildInputs = [ 54 - copyDesktopItems 55 53 imagemagick # For resizing SVG icon in postInstall 56 54 ]; 57 55 ··· 75 73 ]; 76 74 77 75 postInstall = '' 76 + ${lib.strings.toShellVars { 77 + inherit (finalAttrs.meta) mainProgram; 78 + INSTALL_EXEC = "\${INSTALL_EXEC}"; 79 + INSTALL_TRYEXEC = "\${INSTALL_TRYEXEC}"; 80 + }} 81 + 78 82 # Desktop entry 79 83 # As per #308324, use mainProgram from PATH, instead of $out/bin/NexusMods.App 80 84 install -D -m 444 -t $out/share/applications src/NexusMods.App/com.nexusmods.app.desktop 81 85 substituteInPlace $out/share/applications/com.nexusmods.app.desktop \ 82 - --replace-fail '${"$"}{INSTALL_EXEC}' "${finalAttrs.meta.mainProgram}" 86 + --replace-fail "$INSTALL_EXEC" "$mainProgram" \ 87 + --replace-fail "$INSTALL_TRYEXEC" "$mainProgram" 83 88 84 89 # AppStream metadata 85 90 install -D -m 444 -t $out/share/metainfo src/NexusMods.App/com.nexusmods.app.metainfo.xml ··· 142 147 ++ lib.optionals (!_7zz.meta.unfree) [ 143 148 "NexusMods.Games.FOMOD.Tests.FomodXmlInstallerTests.InstallsFilesSimple_UsingRar" 144 149 ]; 150 + 151 + doInstallCheck = true; 152 + 153 + nativeInstallCheckInputs = [ 154 + desktop-file-utils 155 + ]; 156 + 157 + # Upstream use ${...} templates in the desktop entry, so assert that we haven't missed any 158 + # See https://github.com/NixOS/nixpkgs/issues/421241 159 + installCheckPhase = '' 160 + runHook preInstallCheck 161 + 162 + echo 'Checking for issues in $out/share/applications/com.nexusmods.app.desktop' 163 + ( 164 + cd $out/share/applications 165 + desktop-file-validate com.nexusmods.app.desktop 166 + if grep '\$' com.nexusmods.app.desktop \ 167 + --with-filename --line-number 168 + then 169 + echo 'error: unexpected "$"' 170 + exit 1 171 + fi 172 + ) &>/dev/stderr 173 + 174 + runHook postInstallCheck 175 + ''; 145 176 146 177 passthru.updateScript = nix-update-script { }; 147 178