2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, writeScript, fetchFromGitHub
|
2018-06-16 17:15:16 +02:00
|
|
|
, libGL, libX11, libXext, python3, libXrandr, libXrender, libpulseaudio, libXcomposite
|
2019-02-26 12:45:54 +01:00
|
|
|
, enableGlfw ? false, glfw, runtimeShell }:
|
2018-06-16 17:15:16 +02:00
|
|
|
|
|
|
|
let
|
2021-01-15 06:42:41 +01:00
|
|
|
inherit (lib) optional makeLibraryPath;
|
2018-06-16 17:15:16 +02:00
|
|
|
|
|
|
|
wrapperScript = writeScript "glava" ''
|
2019-02-26 12:45:54 +01:00
|
|
|
#!${runtimeShell}
|
2018-06-16 17:15:16 +02:00
|
|
|
case "$1" in
|
2019-11-24 16:53:54 +01:00
|
|
|
--copy-config|-C)
|
2018-06-16 17:15:16 +02:00
|
|
|
# The binary would symlink it, which won't work in Nix because the
|
|
|
|
# garbage collector will eventually remove the original files after
|
|
|
|
# updates
|
|
|
|
echo "Nix wrapper: Copying glava config to ~/.config/glava"
|
|
|
|
cp -r --no-preserve=all @out@/etc/xdg/glava ~/.config/glava
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exec @out@/bin/.glava-unwrapped "$@"
|
|
|
|
esac
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "glava";
|
2019-03-14 23:22:04 +01:00
|
|
|
version = "1.6.3";
|
2018-06-16 17:15:16 +02:00
|
|
|
|
2018-11-03 13:39:44 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "wacossusca34";
|
|
|
|
repo = "glava";
|
2018-06-16 17:15:16 +02:00
|
|
|
rev = "v${version}";
|
2019-03-14 23:22:04 +01:00
|
|
|
sha256 = "0kqkjxmpqkmgby05lsf6c6iwm45n33jk5qy6gi3zvjx4q4yzal1i";
|
2018-06-16 17:15:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libX11
|
|
|
|
libXext
|
|
|
|
libXrandr
|
|
|
|
libXrender
|
|
|
|
libpulseaudio
|
|
|
|
libXcomposite
|
|
|
|
] ++ optional enableGlfw glfw;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
python3
|
|
|
|
];
|
|
|
|
|
2018-10-11 11:53:41 +02:00
|
|
|
preConfigure = ''
|
2019-11-24 16:53:54 +01:00
|
|
|
for f in $(find -type f);do
|
|
|
|
substituteInPlace $f \
|
|
|
|
--replace /etc/xdg $out/etc/xdg
|
|
|
|
done
|
|
|
|
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace '$(DESTDIR)$(SHADERDIR)' '$(SHADERDIR)'
|
|
|
|
|
2019-03-12 21:59:20 +01:00
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace 'unknown' 'v${version}'
|
|
|
|
|
2018-10-11 11:53:41 +02:00
|
|
|
export CFLAGS="-march=native"
|
2018-06-16 17:15:16 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = optional (!enableGlfw) "DISABLE_GLFW=1";
|
|
|
|
|
|
|
|
installFlags = [
|
|
|
|
"DESTDIR=$(out)"
|
|
|
|
];
|
|
|
|
|
|
|
|
fixupPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
mv $out/usr/bin/glava $out/bin/.glava-unwrapped
|
|
|
|
rm -rf $out/usr
|
|
|
|
|
2018-07-13 01:48:44 +02:00
|
|
|
patchelf \
|
2018-06-16 17:15:16 +02:00
|
|
|
--set-rpath "$(patchelf --print-rpath $out/bin/.glava-unwrapped):${makeLibraryPath [ libGL ]}" \
|
2018-07-13 01:48:44 +02:00
|
|
|
$out/bin/.glava-unwrapped
|
2018-06-16 17:15:16 +02:00
|
|
|
|
|
|
|
substitute ${wrapperScript} $out/bin/glava --subst-var out
|
|
|
|
chmod +x $out/bin/glava
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2018-06-16 17:15:16 +02:00
|
|
|
description = ''
|
|
|
|
OpenGL audio spectrum visualizer
|
|
|
|
'';
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/wacossusca34/glava";
|
2018-06-16 17:15:16 +02:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = with maintainers; [
|
|
|
|
eadwu
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|