diff --git a/pkgs/by-name/be/beatsabermodmanager/package.nix b/pkgs/by-name/be/beatsabermodmanager/package.nix index 42e1f738e470f..b4819be5cca28 100644 --- a/pkgs/by-name/be/beatsabermodmanager/package.nix +++ b/pkgs/by-name/be/beatsabermodmanager/package.nix @@ -2,6 +2,9 @@ lib, buildDotnetModule, fetchFromGitHub, + copyDesktopItems, + makeDesktopItem, + iconConvTools, dotnetCorePackages, @@ -27,6 +30,11 @@ buildDotnetModule rec { dotnet-runtime = dotnetCorePackages.runtime_7_0; + nativeBuildInputs = [ + copyDesktopItems + iconConvTools + ]; + projectFile = [ "BeatSaberModManager/BeatSaberModManager.csproj" ]; executables = [ "BeatSaberModManager" ]; @@ -44,6 +52,54 @@ buildDotnetModule rec { ''--suffix PATH : "${lib.makeBinPath [ xdg-utils ]}"'' ]; + fixupPhase = '' + runHook preFixup + + icoFileToHiColorTheme $out/lib/beatsabermodmanager/Resources/Icons/Icon.ico beatsabermodmanager $out + + runHook postFixup + ''; + + desktopItems = + [ + (makeDesktopItem { + name = "BeatSaberModManager"; + desktopName = "BeatSaberModManager"; + exec = "BeatSaberModManager"; + icon = "beatsabermodmanager"; + comment = meta.description; + type = "Application"; + categories = [ + "Game" + "Utility" + ]; + }) + ] + ++ (map + ( + protocol: + makeDesktopItem { + # We have to use a different name than the ones generated by the program + # at runtime, otherwise the generated desktop files will shadow these and + # OneClick installs will break. + name = "BeatSaberModManager-url-${protocol}-static"; + desktopName = "BeatSaberModManager"; + comment = "URL:${protocol} Protocol"; + type = "Application"; + categories = [ "Utility" ]; + exec = "BeatSaberModManager --install %u"; + terminal = false; + noDisplay = true; + mimeTypes = [ "x-scheme-handler/${protocol}" ]; + } + ) + [ + "beatsaver" + "modelsaber" + "bsplaylist" + ] + ); + meta = with lib; { description = "Yet another mod installer for Beat Saber, heavily inspired by ModAssistant"; mainProgram = "BeatSaberModManager";