diff options
| author | seth <[email protected]> | 2023-08-08 17:44:25 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-08-09 07:50:01 -0400 |
| commit | 357b926304cfc6ef0906e4e3687dd91673ce9519 (patch) | |
| tree | 0c396662b6896d962ccde5be0bacd18b893f0f0d | |
| parent | ab4a5cb0c6c713d5e3a98f3e21eb8a2bb759653d (diff) | |
pkgs/theseus: split wrapper & add desktop icon
| -rw-r--r-- | pkgs/default.nix | 3 | ||||
| -rw-r--r-- | pkgs/theseus/default.nix (renamed from pkgs/theseus.nix) | 52 | ||||
| -rw-r--r-- | pkgs/theseus/wrapper.nix | 73 |
3 files changed, 91 insertions, 37 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix index 84e34bb..cb49abb 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -8,10 +8,11 @@ in { huion = callPackage ./huion.nix {}; mommy = callPackage ./mommy.nix {}; nixgc = callPackage ./nixgc.nix {}; - theseus = callPackage ./theseus.nix { + theseus-unwrapped = callPackage ./theseus { inherit (pkgs.nodePackages) pnpm; inherit (pkgs.darwin.apple_sdk.frameworks) CoreServices Security WebKit; }; + theseus = callPackage ./theseus/wrapper.nix {}; treefetch = callPackage ./treefetch.nix {}; swhkd = callPackage ./swhkd {}; vim-just = callPackage ./vim-just.nix {}; diff --git a/pkgs/theseus.nix b/pkgs/theseus/default.nix index f610bb9..bda94ec 100644 --- a/pkgs/theseus.nix +++ b/pkgs/theseus/default.nix @@ -5,33 +5,24 @@ fetchFromGitHub, rustPlatform, buildGoModule, - pnpm, - esbuild, + makeDesktopItem, CoreServices, Security, WebKit, + pnpm, + esbuild, dbus, freetype, - flite, - glfw, - glib-networking, gtk3, - jdk8, - jdk17, - jdks ? [jdk8 jdk17], jq, libappindicator-gtk3, - libGL, - libpulseaudio, librsvg, libsoup, moreutils, - openal, openssl, pkg-config, webkitgtk, wrapGAppsHook, - xorg, }: rustPlatform.buildRustPackage rec { pname = "theseus"; @@ -90,7 +81,6 @@ rustPlatform.buildRustPackage rec { libappindicator-gtk3 librsvg libsoup - openssl webkitgtk ] ++ lib.optionals stdenv.isDarwin [CoreServices Security WebKit]; @@ -131,29 +121,19 @@ rustPlatform.buildRustPackage rec { popd ''; - preFixup = let - libPath = lib.makeLibraryPath ([ - flite - glfw - libGL - libpulseaudio - openal - stdenv.cc.cc.lib - ] - ++ (with xorg; [ - libX11 - libXcursor - libXext - libXxf86vm - libXrandr - ])); - binPath = lib.makeBinPath (lib.optionals stdenv.isLinux [xorg.xrandr] ++ jdks); - in '' - gappsWrapperArgs+=( - ${lib.optionalString stdenv.isLinux "--set LD_LIBRARY_PATH /run/opengl-driver/lib:${libPath}"} - ${lib.optionalString stdenv.isLinux "--prefix GIO_MODULE_DIR : ${glib-networking}/lib/gio/modules/"} - --prefix PATH : ${binPath} - ) + desktopItem = makeDesktopItem { + name = "com.modrinth.theseus"; + exec = "theseus_gui"; + icon = "com.modrinth.theseus"; + desktopName = "Modrinth App"; + genericName = meta.description; + }; + + postInstall = '' + mkdir -p $out/share/icons/hicolor/256x256/apps + mkdir -p $out/share/applications + cp theseus_gui/src-tauri/icons/Square284x284Logo.png $out/share/icons/hicolor/256x256/apps/com.modrinth.theseus.png + cp ${desktopItem}/share/applications/*.desktop $out/share/applications ''; meta = with lib; { diff --git a/pkgs/theseus/wrapper.nix b/pkgs/theseus/wrapper.nix new file mode 100644 index 0000000..c907451 --- /dev/null +++ b/pkgs/theseus/wrapper.nix @@ -0,0 +1,73 @@ +{ + lib, + stdenv, + symlinkJoin, + theseus-unwrapped, + wrapGAppsHook, + dbus, + flite, + freetype, + glib-networking, + glfw, + gtk3, + jdk8, + jdk17, + jdks ? [jdk8 jdk17], + libappindicator-gtk3, + libGL, + libpulseaudio, + librsvg, + libsoup, + openal, + webkitgtk, + xorg, + ... +}: let + theseusFinal = theseus-unwrapped; +in + symlinkJoin { + name = "theseus-${theseusFinal.version}"; + + paths = [theseusFinal]; + + nativeBuildInputs = [ + wrapGAppsHook + ]; + + buildInputs = lib.optionals stdenv.isLinux [ + dbus + freetype + gtk3 + libappindicator-gtk3 + librsvg + libsoup + webkitgtk + ]; + + preFixup = let + libPath = lib.makeLibraryPath ([ + flite + glfw + libGL + libpulseaudio + openal + stdenv.cc.cc.lib + ] + ++ (with xorg; [ + libX11 + libXcursor + libXext + libXxf86vm + libXrandr + ])); + binPath = lib.makeBinPath (lib.optionals stdenv.isLinux [xorg.xrandr] ++ jdks); + in '' + gappsWrapperArgs+=( + ${lib.optionalString stdenv.isLinux "--set LD_LIBRARY_PATH /run/opengl-driver/lib:${libPath}"} + ${lib.optionalString stdenv.isLinux "--prefix GIO_MODULE_DIR : ${glib-networking}/lib/gio/modules/"} + --prefix PATH : ${binPath} + ) + ''; + + inherit (theseusFinal) meta; + } |
