diff --git a/pkgs/by-name/ne/nexusmods-app/package.nix b/pkgs/by-name/ne/nexusmods-app/package.nix index 6cb9dd5bc1ed..875f17e876bb 100644 --- a/pkgs/by-name/ne/nexusmods-app/package.nix +++ b/pkgs/by-name/ne/nexusmods-app/package.nix @@ -1,26 +1,21 @@ -{ _7zz -, buildDotnetModule -, copyDesktopItems -, desktop-file-utils -, dotnetCorePackages -, fetchFromGitHub -, fontconfig -, lib -, libICE -, libSM -, libX11 -, nexusmods-app -, runCommand -, enableUnfree ? false # Set to true to support RAR format mods +{ + _7zz, + buildDotnetModule, + copyDesktopItems, + desktop-file-utils, + dotnetCorePackages, + fetchFromGitHub, + fontconfig, + lib, + libICE, + libSM, + libX11, + nexusmods-app, + runCommand, + pname ? "nexusmods-app", }: -let - _7zzWithOptionalUnfreeRarSupport = _7zz.override { - inherit enableUnfree; - }; -in buildDotnetModule rec { - pname = "nexusmods-app"; - + inherit pname; version = "0.4.1"; src = fetchFromGitHub { @@ -39,9 +34,7 @@ buildDotnetModule rec { projectFile = "src/NexusMods.App/NexusMods.App.csproj"; testProjectFile = "NexusMods.App.sln"; - nativeBuildInputs = [ - copyDesktopItems - ]; + nativeBuildInputs = [ copyDesktopItems ]; nugetDeps = ./deps.nix; @@ -54,15 +47,15 @@ buildDotnetModule rec { ''; postPatch = '' - ln --force --symbolic "${lib.getExe _7zzWithOptionalUnfreeRarSupport}" src/ArchiveManagement/NexusMods.FileExtractor/runtimes/linux-x64/native/7zz + ln --force --symbolic "${lib.getExe _7zz}" src/ArchiveManagement/NexusMods.FileExtractor/runtimes/linux-x64/native/7zz # for some reason these tests fail (intermittently?) with a zero timestamp touch tests/NexusMods.UI.Tests/WorkspaceSystem/*.verified.png ''; makeWrapperArgs = [ - "--prefix PATH : ${lib.makeBinPath [desktop-file-utils]}" - "--set APPIMAGE $out/bin/${meta.mainProgram}" # Make associating with nxm links work on Linux + "--prefix PATH : ${lib.makeBinPath [ desktop-file-utils ]}" + "--set APPIMAGE ${placeholder "out"}/bin/${meta.mainProgram}" # Make associating with nxm links work on Linux ]; runtimeDeps = [ @@ -72,52 +65,62 @@ buildDotnetModule rec { libX11 ]; - executables = [ - nexusmods-app.meta.mainProgram - ]; + executables = [ meta.mainProgram ]; doCheck = true; dotnetTestFlags = [ "--environment=USER=nobody" - (lib.strings.concatStrings [ + ( "--filter=" - (lib.strings.concatStrings (lib.strings.intersperse "&" ([ - "Category!=Disabled" - "FlakeyTest!=True" - "RequiresNetworking!=True" - "FullyQualifiedName!=NexusMods.UI.Tests.ImageCacheTests.Test_LoadAndCache_RemoteImage" - "FullyQualifiedName!=NexusMods.UI.Tests.ImageCacheTests.Test_LoadAndCache_ImageStoredFile" - ] ++ lib.optionals (! enableUnfree) [ - "FullyQualifiedName!=NexusMods.Games.FOMOD.Tests.FomodXmlInstallerTests.InstallsFilesSimple_UsingRar" - ]))) - ]) + + lib.strings.concatStringsSep "&" ( + [ + "Category!=Disabled" + "FlakeyTest!=True" + "RequiresNetworking!=True" + "FullyQualifiedName!=NexusMods.UI.Tests.ImageCacheTests.Test_LoadAndCache_RemoteImage" + "FullyQualifiedName!=NexusMods.UI.Tests.ImageCacheTests.Test_LoadAndCache_ImageStoredFile" + ] + ++ lib.optionals (!_7zz.meta.unfree) [ + "FullyQualifiedName!=NexusMods.Games.FOMOD.Tests.FomodXmlInstallerTests.InstallsFilesSimple_UsingRar" + ] + ) + ) ]; passthru = { - tests = { - serve = runCommand "${pname}-test-serve" { } '' - ${nexusmods-app}/bin/${nexusmods-app.meta.mainProgram} - touch $out - ''; - help = runCommand "${pname}-test-help" { } '' - ${nexusmods-app}/bin/${nexusmods-app.meta.mainProgram} --help - touch $out - ''; - associate-nxm = runCommand "${pname}-test-associate-nxm" { } '' - ${nexusmods-app}/bin/${nexusmods-app.meta.mainProgram} associate-nxm - touch $out - ''; - list-tools = runCommand "${pname}-test-list-tools" { } '' - ${nexusmods-app}/bin/${nexusmods-app.meta.mainProgram} list-tools - touch $out - ''; - }; + tests = + let + runTest = + name: script: + runCommand "${pname}-test-${name}" + { + # TODO: use finalAttrs when buildDotnetModule has support + nativeBuildInputs = [ nexusmods-app ]; + } + '' + ${script} + touch $out + ''; + in + { + serve = runTest "serve" '' + NexusMods.App + ''; + help = runTest "help" '' + NexusMods.App --help + ''; + associate-nxm = runTest "associate-nxm" '' + NexusMods.App associate-nxm + ''; + list-tools = runTest "list-tools" '' + NexusMods.App list-tools + ''; + }; updateScript = ./update.bash; }; meta = { - description = "Game mod installer, creator and manager"; mainProgram = "NexusMods.App"; homepage = "https://github.com/Nexus-Mods/NexusMods.App"; changelog = "https://github.com/Nexus-Mods/NexusMods.App/releases/tag/${src.rev}"; @@ -127,5 +130,32 @@ buildDotnetModule rec { MattSturgeon ]; platforms = lib.platforms.linux; + description = "Game mod installer, creator and manager"; + longDescription = '' + A mod installer, creator and manager for all your popular games. + + Currently experimental and undergoing active development, + new releases may include breaking changes! + + ${ + if _7zz.meta.unfree then + '' + This "unfree" variant includes support for mods packaged as RAR archives. + '' + else + '' + It is strongly recommended that you use the "unfree" variant of this package, + which provides support for mods packaged as RAR archives. + + You can also enable unrar support manually, by overriding the `_7zz` used: + + ```nix + pkgs.nexusmods-app.override { + _7zz = pkgs._7zz-rar; + } + ``` + '' + } + ''; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cd7d2f8d15f8..812456c75c40 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18616,8 +18616,9 @@ with pkgs; nix-build-uncached = callPackage ../development/tools/misc/nix-build-uncached { }; - nexusmods-app-unfree = callPackage ../by-name/ne/nexusmods-app/package.nix { - enableUnfree = true; + nexusmods-app-unfree = nexusmods-app.override { + pname = "nexusmods-app-unfree"; + _7zz = _7zz-rar; }; nmrpflash = callPackage ../development/embedded/nmrpflash { };