Merge pull request #154677 from IvarWithoutBones/dotnetModule-installphase

buildDotnetModule: wrap executables in preFixup

authored by

Pavol Rusnak and committed by
GitHub
5c32667d e924bc68

+37 -37
+1 -1
doc/languages-frameworks/dotnet.section.md
··· 84 84 <ProjectReference Include="../foo/bar.fsproj" /> 85 85 <PackageReference Include="bar" Version="*" Condition=" '$(ContinuousIntegrationBuild)'=='true' "/> 86 86 ``` 87 - * `executables` is used to specify which executables get wrapped to `$out/bin`, relative to `$out/lib/$pname`. If this is unset, all executables generated will get installed. If you do not want to install any, set this to `[]`. 87 + * `executables` is used to specify which executables get wrapped to `$out/bin`, relative to `$out/lib/$pname`. If this is unset, all executables generated will get installed. If you do not want to install any, set this to `[]`. This gets done in the `preFixup` phase. 88 88 * `runtimeDeps` is used to wrap libraries into `LD_LIBRARY_PATH`. This is how dotnet usually handles runtime dependencies. 89 89 * `buildType` is used to change the type of build. Possible values are `Release`, `Debug`, etc. By default, this is set to `Release`. 90 90 * `dotnet-sdk` is useful in cases where you need to change what dotnet SDK is being used.
+1 -1
pkgs/applications/blockchains/btcpayserver/default.nix
··· 26 26 makeWrapperArgs+=(--run "cd $out/lib/btcpayserver") 27 27 ''; 28 28 29 - postInstall = '' 29 + postFixup = '' 30 30 mv $out/bin/{BTCPayServer,btcpayserver} 31 31 ''; 32 32
+1 -1
pkgs/applications/blockchains/nbxplorer/default.nix
··· 17 17 dotnet-sdk = dotnetCorePackages.sdk_3_1; 18 18 dotnet-runtime = dotnetCorePackages.aspnetcore_3_1; 19 19 20 - postInstall = '' 20 + postFixup = '' 21 21 mv $out/bin/{NBXplorer,nbxplorer} 22 22 ''; 23 23
+1 -1
pkgs/applications/blockchains/wasabibackend/default.nix
··· 36 36 ) 37 37 ''; 38 38 39 - postInstall = '' 39 + postFixup = '' 40 40 mv $out/bin/WalletWasabi.Backend $out/bin/WasabiBackend 41 41 ''; 42 42
+6 -14
pkgs/applications/graphics/pinta/default.nix
··· 19 19 ]; 20 20 21 21 runtimeDeps = [ gtk3 ]; 22 + buildInputs = runtimeDeps; 22 23 23 24 dotnet-sdk = dotnetCorePackages.sdk_6_0; 24 25 dotnet-runtime = dotnetCorePackages.runtime_6_0; ··· 39 40 sha256 = "sha256-iOKJPB2bI/GjeDxzG7r6ew7SGIzgrJTcRXhEYzOpC9k="; 40 41 }; 41 42 42 - # FIXME: this should be propagated by wrapGAppsHook already, however for some 43 - # reason it is not working. Maybe a bug in buildDotnetModule? 44 - preInstall = '' 45 - gappsWrapperArgs+=( 46 - --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}" 47 - --set GDK_PIXBUF_MODULE_FILE ${librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache 48 - ) 49 - ''; 50 - 51 - postInstall = '' 43 + postFixup = '' 52 44 # Rename the binary 53 45 mv $out/bin/Pinta $out/bin/pinta 54 46 ··· 76 68 --replace _Keywords Keywords 77 69 ''; 78 70 79 - meta = { 71 + meta = with lib; { 80 72 homepage = "https://www.pinta-project.com/"; 81 73 description = "Drawing/editing program modeled after Paint.NET"; 82 - license = lib.licenses.mit; 83 - maintainers = with lib.maintainers; [ thiagokokada ]; 84 - platforms = with lib.platforms; linux; 74 + license = licenses.mit; 75 + maintainers = with maintainers; [ thiagokokada ]; 76 + platforms = with platforms; linux; 85 77 mainProgram = "pinta"; 86 78 }; 87 79 }
+18 -16
pkgs/build-support/build-dotnet-module/default.nix
··· 224 224 "''${dotnetInstallFlags[@]}" \ 225 225 "''${dotnetFlags[@]}" 226 226 done 227 - '' + (lib.optionalString packNupkg '' 227 + '' + lib.optionalString packNupkg '' 228 228 for project in ''${projectFile[@]}; do 229 229 dotnet pack "$project" \ 230 230 -p:ContinuousIntegrationBuild=true \ ··· 235 235 "''${dotnetPackFlags[@]}" \ 236 236 "''${dotnetFlags[@]}" 237 237 done 238 - '') + (if executables != null then '' 239 - for executable in $executables; do 238 + '' + '' 239 + runHook postInstall 240 + ''; 241 + 242 + preFixup = '' 243 + _wrapDotnetProgram() { 244 + makeWrapper "$1" "$out/bin/$(basename "$executable")" \ 245 + --set DOTNET_ROOT "${dotnet-runtime}" \ 246 + --suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}" \ 247 + "''${gappsWrapperArgs[@]}" \ 248 + "''${makeWrapperArgs[@]}" 249 + } 250 + '' + (if executables != null then '' 251 + for executable in ''${executables[@]}; do 240 252 execPath="$out/lib/${args.pname}/$executable" 241 253 242 254 if [[ -f "$execPath" && -x "$execPath" ]]; then 243 - makeWrapper "$execPath" "$out/bin/$(basename "$executable")" \ 244 - --set DOTNET_ROOT "${dotnet-runtime}" \ 245 - --suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}" \ 246 - "''${gappsWrapperArgs[@]}" \ 247 - "''${makeWrapperArgs[@]}" 255 + _wrapDotnetProgram $execPath 248 256 else 249 257 echo "Specified binary \"$executable\" is either not an executable, or does not exist!" 250 258 exit 1 ··· 253 261 '' else '' 254 262 for executable in $out/lib/${args.pname}/*; do 255 263 if [[ -f "$executable" && -x "$executable" && "$executable" != *"dll"* ]]; then 256 - makeWrapper "$executable" "$out/bin/$(basename "$executable")" \ 257 - --set DOTNET_ROOT "${dotnet-runtime}" \ 258 - --suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}" \ 259 - "''${gappsWrapperArgs[@]}" \ 260 - "''${makeWrapperArgs[@]}" 264 + _wrapDotnetProgram $executable 261 265 fi 262 266 done 263 - '') + '' 264 - runHook postInstall 265 - ''; 267 + ''); 266 268 }); 267 269 in 268 270 package
+6 -2
pkgs/misc/emulators/ryujinx/default.nix
··· 1 1 { lib, buildDotnetModule, fetchFromGitHub, makeDesktopItem, copyDesktopItems 2 2 , libX11, libgdiplus, ffmpeg 3 3 , SDL2_mixer, openal, libsoundio, sndio, pulseaudio 4 - , gtk3, gobject-introspection, gdk-pixbuf, wrapGAppsHook 4 + , gtk3, gdk-pixbuf, wrapGAppsHook 5 5 }: 6 6 7 7 buildDotnetModule rec { ··· 27 27 nativeBuildInputs = [ 28 28 copyDesktopItems 29 29 wrapGAppsHook 30 - gobject-introspection 30 + ]; 31 + 32 + buildInputs = [ 33 + gtk3 31 34 gdk-pixbuf 32 35 ]; 33 36 ··· 78 81 changelog = "https://github.com/Ryujinx/Ryujinx/wiki/Changelog"; 79 82 maintainers = [ maintainers.ivar ]; 80 83 platforms = [ "x86_64-linux" ]; 84 + mainProgram = "Ryujinx"; 81 85 }; 82 86 passthru.updateScript = ./updater.sh; 83 87 }
+1 -1
pkgs/tools/X11/opentabletdriver/default.nix
··· 68 68 "OpenTabletDriver.Tests.PluginRepositoryTest.ExpandRepositoryTarball" 69 69 ]; 70 70 71 - postInstall = '' 71 + postFixup = '' 72 72 # Give a more "*nix" name to the binaries 73 73 mv $out/bin/OpenTabletDriver.Console $out/bin/otd 74 74 mv $out/bin/OpenTabletDriver.Daemon $out/bin/otd-daemon
+2
pkgs/tools/games/opentracker/default.nix
··· 41 41 buildInputs = [ 42 42 stdenv.cc.cc.lib 43 43 fontconfig 44 + gtk3 44 45 ]; 45 46 46 47 runtimeDeps = [ ··· 58 59 homepage = "https://github.com/trippsc2/OpenTracker"; 59 60 license = licenses.mit; 60 61 maintainers = [ maintainers.ivar ]; 62 + mainProgram = "OpenTracker"; 61 63 }; 62 64 }