From fcbd42974214dacba9b283166fe8ead0a04644a2 Mon Sep 17 00:00:00 2001 From: IvarWithoutBones Date: Wed, 12 Jan 2022 00:03:02 +0100 Subject: [PATCH 1/8] buildDotnetModule: wrap executables in preFixup Not doing this used to break wrapGAppsHook as gappsWrapperArgs is set in preFixup, but it was used in installPhase --- doc/languages-frameworks/dotnet.section.md | 2 +- .../build-dotnet-module/default.nix | 34 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/doc/languages-frameworks/dotnet.section.md b/doc/languages-frameworks/dotnet.section.md index 88e1a0b29596..f7af28a16775 100644 --- a/doc/languages-frameworks/dotnet.section.md +++ b/doc/languages-frameworks/dotnet.section.md @@ -84,7 +84,7 @@ To package Dotnet applications, you can use `buildDotnetModule`. This has simila ``` -* `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 `[]`. +* `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. * `runtimeDeps` is used to wrap libraries into `LD_LIBRARY_PATH`. This is how dotnet usually handles runtime dependencies. * `buildType` is used to change the type of build. Possible values are `Release`, `Debug`, etc. By default, this is set to `Release`. * `dotnet-sdk` is useful in cases where you need to change what dotnet SDK is being used. diff --git a/pkgs/build-support/build-dotnet-module/default.nix b/pkgs/build-support/build-dotnet-module/default.nix index 0a5b17a4a363..49a61f4e5d6d 100644 --- a/pkgs/build-support/build-dotnet-module/default.nix +++ b/pkgs/build-support/build-dotnet-module/default.nix @@ -224,7 +224,7 @@ let "''${dotnetInstallFlags[@]}" \ "''${dotnetFlags[@]}" done - '' + (lib.optionalString packNupkg '' + '' + lib.optionalString packNupkg '' for project in ''${projectFile[@]}; do dotnet pack "$project" \ -p:ContinuousIntegrationBuild=true \ @@ -235,16 +235,24 @@ let "''${dotnetPackFlags[@]}" \ "''${dotnetFlags[@]}" done - '') + (if executables != null then '' - for executable in $executables; do + '' + '' + runHook postInstall + ''; + + preFixup = '' + _wrapDotnetProgram() { + makeWrapper "$1" "$out/bin/$(basename "$executable")" \ + --set DOTNET_ROOT "${dotnet-runtime}" \ + --suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}" \ + "''${gappsWrapperArgs[@]}" \ + "''${makeWrapperArgs[@]}" + } + '' + (if executables != null then '' + for executable in ''${executables[@]}; do execPath="$out/lib/${args.pname}/$executable" if [[ -f "$execPath" && -x "$execPath" ]]; then - makeWrapper "$execPath" "$out/bin/$(basename "$executable")" \ - --set DOTNET_ROOT "${dotnet-runtime}" \ - --suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}" \ - "''${gappsWrapperArgs[@]}" \ - "''${makeWrapperArgs[@]}" + _wrapDotnetProgram $execPath else echo "Specified binary \"$executable\" is either not an executable, or does not exist!" exit 1 @@ -253,16 +261,10 @@ let '' else '' for executable in $out/lib/${args.pname}/*; do if [[ -f "$executable" && -x "$executable" && "$executable" != *"dll"* ]]; then - makeWrapper "$executable" "$out/bin/$(basename "$executable")" \ - --set DOTNET_ROOT "${dotnet-runtime}" \ - --suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}" \ - "''${gappsWrapperArgs[@]}" \ - "''${makeWrapperArgs[@]}" + _wrapDotnetProgram $executable fi done - '') + '' - runHook postInstall - ''; + ''); }); in package From 88064e44a6950455a11b6c5bab0dadbf681c67c0 Mon Sep 17 00:00:00 2001 From: IvarWithoutBones Date: Wed, 12 Jan 2022 00:04:18 +0100 Subject: [PATCH 2/8] pinta: dont manually set gappsWrapperArgs As of aa36cb9d1ec58764af9a5df6674a19c4170d8e9d, this is not required anymore. --- pkgs/applications/graphics/pinta/default.nix | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/pkgs/applications/graphics/pinta/default.nix b/pkgs/applications/graphics/pinta/default.nix index ff112d7ce67c..cc50b3557c6a 100644 --- a/pkgs/applications/graphics/pinta/default.nix +++ b/pkgs/applications/graphics/pinta/default.nix @@ -19,6 +19,7 @@ buildDotnetModule rec { ]; runtimeDeps = [ gtk3 ]; + buildInputs = runtimeDeps; dotnet-sdk = dotnetCorePackages.sdk_6_0; dotnet-runtime = dotnetCorePackages.runtime_6_0; @@ -39,16 +40,7 @@ buildDotnetModule rec { sha256 = "sha256-iOKJPB2bI/GjeDxzG7r6ew7SGIzgrJTcRXhEYzOpC9k="; }; - # FIXME: this should be propagated by wrapGAppsHook already, however for some - # reason it is not working. Maybe a bug in buildDotnetModule? - preInstall = '' - gappsWrapperArgs+=( - --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}" - --set GDK_PIXBUF_MODULE_FILE ${librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache - ) - ''; - - postInstall = '' + postFixup = '' # Rename the binary mv $out/bin/Pinta $out/bin/pinta @@ -76,12 +68,12 @@ buildDotnetModule rec { --replace _Keywords Keywords ''; - meta = { + meta = with lib; { homepage = "https://www.pinta-project.com/"; description = "Drawing/editing program modeled after Paint.NET"; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [ thiagokokada ]; - platforms = with lib.platforms; linux; + license = licenses.mit; + maintainers = with maintainers; [ thiagokokada ]; + platforms = with platforms; linux; mainProgram = "pinta"; }; } From cb8ed184e2552f27b9c55dd977cd1a8299022ce5 Mon Sep 17 00:00:00 2001 From: IvarWithoutBones Date: Wed, 12 Jan 2022 00:07:08 +0100 Subject: [PATCH 3/8] ryujinx: add gtk3 to buildInputs --- pkgs/misc/emulators/ryujinx/default.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/misc/emulators/ryujinx/default.nix b/pkgs/misc/emulators/ryujinx/default.nix index 86716ed5d535..49a1c190b54a 100644 --- a/pkgs/misc/emulators/ryujinx/default.nix +++ b/pkgs/misc/emulators/ryujinx/default.nix @@ -1,7 +1,7 @@ { lib, buildDotnetModule, fetchFromGitHub, makeDesktopItem, copyDesktopItems , libX11, libgdiplus, ffmpeg , SDL2_mixer, openal, libsoundio, sndio, pulseaudio -, gtk3, gobject-introspection, gdk-pixbuf, wrapGAppsHook +, gtk3, gdk-pixbuf, wrapGAppsHook }: buildDotnetModule rec { @@ -27,7 +27,10 @@ buildDotnetModule rec { nativeBuildInputs = [ copyDesktopItems wrapGAppsHook - gobject-introspection + ]; + + buildInputs = [ + gtk3 gdk-pixbuf ]; @@ -78,6 +81,7 @@ buildDotnetModule rec { changelog = "https://github.com/Ryujinx/Ryujinx/wiki/Changelog"; maintainers = [ maintainers.ivar ]; platforms = [ "x86_64-linux" ]; + mainProgram = "Ryujinx"; }; passthru.updateScript = ./updater.sh; } From f3537d9db11f4cf7ad7948c6972f52cb7e33a852 Mon Sep 17 00:00:00 2001 From: IvarWithoutBones Date: Wed, 12 Jan 2022 00:08:11 +0100 Subject: [PATCH 4/8] alttpr-opentracker: add gtk3 to buildInputs --- pkgs/tools/games/opentracker/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/tools/games/opentracker/default.nix b/pkgs/tools/games/opentracker/default.nix index a66d6f4aef53..e68f9a958b4c 100644 --- a/pkgs/tools/games/opentracker/default.nix +++ b/pkgs/tools/games/opentracker/default.nix @@ -41,6 +41,7 @@ buildDotnetModule rec { buildInputs = [ stdenv.cc.cc.lib fontconfig + gtk3 ]; runtimeDeps = [ @@ -58,5 +59,6 @@ buildDotnetModule rec { homepage = "https://github.com/trippsc2/OpenTracker"; license = licenses.mit; maintainers = [ maintainers.ivar ]; + mainProgram = "OpenTracker"; }; } From ec52dd4971bd8ca583703e8ce60f4a0f2dcdd646 Mon Sep 17 00:00:00 2001 From: IvarWithoutBones Date: Wed, 12 Jan 2022 00:20:19 +0100 Subject: [PATCH 5/8] opentabletdriver: use postFixup instead of postInstall --- pkgs/tools/X11/opentabletdriver/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/X11/opentabletdriver/default.nix b/pkgs/tools/X11/opentabletdriver/default.nix index 3d7183c786bd..a1099a4f2652 100644 --- a/pkgs/tools/X11/opentabletdriver/default.nix +++ b/pkgs/tools/X11/opentabletdriver/default.nix @@ -68,7 +68,7 @@ buildDotnetModule rec { "OpenTabletDriver.Tests.PluginRepositoryTest.ExpandRepositoryTarball" ]; - postInstall = '' + postFixup = '' # Give a more "*nix" name to the binaries mv $out/bin/OpenTabletDriver.Console $out/bin/otd mv $out/bin/OpenTabletDriver.Daemon $out/bin/otd-daemon From 05ea38abd04942f98c68fe54aace4e2a8e84c9cc Mon Sep 17 00:00:00 2001 From: IvarWithoutBones Date: Wed, 12 Jan 2022 00:21:04 +0100 Subject: [PATCH 6/8] btcpayserver: use postFixup instead of postInstall --- pkgs/applications/blockchains/btcpayserver/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/blockchains/btcpayserver/default.nix b/pkgs/applications/blockchains/btcpayserver/default.nix index 691979c4de5d..6cc83ffbf607 100644 --- a/pkgs/applications/blockchains/btcpayserver/default.nix +++ b/pkgs/applications/blockchains/btcpayserver/default.nix @@ -26,7 +26,7 @@ buildDotnetModule rec { makeWrapperArgs+=(--run "cd $out/lib/btcpayserver") ''; - postInstall = '' + postFixup = '' mv $out/bin/{BTCPayServer,btcpayserver} ''; From 00ea8f615ed1de9ec9751076fa3c47244749ce72 Mon Sep 17 00:00:00 2001 From: IvarWithoutBones Date: Wed, 12 Jan 2022 00:25:30 +0100 Subject: [PATCH 7/8] nbxplorer: use postFixup instead of preInstall --- pkgs/applications/blockchains/nbxplorer/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/blockchains/nbxplorer/default.nix b/pkgs/applications/blockchains/nbxplorer/default.nix index c4add5b67f55..be3d610d8f78 100644 --- a/pkgs/applications/blockchains/nbxplorer/default.nix +++ b/pkgs/applications/blockchains/nbxplorer/default.nix @@ -17,7 +17,7 @@ buildDotnetModule rec { dotnet-sdk = dotnetCorePackages.sdk_3_1; dotnet-runtime = dotnetCorePackages.aspnetcore_3_1; - postInstall = '' + postFixup = '' mv $out/bin/{NBXplorer,nbxplorer} ''; From 63477f9a27e1ac9d73452ee85ca917f3d436b43f Mon Sep 17 00:00:00 2001 From: IvarWithoutBones Date: Wed, 12 Jan 2022 00:26:53 +0100 Subject: [PATCH 8/8] wasabibackend: use postFixup instead of postInstall --- pkgs/applications/blockchains/wasabibackend/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/blockchains/wasabibackend/default.nix b/pkgs/applications/blockchains/wasabibackend/default.nix index 1239ceaafd84..c7f594e31b49 100644 --- a/pkgs/applications/blockchains/wasabibackend/default.nix +++ b/pkgs/applications/blockchains/wasabibackend/default.nix @@ -36,7 +36,7 @@ buildDotnetModule rec { ) ''; - postInstall = '' + postFixup = '' mv $out/bin/WalletWasabi.Backend $out/bin/WasabiBackend '';