From d0935b266a8ab39fedfd627964a42f1acf60a239 Mon Sep 17 00:00:00 2001 From: Ulysses Zhan Date: Thu, 21 Nov 2024 14:58:15 -0800 Subject: [PATCH 1/7] olympus: update version, src; add updateScript --- pkgs/by-name/ol/olympus/deps.nix | 57 +++++------------------------ pkgs/by-name/ol/olympus/package.nix | 9 +++-- pkgs/by-name/ol/olympus/update.sh | 29 +++++++++++++++ 3 files changed, 44 insertions(+), 51 deletions(-) create mode 100755 pkgs/by-name/ol/olympus/update.sh diff --git a/pkgs/by-name/ol/olympus/deps.nix b/pkgs/by-name/ol/olympus/deps.nix index 82da86b0514d7..2665f25795c14 100644 --- a/pkgs/by-name/ol/olympus/deps.nix +++ b/pkgs/by-name/ol/olympus/deps.nix @@ -1,51 +1,14 @@ # This file was automatically generated by passthru.fetch-deps. # Please dont edit it manually, your changes might get overwritten! -{ fetchNuGet }: -[ - (fetchNuGet { - pname = "Microsoft.NETFramework.ReferenceAssemblies"; - version = "1.0.2"; - sha256 = "0i42rn8xmvhn08799manpym06kpw89qy9080myyy2ngy565pqh0a"; - }) - (fetchNuGet { - pname = "Microsoft.NETFramework.ReferenceAssemblies.net452"; - version = "1.0.2"; - sha256 = "02xpdaynfglblvi2brszspvz0rz3admzh35shnqgik6s1x75n82k"; - }) - (fetchNuGet { - pname = "Mono.Cecil"; - version = "0.11.4"; - sha256 = "1yxa7mh432s7g7p9r7scqxvxjk5ypwc567qdbf0gmk8fbf0d3f8y"; - }) - (fetchNuGet { - pname = "MonoMod"; - version = "22.1.4.3"; - sha256 = "1bxrqflqfj6ck1mk9mq41iv2ayz1idirxi4vlan1b30ljq7xsacj"; - }) - (fetchNuGet { - pname = "MonoMod.RuntimeDetour"; - version = "22.1.4.3"; - sha256 = "0brf5835psbi4i0bhvgacpg5cgq9ln89ffz73a8q24wc47flvccv"; - }) - (fetchNuGet { - pname = "MonoMod.RuntimeDetour.HookGen"; - version = "22.1.4.3"; - sha256 = "0km4g8wlfcsrr9lj6sz06dcsm60x8npdwv1fzzcssjqwfjwsgqqf"; - }) - (fetchNuGet { - pname = "MonoMod.Utils"; - version = "22.1.4.3"; - sha256 = "1m9wcmg2x85f2bji1gzgynn71x0nc9z8g04zryz6w2w26fismb6h"; - }) - (fetchNuGet { - pname = "Newtonsoft.Json"; - version = "13.0.1"; - sha256 = "0fijg0w6iwap8gvzyjnndds0q4b8anwxxvik7y8vgq97dram4srb"; - }) - (fetchNuGet { - pname = "YamlDotNet"; - version = "9.1.0"; - sha256 = "0fcnw8plp1fl8nx5ykfbwq3qlsjpjzk65hfafj9dzj0vp4w0zcsr"; - }) +{ fetchNuGet }: [ + (fetchNuGet { pname = "Microsoft.NETFramework.ReferenceAssemblies"; version = "1.0.3"; hash = "sha256-FBoJP5DHZF0QHM0xLm9yd4HJZVQOuSpSKA+VQRpphEE="; }) + (fetchNuGet { pname = "Microsoft.NETFramework.ReferenceAssemblies.net452"; version = "1.0.3"; hash = "sha256-RTPuFG8D7gnwINEoEtAqmVm4oTW8K4Z87v1o4DDeLMI="; }) + (fetchNuGet { pname = "Mono.Cecil"; version = "0.11.4"; hash = "sha256-HrnRgFsOzfqAWw0fUxi/vkzZd8dMn5zueUeLQWA9qvs="; }) + (fetchNuGet { pname = "MonoMod"; version = "22.1.4.3"; hash = "sha256-kindD5YUjBWsopvEnmOL4XsldgwE1zRrmMxIh6nDua8="; }) + (fetchNuGet { pname = "MonoMod.RuntimeDetour"; version = "22.1.4.3"; hash = "sha256-m7FN3SGME4GRGuc7l5ClCT9W3mXqbbhAJHHpWwYqLi8="; }) + (fetchNuGet { pname = "MonoMod.RuntimeDetour.HookGen"; version = "22.1.4.3"; hash = "sha256-DuOnuXQcS63Z/y5s3q5FHZiqWTPgayNpylkzRzl6pE4="; }) + (fetchNuGet { pname = "MonoMod.Utils"; version = "22.1.4.3"; hash = "sha256-0KyqozOCC26+z5+Ah35iFvRwrPXvvxDlEq6gLl5lPNU="; }) + (fetchNuGet { pname = "Newtonsoft.Json"; version = "13.0.1"; hash = "sha256-K2tSVW4n4beRPzPu3rlVaBEMdGvWSv/3Q1fxaDh4Mjo="; }) + (fetchNuGet { pname = "YamlDotNet"; version = "9.1.0"; hash = "sha256-WbMPOLkbyN+SdMrBYuaXV2qKB+bLTV+6RdSFSy/iljk="; }) ] diff --git a/pkgs/by-name/ol/olympus/package.nix b/pkgs/by-name/ol/olympus/package.nix index 060e8e66860a5..b83a98c848299 100644 --- a/pkgs/by-name/ol/olympus/package.nix +++ b/pkgs/by-name/ol/olympus/package.nix @@ -67,15 +67,14 @@ in buildDotnetModule rec { inherit pname; - # FIXME: I made up this version number. - version = "24.07.06.02"; + version = "24.10.27.01"; src = fetchFromGitHub { owner = "EverestAPI"; repo = "Olympus"; - rev = "5f3e40687eb825c57021f52d83a3bc9a82c04bdb"; + rev = "3ab5d063bb3eef815dbf6bb76e0d225af5f814be"; fetchSubmodules = true; # Required. See upstream's README. - hash = "sha256-rNh6sH51poahiV0Mb61lHfzqOkPF2pW2wr7MOrfVSVs="; + hash = "sha256-7H5rO2PG19xS+FE/4ZkvuObReASWlaMVhAd4Ou9oDrs="; }; executables = [ ]; @@ -155,6 +154,8 @@ buildDotnetModule rec { install -Dm644 LICENSE $out/share/licenses/${pname}/LICENSE ''; + passthru.updateScript = ./update.sh; + meta = { description = "Cross-platform GUI Everest installer and Celeste mod manager"; homepage = "https://github.com/EverestAPI/Olympus"; diff --git a/pkgs/by-name/ol/olympus/update.sh b/pkgs/by-name/ol/olympus/update.sh new file mode 100755 index 0000000000000..e426917581e8a --- /dev/null +++ b/pkgs/by-name/ol/olympus/update.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl jq common-updater-scripts + +set -eu -o pipefail + +api() { + curl -s "https://dev.azure.com/EverestAPI/Olympus/_apis/$1?api-version=7.1" +} + +pipeline_id=$(api pipelines | jq -r ' + .value + | map(select(.name == "EverestAPI.Olympus")) + | .[0].id +') + +run_id=$(api pipelines/$pipeline_id/runs | jq -r ' + .value + | map(select(.result == "succeeded")) + | max_by(.finishedDate) + | .id +') + +run=$(api pipelines/$pipeline_id/runs/$run_id) + +commit=$(echo "$run" | jq -r '.resources.repositories.self.version') +version=$(echo "$run" | jq -r '.name') +update-source-version olympus $version --rev=$commit + +"$(nix-build --attr olympus.fetch-deps --no-out-link)" From b66abc9de32fd0766eee0bb01488c3515f19bdc0 Mon Sep 17 00:00:00 2001 From: Ulysses Zhan Date: Thu, 21 Nov 2024 15:19:01 -0800 Subject: [PATCH 2/7] olympus: avoid rec; use lib.getExe; remove redundant .out; minor changes --- pkgs/by-name/ol/olympus/package.nix | 33 +++++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/pkgs/by-name/ol/olympus/package.nix b/pkgs/by-name/ol/olympus/package.nix index b83a98c848299..98790c1c87223 100644 --- a/pkgs/by-name/ol/olympus/package.nix +++ b/pkgs/by-name/ol/olympus/package.nix @@ -59,15 +59,18 @@ let buildInputs = [ sqlite.dev ]; }; + mono = mono4; + nfd = lua51Packages.nfd; + dotnet-out = "sharp/bin/Release/net452"; - pname = "olympus"; phome = "$out/lib/${pname}"; - nfd = lua51Packages.nfd; -in -buildDotnetModule rec { - inherit pname; + projectFile = "sharp/Olympus.Sharp.sln"; + pname = "olympus"; version = "24.10.27.01"; +in +buildDotnetModule { + inherit pname version projectFile; src = fetchFromGitHub { owner = "EverestAPI"; @@ -86,7 +89,7 @@ buildDotnetModule rec { buildInputs = [ love - mono4 + mono nfd lua-subprocess lsqlite3 @@ -98,8 +101,6 @@ buildDotnetModule rec { nugetDeps = ./deps.nix; - projectFile = "sharp/Olympus.Sharp.sln"; - postConfigure = '' echo '${version}-nixos' > src/version.txt ''; @@ -108,7 +109,7 @@ buildDotnetModule rec { # Copied from `olympus` in AUR. buildPhase = '' runHook preBuild - FrameworkPathOverride=${mono4.out}/lib/mono/4.5 msbuild ${projectFile} /p:Configuration=Release + FrameworkPathOverride=${mono}/lib/mono/4.5 msbuild ${projectFile} /p:Configuration=Release runHook postBuild ''; @@ -118,7 +119,7 @@ buildDotnetModule rec { # # I assume --fused is so saves are properly made (https://love2d.org/wiki/love.filesystem) postBuild = '' - makeWrapper ${mono4.out}/bin/mono ${dotnet-out}/Olympus.Sharp.bin.x86 \ + makeWrapper ${lib.getExe mono} ${dotnet-out}/Olympus.Sharp.bin.x86 \ --add-flags ${phome}/sharp/Olympus.Sharp.exe cp ${dotnet-out}/Olympus.Sharp.bin.x86 ${dotnet-out}/Olympus.Sharp.bin.x86_64 ''; @@ -127,14 +128,14 @@ buildDotnetModule rec { # It is used to launch Loenn from Olympus. installPhase = let - subprocess-cpath = "${lua-subprocess.out}/lib/lua/5.1/?.so"; - nfd-cpath = "${nfd.out}/lib/lua/5.1/?.so"; - lsqlite3-cpath = "${lsqlite3.out}/lib/lua/5.1/?.so"; + subprocess-cpath = "${lua-subprocess}/lib/lua/5.1/?.so"; + nfd-cpath = "${nfd}/lib/lua/5.1/?.so"; + lsqlite3-cpath = "${lsqlite3}/lib/lua/5.1/?.so"; in '' runHook preInstall mkdir -p $out/bin - makeWrapper ${love.out}/bin/love ${phome}/find-love \ + makeWrapper ${lib.getExe love} ${phome}/find-love \ --add-flags "--fused" makeWrapper ${phome}/find-love $out/bin/olympus \ --prefix LUA_CPATH : "${nfd-cpath};${subprocess-cpath};${lsqlite3-cpath}" \ @@ -167,5 +168,9 @@ buildDotnetModule rec { ]; mainProgram = "olympus"; platforms = lib.platforms.unix; + sourceProvenance = with lib.sourceTypes; [ + fromSource + binaryNativeCode # Source contains binary; see https://github.com/EverestAPI/Olympus/tree/main/lib-linux/sharp + ]; }; } From ed27205c1e54d63ec10a52159227706501dafdf7 Mon Sep 17 00:00:00 2001 From: Ulysses Zhan Date: Fri, 22 Nov 2024 14:38:39 -0800 Subject: [PATCH 3/7] olympus: use standard build process for dotnet; remove -nixos suffix in version; use new mono; add dotnet-runtime to fhs env --- pkgs/by-name/ol/olympus/deps.nix | 57 ++++++++++++++++++---- pkgs/by-name/ol/olympus/package.nix | 73 +++++++++++++---------------- 2 files changed, 80 insertions(+), 50 deletions(-) diff --git a/pkgs/by-name/ol/olympus/deps.nix b/pkgs/by-name/ol/olympus/deps.nix index 2665f25795c14..6824f40b6fd26 100644 --- a/pkgs/by-name/ol/olympus/deps.nix +++ b/pkgs/by-name/ol/olympus/deps.nix @@ -1,14 +1,51 @@ # This file was automatically generated by passthru.fetch-deps. # Please dont edit it manually, your changes might get overwritten! -{ fetchNuGet }: [ - (fetchNuGet { pname = "Microsoft.NETFramework.ReferenceAssemblies"; version = "1.0.3"; hash = "sha256-FBoJP5DHZF0QHM0xLm9yd4HJZVQOuSpSKA+VQRpphEE="; }) - (fetchNuGet { pname = "Microsoft.NETFramework.ReferenceAssemblies.net452"; version = "1.0.3"; hash = "sha256-RTPuFG8D7gnwINEoEtAqmVm4oTW8K4Z87v1o4DDeLMI="; }) - (fetchNuGet { pname = "Mono.Cecil"; version = "0.11.4"; hash = "sha256-HrnRgFsOzfqAWw0fUxi/vkzZd8dMn5zueUeLQWA9qvs="; }) - (fetchNuGet { pname = "MonoMod"; version = "22.1.4.3"; hash = "sha256-kindD5YUjBWsopvEnmOL4XsldgwE1zRrmMxIh6nDua8="; }) - (fetchNuGet { pname = "MonoMod.RuntimeDetour"; version = "22.1.4.3"; hash = "sha256-m7FN3SGME4GRGuc7l5ClCT9W3mXqbbhAJHHpWwYqLi8="; }) - (fetchNuGet { pname = "MonoMod.RuntimeDetour.HookGen"; version = "22.1.4.3"; hash = "sha256-DuOnuXQcS63Z/y5s3q5FHZiqWTPgayNpylkzRzl6pE4="; }) - (fetchNuGet { pname = "MonoMod.Utils"; version = "22.1.4.3"; hash = "sha256-0KyqozOCC26+z5+Ah35iFvRwrPXvvxDlEq6gLl5lPNU="; }) - (fetchNuGet { pname = "Newtonsoft.Json"; version = "13.0.1"; hash = "sha256-K2tSVW4n4beRPzPu3rlVaBEMdGvWSv/3Q1fxaDh4Mjo="; }) - (fetchNuGet { pname = "YamlDotNet"; version = "9.1.0"; hash = "sha256-WbMPOLkbyN+SdMrBYuaXV2qKB+bLTV+6RdSFSy/iljk="; }) +{ fetchNuGet }: +[ + (fetchNuGet { + pname = "Microsoft.NETFramework.ReferenceAssemblies"; + version = "1.0.3"; + hash = "sha256-FBoJP5DHZF0QHM0xLm9yd4HJZVQOuSpSKA+VQRpphEE="; + }) + (fetchNuGet { + pname = "Microsoft.NETFramework.ReferenceAssemblies.net452"; + version = "1.0.3"; + hash = "sha256-RTPuFG8D7gnwINEoEtAqmVm4oTW8K4Z87v1o4DDeLMI="; + }) + (fetchNuGet { + pname = "Mono.Cecil"; + version = "0.11.4"; + hash = "sha256-HrnRgFsOzfqAWw0fUxi/vkzZd8dMn5zueUeLQWA9qvs="; + }) + (fetchNuGet { + pname = "MonoMod"; + version = "22.1.4.3"; + hash = "sha256-kindD5YUjBWsopvEnmOL4XsldgwE1zRrmMxIh6nDua8="; + }) + (fetchNuGet { + pname = "MonoMod.RuntimeDetour"; + version = "22.1.4.3"; + hash = "sha256-m7FN3SGME4GRGuc7l5ClCT9W3mXqbbhAJHHpWwYqLi8="; + }) + (fetchNuGet { + pname = "MonoMod.RuntimeDetour.HookGen"; + version = "22.1.4.3"; + hash = "sha256-DuOnuXQcS63Z/y5s3q5FHZiqWTPgayNpylkzRzl6pE4="; + }) + (fetchNuGet { + pname = "MonoMod.Utils"; + version = "22.1.4.3"; + hash = "sha256-0KyqozOCC26+z5+Ah35iFvRwrPXvvxDlEq6gLl5lPNU="; + }) + (fetchNuGet { + pname = "Newtonsoft.Json"; + version = "13.0.1"; + hash = "sha256-K2tSVW4n4beRPzPu3rlVaBEMdGvWSv/3Q1fxaDh4Mjo="; + }) + (fetchNuGet { + pname = "YamlDotNet"; + version = "9.1.0"; + hash = "sha256-WbMPOLkbyN+SdMrBYuaXV2qKB+bLTV+6RdSFSy/iljk="; + }) ] diff --git a/pkgs/by-name/ol/olympus/package.nix b/pkgs/by-name/ol/olympus/package.nix index 98790c1c87223..78f531609761d 100644 --- a/pkgs/by-name/ol/olympus/package.nix +++ b/pkgs/by-name/ol/olympus/package.nix @@ -3,9 +3,9 @@ fetchFromGitHub, fetchzip, buildDotnetModule, - mono4, + mono, love, - lua51Packages, + luajitPackages, msbuild, sqlite, curl, @@ -23,7 +23,8 @@ # I'm pretty sure thats by user so end user needs to do it let - lua-subprocess = lua51Packages.buildLuarocksPackage { + luaPackages = luajitPackages; + lua-subprocess = luaPackages.buildLuarocksPackage { pname = "subprocess"; version = "bfa8e9"; src = fetchFromGitHub { @@ -34,6 +35,16 @@ let }; rockspecFilename = "subprocess-scm-1.rockspec"; }; + lsqlite3 = luaPackages.buildLuarocksPackage { + pname = "lsqlite3"; + version = "0.9.6-1"; + src = fetchzip { + url = "http://lua.sqlite.org/index.cgi/zip/lsqlite3_v096.zip"; + hash = "sha256-Mq409A3X9/OS7IPI/KlULR6ZihqnYKk/mS/W/2yrGBg="; + }; + buildInputs = [ sqlite.dev ]; + }; + nfd = luaPackages.nfd; # NOTE: on installation olympus uses MiniInstallerLinux which is dynamically linked, this makes it run fine fhs-env = buildFHSEnv { @@ -45,32 +56,17 @@ let stdenv.cc.cc libgcc.lib openssl + dotnet-runtime ]); runScript = "bash"; }; - lsqlite3 = lua51Packages.buildLuarocksPackage { - pname = "lsqlite3"; - version = "0.9.6-1"; - src = fetchzip { - url = "http://lua.sqlite.org/index.cgi/zip/lsqlite3_v096.zip"; - hash = "sha256-Mq409A3X9/OS7IPI/KlULR6ZihqnYKk/mS/W/2yrGBg="; - }; - buildInputs = [ sqlite.dev ]; - }; - - mono = mono4; - nfd = lua51Packages.nfd; - - dotnet-out = "sharp/bin/Release/net452"; - phome = "$out/lib/${pname}"; - projectFile = "sharp/Olympus.Sharp.sln"; - pname = "olympus"; version = "24.10.27.01"; + phome = "$out/lib/${pname}"; in buildDotnetModule { - inherit pname version projectFile; + inherit pname version; src = fetchFromGitHub { owner = "EverestAPI"; @@ -80,10 +76,7 @@ buildDotnetModule { hash = "sha256-7H5rO2PG19xS+FE/4ZkvuObReASWlaMVhAd4Ou9oDrs="; }; - executables = [ ]; - nativeBuildInputs = [ - msbuild libarchive # To create the .love file (zip format) ]; @@ -96,36 +89,31 @@ buildDotnetModule { ]; runtimeInputs = [ - xdg-utils + xdg-utils # used by Olympus to check installation completeness ]; nugetDeps = ./deps.nix; + projectFile = "sharp/Olympus.Sharp.csproj"; + executables = [ ]; - postConfigure = '' - echo '${version}-nixos' > src/version.txt - ''; - - # TODO: the override is needed for it to run. Should be found out why - # Copied from `olympus` in AUR. - buildPhase = '' - runHook preBuild - FrameworkPathOverride=${mono}/lib/mono/4.5 msbuild ${projectFile} /p:Configuration=Release - runHook postBuild + preConfigure = '' + echo ${version} > src/version.txt ''; # Hack Olympus.Sharp.bin.{x86,x86_64} to use system mono. # This was proposed by @0x0ade on discord.gg/celeste: # https://discord.com/channels/403698615446536203/514006912115802113/827507533962149900 - # - # I assume --fused is so saves are properly made (https://love2d.org/wiki/love.filesystem) postBuild = '' - makeWrapper ${lib.getExe mono} ${dotnet-out}/Olympus.Sharp.bin.x86 \ + dotnet_out=sharp/bin/Release/net452 + dotnet_out=$dotnet_out/$(ls $dotnet_out) + makeWrapper ${lib.getExe mono} $dotnet_out/Olympus.Sharp.bin.x86 \ --add-flags ${phome}/sharp/Olympus.Sharp.exe - cp ${dotnet-out}/Olympus.Sharp.bin.x86 ${dotnet-out}/Olympus.Sharp.bin.x86_64 + cp $dotnet_out/Olympus.Sharp.bin.x86 $dotnet_out/Olympus.Sharp.bin.x86_64 ''; # The script find-love is hacked to use love from nixpkgs. # It is used to launch Loenn from Olympus. + # I assume --fused is so saves are properly made (https://love2d.org/wiki/love.filesystem) installPhase = let subprocess-cpath = "${lua-subprocess}/lib/lua/5.1/?.so"; @@ -134,6 +122,7 @@ buildDotnetModule { in '' runHook preInstall + mkdir -p $out/bin makeWrapper ${lib.getExe love} ${phome}/find-love \ --add-flags "--fused" @@ -143,7 +132,11 @@ buildDotnetModule { --add-flags "${phome}/olympus.love" mkdir -p ${phome} bsdtar --format zip --strip-components 1 -cf ${phome}/olympus.love src - install -Dm755 ${dotnet-out}/* -t ${phome}/sharp + + dotnet_out=sharp/bin/Release/net452 + dotnet_out=$dotnet_out/$(ls $dotnet_out) + install -Dm755 $dotnet_out/* -t ${phome}/sharp + runHook postInstall ''; From e3146cd9b4562a6a227defeaa878c158df3ffb60 Mon Sep 17 00:00:00 2001 From: Ulysses Zhan Date: Fri, 22 Nov 2024 17:48:47 -0800 Subject: [PATCH 4/7] olympus: 24.10.27.02 -> 24.11.23.01; fix version.txt; remove unnecessary dependencies; add miniinstaller and celeste wrapper; other misc change olympus-with-steam-run: init --- .../ol/olympus-with-steam-run/package.nix | 5 ++ pkgs/by-name/ol/olympus/package.nix | 69 ++++++++----------- pkgs/by-name/ol/olympus/update.sh | 12 ++-- 3 files changed, 43 insertions(+), 43 deletions(-) create mode 100644 pkgs/by-name/ol/olympus-with-steam-run/package.nix diff --git a/pkgs/by-name/ol/olympus-with-steam-run/package.nix b/pkgs/by-name/ol/olympus-with-steam-run/package.nix new file mode 100644 index 0000000000000..3fcc4e7beccca --- /dev/null +++ b/pkgs/by-name/ol/olympus-with-steam-run/package.nix @@ -0,0 +1,5 @@ +{ + callPackage, +}: + +callPackage ../olympus/package.nix { with-steam-run = true; } diff --git a/pkgs/by-name/ol/olympus/package.nix b/pkgs/by-name/ol/olympus/package.nix index 78f531609761d..e400216ee7a4a 100644 --- a/pkgs/by-name/ol/olympus/package.nix +++ b/pkgs/by-name/ol/olympus/package.nix @@ -6,21 +6,16 @@ mono, love, luajitPackages, - msbuild, sqlite, curl, libarchive, buildFHSEnv, - xdg-utils, + steam-run, + # With this option enabled, Olympus will use steam-run to launch Celeste. + # Users should enable this only if olympus and steam are from the same nixpkgs. + # In either case, users can set OLYMPUS_CELESTE_WRAPPER=steam-run manually. + with-steam-run ? false, }: -# WONTFIX: On NixOS, cannot launch Steam installations of Everest / Celeste from Olympus. -# The way it launches Celeste is by directly executing steamapps/common/Celeste/Celeste, -# and it does not work on NixOS (even with steam-run). -# This should be considered a bug of Steam on NixOS (and is probably very hard to fix). -# https://github.com/EverestAPI/Olympus/issues/94 could be a temporary fix - -# FIXME: olympus checks if xdg-mime x-scheme-handler/everest for a popup. If it's not set it complains about it. -# I'm pretty sure thats by user so end user needs to do it let luaPackages = luajitPackages; @@ -46,8 +41,8 @@ let }; nfd = luaPackages.nfd; - # NOTE: on installation olympus uses MiniInstallerLinux which is dynamically linked, this makes it run fine - fhs-env = buildFHSEnv { + # When installing Everest, Olympus uses MiniInstaller, which is dynamically linked. + miniinstaller-fhs = buildFHSEnv { name = "olympus-fhs"; targetPkgs = pkgs: @@ -56,52 +51,45 @@ let stdenv.cc.cc libgcc.lib openssl - dotnet-runtime + dotnet-runtime # Without this, MiniInstaller will install dotnet itself. ]); runScript = "bash"; }; + miniinstaller-fhs-executable = "${miniinstaller-fhs}/bin/${miniinstaller-fhs.name}"; pname = "olympus"; - version = "24.10.27.01"; phome = "$out/lib/${pname}"; + # The following variables are to be updated by the update script. + version = "24.11.23.01"; + buildId = "4418"; # IMPORTANT: This line is matched with regex in update.sh. + rev = "d05f50fae23d741c9b6f72ba8fd951dca1a6e0f0"; in buildDotnetModule { inherit pname version; src = fetchFromGitHub { + inherit rev; owner = "EverestAPI"; repo = "Olympus"; - rev = "3ab5d063bb3eef815dbf6bb76e0d225af5f814be"; fetchSubmodules = true; # Required. See upstream's README. - hash = "sha256-7H5rO2PG19xS+FE/4ZkvuObReASWlaMVhAd4Ou9oDrs="; + hash = "sha256-SjSdcYAO6Do+OkHPMut+V7VwqBBFIkeHl8gjDIwocc0="; }; nativeBuildInputs = [ - libarchive # To create the .love file (zip format) - ]; - - buildInputs = [ - love - mono - nfd - lua-subprocess - lsqlite3 - ]; - - runtimeInputs = [ - xdg-utils # used by Olympus to check installation completeness + libarchive # To create the .love file (zip format). ]; nugetDeps = ./deps.nix; projectFile = "sharp/Olympus.Sharp.csproj"; executables = [ ]; + # See the 'Dist: Update src/version.txt' step in azure-pipelines.yml from upstream. preConfigure = '' - echo ${version} > src/version.txt + echo ${version}-nixos-${buildId}-${builtins.substring 0 5 rev} > src/version.txt ''; # Hack Olympus.Sharp.bin.{x86,x86_64} to use system mono. - # This was proposed by @0x0ade on discord.gg/celeste: + # This was proposed by @0x0ade on discord.gg/celeste. # https://discord.com/channels/403698615446536203/514006912115802113/827507533962149900 postBuild = '' dotnet_out=sharp/bin/Release/net452 @@ -113,7 +101,13 @@ buildDotnetModule { # The script find-love is hacked to use love from nixpkgs. # It is used to launch Loenn from Olympus. - # I assume --fused is so saves are properly made (https://love2d.org/wiki/love.filesystem) + # I assume --fused is so saves are properly made (https://love2d.org/wiki/love.filesystem). + preInstall = '' + mkdir -p ${phome} + makeWrapper ${lib.getExe love} ${phome}/find-love \ + --add-flags "--fused" + ''; + installPhase = let subprocess-cpath = "${lua-subprocess}/lib/lua/5.1/?.so"; @@ -124,13 +118,12 @@ buildDotnetModule { runHook preInstall mkdir -p $out/bin - makeWrapper ${lib.getExe love} ${phome}/find-love \ - --add-flags "--fused" makeWrapper ${phome}/find-love $out/bin/olympus \ --prefix LUA_CPATH : "${nfd-cpath};${subprocess-cpath};${lsqlite3-cpath}" \ --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ curl ]} \ + --set-default OLYMPUS_MINIINSTALLER_WRAPPER ${miniinstaller-fhs-executable} \ + ${lib.optionalString with-steam-run "--set-default OLYMPUS_CELESTE_WRAPPER ${lib.getExe steam-run}"} \ --add-flags "${phome}/olympus.love" - mkdir -p ${phome} bsdtar --format zip --strip-components 1 -cf ${phome}/olympus.love src dotnet_out=sharp/bin/Release/net452 @@ -140,9 +133,7 @@ buildDotnetModule { runHook postInstall ''; - # we need to force olympus to use the fhs-env postInstall = '' - sed -i 's|^exec|& ${fhs-env}/bin/olympus-fhs|' $out/bin/olympus install -Dm644 lib-linux/olympus.desktop $out/share/applications/olympus.desktop install -Dm644 src/data/icon.png $out/share/icons/hicolor/128x128/apps/olympus.png install -Dm644 LICENSE $out/share/licenses/${pname}/LICENSE @@ -153,7 +144,7 @@ buildDotnetModule { meta = { description = "Cross-platform GUI Everest installer and Celeste mod manager"; homepage = "https://github.com/EverestAPI/Olympus"; - changelog = "https://github.com/EverestAPI/Olympus/blob/main/changelog.txt"; + downloadPage = "https://everestapi.github.io/#olympus"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ ulysseszhan @@ -163,7 +154,7 @@ buildDotnetModule { platforms = lib.platforms.unix; sourceProvenance = with lib.sourceTypes; [ fromSource - binaryNativeCode # Source contains binary; see https://github.com/EverestAPI/Olympus/tree/main/lib-linux/sharp + binaryNativeCode # Source contains binary; see lib-linux/sharp dir in upstream source. ]; }; } diff --git a/pkgs/by-name/ol/olympus/update.sh b/pkgs/by-name/ol/olympus/update.sh index e426917581e8a..365b6464c69a0 100755 --- a/pkgs/by-name/ol/olympus/update.sh +++ b/pkgs/by-name/ol/olympus/update.sh @@ -1,8 +1,11 @@ #!/usr/bin/env nix-shell -#!nix-shell -i bash -p curl jq common-updater-scripts +#!nix-shell -i bash -p curl jq common-updater-scripts nixfmt-rfc-style set -eu -o pipefail +attr=olympus +nix_file=$(nix-instantiate --eval --strict -A "$attr.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/') + api() { curl -s "https://dev.azure.com/EverestAPI/Olympus/_apis/$1?api-version=7.1" } @@ -19,11 +22,12 @@ run_id=$(api pipelines/$pipeline_id/runs | jq -r ' | max_by(.finishedDate) | .id ') +sed -i 's|buildId\s*=\s*".*";|buildId = "'$run_id'";|' $nix_file run=$(api pipelines/$pipeline_id/runs/$run_id) - commit=$(echo "$run" | jq -r '.resources.repositories.self.version') version=$(echo "$run" | jq -r '.name') -update-source-version olympus $version --rev=$commit +update-source-version $attr $version --rev=$commit -"$(nix-build --attr olympus.fetch-deps --no-out-link)" +"$(nix-build --attr $attr.fetch-deps --no-out-link)" +nixfmt $(dirname $nix_file)/deps.nix # NixOS/nixpkgs#358025 From 267c199f887c217b505aca20ed82d07af5b9c7d7 Mon Sep 17 00:00:00 2001 From: Ulysses Zhan Date: Fri, 22 Nov 2024 19:07:26 -0800 Subject: [PATCH 5/7] olympus: more flexible celeste wrapper --- .../ol/olympus-with-steam-run/package.nix | 3 +- pkgs/by-name/ol/olympus/package.nix | 39 ++++++++++++------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/pkgs/by-name/ol/olympus-with-steam-run/package.nix b/pkgs/by-name/ol/olympus-with-steam-run/package.nix index 3fcc4e7beccca..8d5d4b5059942 100644 --- a/pkgs/by-name/ol/olympus-with-steam-run/package.nix +++ b/pkgs/by-name/ol/olympus-with-steam-run/package.nix @@ -1,5 +1,6 @@ { + steam-run, callPackage, }: -callPackage ../olympus/package.nix { with-steam-run = true; } +callPackage ../olympus/package.nix { celesteWrapper = steam-run; } diff --git a/pkgs/by-name/ol/olympus/package.nix b/pkgs/by-name/ol/olympus/package.nix index e400216ee7a4a..2e8543acd2cdd 100644 --- a/pkgs/by-name/ol/olympus/package.nix +++ b/pkgs/by-name/ol/olympus/package.nix @@ -10,11 +10,14 @@ curl, libarchive, buildFHSEnv, - steam-run, - # With this option enabled, Olympus will use steam-run to launch Celeste. - # Users should enable this only if olympus and steam are from the same nixpkgs. - # In either case, users can set OLYMPUS_CELESTE_WRAPPER=steam-run manually. - with-steam-run ? false, + # Some examples for celesteWrapper: + # - null: Do not use wrapper. + # - steam-run: Use steam-run. + # - "steam-run": Use steam-run command available from PATH. + # - buildFHSEnv { ... }: Use a custom FHS env. + # - writeShellScript { ... }: Use a custom shell script. + # In any case, it can be overridden at runtime by OLYMPUS_CELESTE_WRAPPER. + celesteWrapper ? null, }: let @@ -43,7 +46,7 @@ let # When installing Everest, Olympus uses MiniInstaller, which is dynamically linked. miniinstaller-fhs = buildFHSEnv { - name = "olympus-fhs"; + name = "olympus-miniinstaller-fhs"; targetPkgs = pkgs: (with pkgs; [ @@ -55,7 +58,17 @@ let ]); runScript = "bash"; }; - miniinstaller-fhs-executable = "${miniinstaller-fhs}/bin/${miniinstaller-fhs.name}"; + miniinstaller-wrapper = "${miniinstaller-fhs}/bin/${miniinstaller-fhs.name}"; + + celeste-wrapper = + if celesteWrapper == null || builtins.typeOf celesteWrapper == "string" then + celesteWrapper + else if builtins.hasAttr "executable" celesteWrapper && celesteWrapper.executable then + celesteWrapper + else if lib.isDerivation celesteWrapper then + lib.getExe celesteWrapper + else + celesteWrapper; pname = "olympus"; phome = "$out/lib/${pname}"; @@ -121,8 +134,12 @@ buildDotnetModule { makeWrapper ${phome}/find-love $out/bin/olympus \ --prefix LUA_CPATH : "${nfd-cpath};${subprocess-cpath};${lsqlite3-cpath}" \ --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ curl ]} \ - --set-default OLYMPUS_MINIINSTALLER_WRAPPER ${miniinstaller-fhs-executable} \ - ${lib.optionalString with-steam-run "--set-default OLYMPUS_CELESTE_WRAPPER ${lib.getExe steam-run}"} \ + --set-default OLYMPUS_MINIINSTALLER_WRAPPER ${miniinstaller-wrapper} \ + ${ + lib.optionalString ( + celeste-wrapper != null + ) "--set-default OLYMPUS_CELESTE_WRAPPER ${celeste-wrapper}" + } \ --add-flags "${phome}/olympus.love" bsdtar --format zip --strip-components 1 -cf ${phome}/olympus.love src @@ -152,9 +169,5 @@ buildDotnetModule { ]; mainProgram = "olympus"; platforms = lib.platforms.unix; - sourceProvenance = with lib.sourceTypes; [ - fromSource - binaryNativeCode # Source contains binary; see lib-linux/sharp dir in upstream source. - ]; }; } From 3a0be695bb8b28b3e909d519faa16720cb0cb70c Mon Sep 17 00:00:00 2001 From: Ulysses Zhan Date: Fri, 22 Nov 2024 20:23:07 -0800 Subject: [PATCH 6/7] olympus: accept emptry string and path as celeste wrapper; minor fix with lua cpath --- pkgs/by-name/ol/olympus/package.nix | 108 +++++++++++++--------------- 1 file changed, 51 insertions(+), 57 deletions(-) diff --git a/pkgs/by-name/ol/olympus/package.nix b/pkgs/by-name/ol/olympus/package.nix index 2e8543acd2cdd..b382a350d942d 100644 --- a/pkgs/by-name/ol/olympus/package.nix +++ b/pkgs/by-name/ol/olympus/package.nix @@ -11,38 +11,44 @@ libarchive, buildFHSEnv, # Some examples for celesteWrapper: - # - null: Do not use wrapper. + # - null or "": Do not use wrapper. # - steam-run: Use steam-run. # - "steam-run": Use steam-run command available from PATH. # - buildFHSEnv { ... }: Use a custom FHS env. - # - writeShellScript { ... }: Use a custom shell script. + # - writeShellScriptBin { ... }: Use a custom script. + # - ./my-wrapper.sh: Use a custom script. # In any case, it can be overridden at runtime by OLYMPUS_CELESTE_WRAPPER. celesteWrapper ? null, }: let - luaPackages = luajitPackages; - lua-subprocess = luaPackages.buildLuarocksPackage { - pname = "subprocess"; - version = "bfa8e9"; - src = fetchFromGitHub { - owner = "0x0ade"; # a developer of Everest - repo = "lua-subprocess"; - rev = "bfa8e97da774141f301cfd1106dca53a30a4de54"; - hash = "sha256-4LiYWB3PAQ/s33Yj/gwC+Ef1vGe5FedWexeCBVSDIV0="; - }; - rockspecFilename = "subprocess-scm-1.rockspec"; - }; - lsqlite3 = luaPackages.buildLuarocksPackage { - pname = "lsqlite3"; - version = "0.9.6-1"; - src = fetchzip { - url = "http://lua.sqlite.org/index.cgi/zip/lsqlite3_v096.zip"; - hash = "sha256-Mq409A3X9/OS7IPI/KlULR6ZihqnYKk/mS/W/2yrGBg="; - }; - buildInputs = [ sqlite.dev ]; - }; - nfd = luaPackages.nfd; + lua_cpath = + with luajitPackages; + lib.concatMapStringsSep ";" getLuaCPath [ + (buildLuarocksPackage { + pname = "subprocess"; + version = "bfa8e9"; + src = fetchFromGitHub { + owner = "0x0ade"; # a developer of Everest + repo = "lua-subprocess"; + rev = "bfa8e97da774141f301cfd1106dca53a30a4de54"; + hash = "sha256-4LiYWB3PAQ/s33Yj/gwC+Ef1vGe5FedWexeCBVSDIV0="; + }; + rockspecFilename = "subprocess-scm-1.rockspec"; + }) + + (buildLuarocksPackage { + pname = "lsqlite3"; + version = "0.9.6-1"; + src = fetchzip { + url = "http://lua.sqlite.org/index.cgi/zip/lsqlite3_v096.zip"; + hash = "sha256-Mq409A3X9/OS7IPI/KlULR6ZihqnYKk/mS/W/2yrGBg="; + }; + buildInputs = [ sqlite.dev ]; + }) + + nfd + ]; # When installing Everest, Olympus uses MiniInstaller, which is dynamically linked. miniinstaller-fhs = buildFHSEnv { @@ -61,12 +67,10 @@ let miniinstaller-wrapper = "${miniinstaller-fhs}/bin/${miniinstaller-fhs.name}"; celeste-wrapper = - if celesteWrapper == null || builtins.typeOf celesteWrapper == "string" then - celesteWrapper - else if builtins.hasAttr "executable" celesteWrapper && celesteWrapper.executable then - celesteWrapper - else if lib.isDerivation celesteWrapper then + if lib.isDerivation celesteWrapper then lib.getExe celesteWrapper + else if celesteWrapper == null then + "" else celesteWrapper; @@ -121,34 +125,24 @@ buildDotnetModule { --add-flags "--fused" ''; - installPhase = - let - subprocess-cpath = "${lua-subprocess}/lib/lua/5.1/?.so"; - nfd-cpath = "${nfd}/lib/lua/5.1/?.so"; - lsqlite3-cpath = "${lsqlite3}/lib/lua/5.1/?.so"; - in - '' - runHook preInstall - - mkdir -p $out/bin - makeWrapper ${phome}/find-love $out/bin/olympus \ - --prefix LUA_CPATH : "${nfd-cpath};${subprocess-cpath};${lsqlite3-cpath}" \ - --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ curl ]} \ - --set-default OLYMPUS_MINIINSTALLER_WRAPPER ${miniinstaller-wrapper} \ - ${ - lib.optionalString ( - celeste-wrapper != null - ) "--set-default OLYMPUS_CELESTE_WRAPPER ${celeste-wrapper}" - } \ - --add-flags "${phome}/olympus.love" - bsdtar --format zip --strip-components 1 -cf ${phome}/olympus.love src - - dotnet_out=sharp/bin/Release/net452 - dotnet_out=$dotnet_out/$(ls $dotnet_out) - install -Dm755 $dotnet_out/* -t ${phome}/sharp - - runHook postInstall - ''; + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + makeWrapper ${phome}/find-love $out/bin/olympus \ + --prefix LUA_CPATH ; "${lua_cpath}" \ + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ curl ]}" \ + --set-default OLYMPUS_MINIINSTALLER_WRAPPER "${miniinstaller-wrapper}" \ + --set-default OLYMPUS_CELESTE_WRAPPER "${celeste-wrapper}" \ + --add-flags ${phome}/olympus.love + bsdtar --format zip --strip-components 1 -cf ${phome}/olympus.love src + + dotnet_out=sharp/bin/Release/net452 + dotnet_out=$dotnet_out/$(ls $dotnet_out) + install -Dm755 $dotnet_out/* -t ${phome}/sharp + + runHook postInstall + ''; postInstall = '' install -Dm644 lib-linux/olympus.desktop $out/share/applications/olympus.desktop From 8df8fc89a64810b5e5b6afd2e4bba13bb91e39fa Mon Sep 17 00:00:00 2001 From: Ulysses Zhan Date: Fri, 22 Nov 2024 20:31:00 -0800 Subject: [PATCH 7/7] olympus: minor fix with lua cpath; add xdg-utils to path --- pkgs/by-name/ol/olympus/package.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/ol/olympus/package.nix b/pkgs/by-name/ol/olympus/package.nix index b382a350d942d..0fcd1e2fa8caf 100644 --- a/pkgs/by-name/ol/olympus/package.nix +++ b/pkgs/by-name/ol/olympus/package.nix @@ -2,14 +2,15 @@ lib, fetchFromGitHub, fetchzip, + buildFHSEnv, buildDotnetModule, - mono, - love, luajitPackages, sqlite, - curl, libarchive, - buildFHSEnv, + curl, + mono, + love, + xdg-utils, # Some examples for celesteWrapper: # - null or "": Do not use wrapper. # - steam-run: Use steam-run. @@ -130,8 +131,9 @@ buildDotnetModule { mkdir -p $out/bin makeWrapper ${phome}/find-love $out/bin/olympus \ - --prefix LUA_CPATH ; "${lua_cpath}" \ + --prefix LUA_CPATH ";" "${lua_cpath}" \ --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ curl ]}" \ + --suffix PATH : "${lib.makeBinPath [ xdg-utils ]}" \ --set-default OLYMPUS_MINIINSTALLER_WRAPPER "${miniinstaller-wrapper}" \ --set-default OLYMPUS_CELESTE_WRAPPER "${celeste-wrapper}" \ --add-flags ${phome}/olympus.love