theseus app (preliminary)
This commit is contained in:
parent
3c245ad72a
commit
55fe322c09
3 changed files with 6401 additions and 0 deletions
6239
modules/Cargo.lock
generated
Normal file
6239
modules/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
161
modules/theseus-modrinth.nix
Normal file
161
modules/theseus-modrinth.nix
Normal file
|
@ -0,0 +1,161 @@
|
|||
{ lib
|
||||
, rustPlatform
|
||||
, stdenvNoCC
|
||||
, fetchFromGitHub
|
||||
, fetchYarnDeps
|
||||
, wrapGAppsHook
|
||||
, esbuild
|
||||
, glib-networking
|
||||
, nodejs
|
||||
, openssl
|
||||
, pkg-config
|
||||
, pnpm-lock-export
|
||||
, prefetch-yarn-deps
|
||||
, webkitgtk
|
||||
, yarn
|
||||
, makeDesktopItem
|
||||
}:
|
||||
|
||||
let
|
||||
pname = "theseus";
|
||||
version = "0.6.3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "modrinth";
|
||||
repo = "theseus";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-ted5EBlF1IRpWo//wOxgPHrGKLphqAPQ0R3q14DpUS4=";
|
||||
|
||||
nativeBuildInputs = [ pnpm-lock-export ];
|
||||
postFetch = ''
|
||||
(cd $out/theseus_gui && pnpm-lock-export --schema yarn.lock@v1)
|
||||
'';
|
||||
};
|
||||
|
||||
frontend = stdenvNoCC.mkDerivation {
|
||||
pname = "theseus-ui";
|
||||
|
||||
inherit version src;
|
||||
|
||||
sourceRoot = "${src.name}/theseus_gui";
|
||||
|
||||
offlineCache = fetchYarnDeps {
|
||||
yarnLock = "${src}/theseus_gui/yarn.lock";
|
||||
hash = "sha256-2ywL7K2rEl3tR4KLhxDPzG7ixGWDFjg2S5RTBT+SOWQ=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
nodejs
|
||||
yarn
|
||||
prefetch-yarn-deps
|
||||
];
|
||||
|
||||
env.ESBUILD_BINARY_PATH = lib.getExe (esbuild.overrideAttrs (final: _: {
|
||||
version = "0.17.19";
|
||||
src = fetchFromGitHub {
|
||||
owner = "evanw";
|
||||
repo = "esbuild";
|
||||
rev = "v${final.version}";
|
||||
hash = "sha256-PLC7OJLSOiDq4OjvrdfCawZPfbfuZix4Waopzrj8qsU=";
|
||||
};
|
||||
goModules = esbuild.goModules.overrideAttrs ({
|
||||
inherit (final) src;
|
||||
outputHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
|
||||
});
|
||||
}));
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace yarn.lock --replace \
|
||||
'tauri-plugin-window-state-api@0.0.0' \
|
||||
'tauri-plugin-window-state-api@github:tauri-apps/tauri-plugin-window-state#v1'
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
export HOME=$(mktemp -d)
|
||||
yarn config --offline set yarn-offline-mirror $offlineCache
|
||||
fixup-yarn-lock yarn.lock
|
||||
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
|
||||
patchShebangs node_modules/
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
yarn --offline build
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cp -r dist $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
name = pname;
|
||||
desktopName = "Modrinth Theseus Launcher";
|
||||
exec = "theseus_gui";
|
||||
icon = pname;
|
||||
comment = description;
|
||||
categories = [ "Game" ];
|
||||
startupNotify = false;
|
||||
};
|
||||
|
||||
description = "Modrinth game launcher";
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
inherit pname version src frontend description;
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
outputHashes = {
|
||||
"tauri-plugin-single-instance-0.0.0" = "sha256-G4h2OXKPpZMmradutdUWxGG5axL9XMz2ACAe8AQ40eg=";
|
||||
};
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
wrapGAppsHook
|
||||
pkg-config
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
install -Dm0644 {${desktopItem},$out}/share/applications/${pname}.desktop
|
||||
|
||||
pushd ${src}/theseus_gui/src-tauri/icons
|
||||
for file in *.png; do
|
||||
install -Dm0644 $file $out/share/icons/hicolor/''${file//.png}/apps/${pname}.png
|
||||
done
|
||||
popd
|
||||
wrapProgram $out/bin/theseus_gui --set WEBKIT_DISABLE_COMPOSITING_MODE 1 # X11 is weird, this is required for some reason....
|
||||
'';
|
||||
|
||||
buildInputs = [
|
||||
openssl
|
||||
webkitgtk
|
||||
glib-networking
|
||||
];
|
||||
|
||||
preConfigure = ''
|
||||
ln -s $frontend theseus_gui/dist
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
inherit description;
|
||||
longDescription = ''
|
||||
A game launcher which can be used as a CLI, GUI, and a library for creating and playing modrinth projects.
|
||||
'';
|
||||
homepage = "https://github.com/modrinth/theseus";
|
||||
changelog = "https://github.com/modrinth/theseus/releases/tag/v${version}";
|
||||
license = licenses.gpl3;
|
||||
maintainers = [ maintainers.grimmauld ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
|
@ -27,6 +27,7 @@
|
|||
gomuks
|
||||
fbcat
|
||||
wootility
|
||||
(callPackage ./theseus-modrinth.nix {})
|
||||
# osu-lazer-bin
|
||||
(pkgs.symlinkJoin {
|
||||
name = "osu";
|
||||
|
|
Loading…
Reference in a new issue