Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

etterna: init at 8deab33 #353956

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions pkgs/by-name/et/etterna/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
lib,
stdenv,
fetchFromGitHub,
writeShellScript,

# dependencies
alsa-lib,
clang,
cmake,
curl,
libGLU,
libjack2,
libogg,
mesa,
openssl,
xorg,

# enable crash reporting. makes insecure due to dependency on python2
# @TODO: fix crashpad; needs depot_tools
enableCrashpad ? false,
python2,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "etterna";
version = "8deab331e6c0e9b34eeeda363863193b26c221a4";

src = fetchFromGitHub {
owner = "etternagame";
repo = "etterna";
rev = finalAttrs.version;
hash = "sha256-LdJDTO8c7kS8G52b0MRO4oFhZZlcsexwJl1deVz9vf0=";
};

nativeBuildInputs =
[
alsa-lib
clang
cmake
curl
libGLU
libjack2
libogg
mesa
openssl
xorg.libX11
xorg.libXext
xorg.libXrandr
]
# crashpad relies on python2 and depot_tools
++ lib.optionals enableCrashpad [ python2 ];

installPhase = ''
runHook preInstall

mkdir -p $out/{bin,share/etterna}

# copy select necessary game files into virtual fs
for dir in \
Announcers Assets BGAnimations \
BackgroundEffects BackgroundTransitions \
Data GameTools NoteSkins Scripts \
Songs Themes
do
cp -r "/build/source/$dir" "$out/share/etterna/$dir"
done

# copy binary
cp /build/source/Etterna $out/bin/etterna-unwrapped

# wacky insertion of wrapper directly into phase, so that $out is set
cat > $out/bin/etterna << EOF
#!${stdenv.shell}

export ETTERNA_ROOT_DIR="\$HOME/.local/share/etterna"
export ETTERNA_ADDITIONAL_ROOT_DIRS="$out/share/etterna"

echo "HOME: \$HOME"
echo "PWD: \$(pwd)"
echo "ETTERNA_ADDITIONAL_ROOT_DIRS: \$ETTERNA_ADDITIONAL_ROOT_DIRS"

exec $out/bin/etterna-unwrapped "\$@"
EOF

chmod +x $out/bin/etterna

runHook postInstall
'';

cmakeFlags = lib.optionals (!enableCrashpad) [ "-D WITH_CRASHPAD=OFF" ];

meta = with lib; {
license = with licenses; [ mit ];
maintainers = with maintainers; [ mib ];
mainProgram = "etterna";
};
})