Skip to content

Commit

Permalink
olympus: init at 24.07.06.02
Browse files Browse the repository at this point in the history
This is an attempt to package [Olympus](https://everestapi.github.io/), a GUI for installing Everest and managing Celeste mods.
This is based on this [draft](NixOS#295258), with the authors permission.

It maintains the previous issue of not being able to launch Steam
versions of Celeste from the command line but that's not feasible
without upstream changes.

I only have to note that it has a popup complaining about
finishing the installation but that's due to xdg-mime
x-scheme-handler/everest not being set.

Finally I want to note that it depends on lua51Packages.nfd, which
is broken while [this](NixOS#309026)
isn't merged so currently has the fix there.

Finally, [Lönn](https://github.com/CelestialCartographers/Loenn) works
as expected, being the installation managed by the program.

Ahorn is deprecated(in favor of Loenn) and it crashes over trying to run dynamic
executables

olympus: fixed zenity argument

olympus: bugfix add openssl to fhs

olympus: fixed to use the default nfd instead of patched version

olympus: changed location of ndf arg

olympus: bugfix: add xdg-utils as runtime dependency to fix pop-up

olympus: deleted zenity.patch

Due to nfd lua package being fixed, this patch is no longer needed

olympus: fix use of wrong nfd package

olympus: bumped up version to 24.07.06.02

olympus: format files with nixfmt-rfc

olympus: chores: comments, fixed lib conventions
  • Loading branch information
Petingoso committed Nov 21, 2024
1 parent 557f8d0 commit 757cec9
Show file tree
Hide file tree
Showing 2 changed files with 221 additions and 0 deletions.
51 changes: 51 additions & 0 deletions pkgs/by-name/ol/olympus/deps.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

170 changes: 170 additions & 0 deletions pkgs/by-name/ol/olympus/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
{
lib,
fetchFromGitHub,
fetchzip,
buildDotnetModule,
mono4,
love,
lua51Packages,
msbuild,
sqlite,
curl,
libarchive,
buildFHSEnv,
xdg-utils,
}:
# 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
lua-subprocess = lua51Packages.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";
};

# NOTE: on installation olympus uses MiniInstallerLinux which is dynamically linked, this makes it run fine
fhs-env = buildFHSEnv {
name = "olympus-fhs";
targetPkgs =
pkgs:
(with pkgs; [
icu
stdenv.cc.cc
libgcc.lib
openssl
]);
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 ];
};

dotnet-out = "sharp/bin/Release/net452";
pname = "olympus";
phome = "$out/lib/${pname}";
nfd = lua51Packages.nfd;
in
buildDotnetModule rec {
inherit pname;

# FIXME: I made up this version number.
version = "24.07.06.02";

src = fetchFromGitHub {
owner = "EverestAPI";
repo = "Olympus";
rev = "5f3e40687eb825c57021f52d83a3bc9a82c04bdb";
fetchSubmodules = true; # Required. See upstream's README.
hash = "sha256-rNh6sH51poahiV0Mb61lHfzqOkPF2pW2wr7MOrfVSVs=";
};

executables = [ ];

nativeBuildInputs = [
msbuild
libarchive # To create the .love file (zip format)
];

buildInputs = [
love
mono4
nfd
lua-subprocess
lsqlite3
];

runtimeInputs = [
xdg-utils
];

nugetDeps = ./deps.nix;

projectFile = "sharp/Olympus.Sharp.sln";

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=${mono4.out}/lib/mono/4.5 msbuild ${projectFile} /p:Configuration=Release
runHook postBuild
'';

# 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 ${mono4.out}/bin/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
'';

# The script find-love is hacked to use love from nixpkgs.
# 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";
in
''
runHook preInstall
mkdir -p $out/bin
makeWrapper ${love.out}/bin/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 ]} \
--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
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
'';

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";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
ulysseszhan
petingoso
];
mainProgram = "olympus";
platforms = lib.platforms.unix;
};
}

0 comments on commit 757cec9

Please sign in to comment.