summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.nix1
-rw-r--r--pkgs/theseus.nix128
2 files changed, 129 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
index 5e1d9a1..a44db25 100644
--- a/flake.nix
+++ b/flake.nix
@@ -28,6 +28,7 @@
packageSet = pkgs:
with pkgs; {
huion = callPackage ./pkgs/huion.nix {};
+ theseus = callPackage ./pkgs/theseus.nix {};
treefetch = callPackage ./pkgs/treefetch.nix {};
swhkd = callPackage ./pkgs/swhkd {};
vim-just = callPackage ./pkgs/vim-just.nix {};
diff --git a/pkgs/theseus.nix b/pkgs/theseus.nix
new file mode 100644
index 0000000..3b1585b
--- /dev/null
+++ b/pkgs/theseus.nix
@@ -0,0 +1,128 @@
+{
+ lib,
+ dbus,
+ freetype,
+ fetchFromGitHub,
+ fetchYarnDeps,
+ flite,
+ glfw,
+ glib-networking,
+ gtk3,
+ jdk8,
+ jdk17,
+ jdks ? [jdk8 jdk17],
+ libappindicator-gtk3,
+ libGL,
+ libpulseaudio,
+ librsvg,
+ libsoup,
+ mkYarnPackage,
+ openal,
+ openssl,
+ pkg-config,
+ rustPlatform,
+ stdenv,
+ webkitgtk,
+ wrapGAppsHook,
+ xorg,
+ ...
+}: let
+ inherit (lib) licenses maintainers makeBinPath makeLibraryPath platforms;
+ pname = "theseus";
+
+ rev = "9ea548cfe332c56179c9ef4fad58ac7274bcbd13";
+ src = fetchFromGitHub {
+ owner = "modrinth";
+ repo = "theseus";
+ inherit rev;
+ sha256 = "sha256-OBczvGVCvrkZjZS1HIYQ41gxqznSC0dOb1nYK0RU8JQ=";
+ };
+
+ theseus-frontend = let
+ source = src + "/theseus_gui";
+ in
+ mkYarnPackage {
+ pname = "${pname}-frontend";
+
+ src = source;
+
+ offlineCache = fetchYarnDeps {
+ yarnLock = source + "/yarn.lock";
+ sha256 = "sha256-UFPILd1f4kp0VTPlBccp36kTpsHUrcsxkfHMCtaDX3Y=";
+ };
+
+ packageJson = source + "/package.json";
+
+ buildPhase = ''
+ export HOME=$(mktemp -d)
+ yarn --offline run build
+ cp -r deps/theseus_gui/dist $out
+ '';
+
+ distPhase = "true";
+ dontInstall = true;
+ };
+in
+ rustPlatform.buildRustPackage {
+ inherit pname src;
+ version = builtins.substring 0 7 rev;
+
+ postPatch = ''
+ substituteInPlace theseus_gui/src-tauri/tauri.conf.json \
+ --replace '"distDir": "../dist",' '"distDir": "${theseus-frontend}",'
+ '';
+
+ cargoSha256 = "sha256-xleTO3AEW3yfkfJY2XjJt8g1WotdaB3tW6u/naxDszE=";
+
+ buildInputs = [
+ dbus
+ freetype
+ gtk3
+ libappindicator-gtk3
+ librsvg
+ libsoup
+ openssl
+ webkitgtk
+ wrapGAppsHook
+ ];
+
+ nativeBuildInputs = [pkg-config];
+
+ preFixup = let
+ libPath = makeLibraryPath ([
+ flite
+ glfw
+ libGL
+ libpulseaudio
+ openal
+ stdenv.cc.cc.lib
+ ]
+ ++ (with xorg; [
+ libX11
+ libXcursor
+ libXext
+ libXxf86vm
+ libXrandr
+ ]));
+ binPath = makeBinPath ([xorg.xrandr] ++ jdks);
+ in ''
+ gappsWrapperArgs+=(
+ --set LD_LIBRARY_PATH /run/opengl-driver/lib:${libPath}
+ --prefix GIO_MODULE_DIR : ${glib-networking}/lib/gio/modules/
+ --prefix PATH : ${binPath}
+ )
+
+ runHook postInstall
+ '';
+
+ meta = {
+ description = "Modrinth's future game launcher";
+ longDescription = ''
+ Modrinth's future game launcher which can be used as a CLI, GUI, and a library for creating and playing Modrinth projects.
+ '';
+ homepage = "https://modrinth.com";
+ license = licenses.gpl3Plus;
+ maintainers = [maintainers.getchoo];
+ platforms = with platforms; linux ++ darwin;
+ };
+ }