git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #154677 from IvarWithoutBones/dotnetModule-installphase

buildDotnetModule: wrap executables in preFixup

commit5c32667d6e1c635dfedca3bc64d01d48f831bdce authorPavol Rusnak <pavol@rusnak.io> dateSun 16 Jan 2022, 15:22 (5 years ago) parente924bc663477f9
9 files changed+37−37
doc/languages-frameworks/dotnet.section.md+1−1 pkgs/applications/blockchains/btcpayserver/default.nix+1−1 pkgs/applications/blockchains/nbxplorer/default.nix+1−1 pkgs/applications/blockchains/wasabibackend/default.nix+1−1 pkgs/applications/graphics/pinta/default.nix+6−14 pkgs/build-support/build-dotnet-module/default.nix+18−16 pkgs/misc/emulators/ryujinx/default.nix+6−2 pkgs/tools/X11/opentabletdriver/default.nix+1−1 pkgs/tools/games/opentracker/default.nix+2
doc/languages-frameworks/dotnet.section.md+1−1
@@ -84,7 +84,7 @@ To package Dotnet applications, you can use `buildDotnetModule`. This has simila
8484 <ProjectReference Include="../foo/bar.fsproj" />
8585 <PackageReference Include="bar" Version="*" Condition=" '$(ContinuousIntegrationBuild)'=='true' "/>
8686 ```
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.
8888* `runtimeDeps` is used to wrap libraries into `LD_LIBRARY_PATH`. This is how dotnet usually handles runtime dependencies.
8989* `buildType` is used to change the type of build. Possible values are `Release`, `Debug`, etc. By default, this is set to `Release`.
9090* `dotnet-sdk` is useful in cases where you need to change what dotnet SDK is being used.
pkgs/applications/blockchains/btcpayserver/default.nix+1−1
@@ -26,7 +26,7 @@ buildDotnetModule rec {
2626 makeWrapperArgs+=(--run "cd $out/lib/btcpayserver")
2727 '';
2828
29− postInstall = ''
29+ postFixup = ''
3030 mv $out/bin/{BTCPayServer,btcpayserver}
3131 '';
3232
pkgs/applications/blockchains/nbxplorer/default.nix+1−1
@@ -17,7 +17,7 @@ buildDotnetModule rec {
1717 dotnet-sdk = dotnetCorePackages.sdk_3_1;
1818 dotnet-runtime = dotnetCorePackages.aspnetcore_3_1;
1919
20− postInstall = ''
20+ postFixup = ''
2121 mv $out/bin/{NBXplorer,nbxplorer}
2222 '';
2323
pkgs/applications/blockchains/wasabibackend/default.nix+1−1
@@ -36,7 +36,7 @@ buildDotnetModule rec {
3636 )
3737 '';
3838
39− postInstall = ''
39+ postFixup = ''
4040 mv $out/bin/WalletWasabi.Backend $out/bin/WasabiBackend
4141 '';
4242
pkgs/applications/graphics/pinta/default.nix+6−14
@@ -19,6 +19,7 @@ buildDotnetModule rec {
1919 ];
2020
2121 runtimeDeps = [ gtk3 ];
22+ buildInputs = runtimeDeps;
2223
2324 dotnet-sdk = dotnetCorePackages.sdk_6_0;
2425 dotnet-runtime = dotnetCorePackages.runtime_6_0;
@@ -39,16 +40,7 @@ buildDotnetModule rec {
3940 sha256 = "sha256-iOKJPB2bI/GjeDxzG7r6ew7SGIzgrJTcRXhEYzOpC9k=";
4041 };
4142
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 = ''
5244 # Rename the binary
5345 mv $out/bin/Pinta $out/bin/pinta
5446
@@ -76,12 +68,12 @@ buildDotnetModule rec {
7668 --replace _Keywords Keywords
7769 '';
7870
79− meta = {
71+ meta = with lib; {
8072 homepage = "https://www.pinta-project.com/";
8173 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;
8577 mainProgram = "pinta";
8678 };
8779}
pkgs/build-support/build-dotnet-module/default.nix+18−16
@@ -224,7 +224,7 @@ let
224224 "''${dotnetInstallFlags[@]}" \
225225 "''${dotnetFlags[@]}"
226226 done
227− '' + (lib.optionalString packNupkg ''
227+ '' + lib.optionalString packNupkg ''
228228 for project in ''${projectFile[@]}; do
229229 dotnet pack "$project" \
230230 -p:ContinuousIntegrationBuild=true \
@@ -235,16 +235,24 @@ let
235235 "''${dotnetPackFlags[@]}" \
236236 "''${dotnetFlags[@]}"
237237 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
240252 execPath="$out/lib/${args.pname}/$executable"
241253
242254 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
248256 else
249257 echo "Specified binary \"$executable\" is either not an executable, or does not exist!"
250258 exit 1
@@ -253,16 +261,10 @@ let
253261 '' else ''
254262 for executable in $out/lib/${args.pname}/*; do
255263 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
261265 fi
262266 done
263− '') + ''
264− runHook postInstall
265− '';
267+ '');
266268 });
267269in
268270 package
pkgs/misc/emulators/ryujinx/default.nix+6−2
@@ -1,7 +1,7 @@
11{ lib, buildDotnetModule, fetchFromGitHub, makeDesktopItem, copyDesktopItems
22, libX11, libgdiplus, ffmpeg
33, SDL2_mixer, openal, libsoundio, sndio, pulseaudio
4−, gtk3, gobject-introspection, gdk-pixbuf, wrapGAppsHook
4+, gtk3, gdk-pixbuf, wrapGAppsHook
55}:
66
77buildDotnetModule rec {
@@ -27,7 +27,10 @@ buildDotnetModule rec {
2727 nativeBuildInputs = [
2828 copyDesktopItems
2929 wrapGAppsHook
30− gobject-introspection
30+ ];
31+
32+ buildInputs = [
33+ gtk3
3134 gdk-pixbuf
3235 ];
3336
@@ -78,6 +81,7 @@ buildDotnetModule rec {
7881 changelog = "https://github.com/Ryujinx/Ryujinx/wiki/Changelog";
7982 maintainers = [ maintainers.ivar ];
8083 platforms = [ "x86_64-linux" ];
84+ mainProgram = "Ryujinx";
8185 };
8286 passthru.updateScript = ./updater.sh;
8387}
pkgs/tools/X11/opentabletdriver/default.nix+1−1
@@ -68,7 +68,7 @@ buildDotnetModule rec {
6868 "OpenTabletDriver.Tests.PluginRepositoryTest.ExpandRepositoryTarball"
6969 ];
7070
71− postInstall = ''
71+ postFixup = ''
7272 # Give a more "*nix" name to the binaries
7373 mv $out/bin/OpenTabletDriver.Console $out/bin/otd
7474 mv $out/bin/OpenTabletDriver.Daemon $out/bin/otd-daemon
pkgs/tools/games/opentracker/default.nix+2
@@ -41,6 +41,7 @@ buildDotnetModule rec {
4141 buildInputs = [
4242 stdenv.cc.cc.lib
4343 fontconfig
44+ gtk3
4445 ];
4546
4647 runtimeDeps = [
@@ -58,5 +59,6 @@ buildDotnetModule rec {
5859 homepage = "https://github.com/trippsc2/OpenTracker";
5960 license = licenses.mit;
6061 maintainers = [ maintainers.ivar ];
62+ mainProgram = "OpenTracker";
6163 };
6264}