1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-29 17:10:48 +00:00
nixpkgs/pkgs/applications/misc/glava/default.nix

81 lines
2 KiB
Nix
Raw Normal View History

2018-09-13 02:40:23 +01:00
{ stdenv, fetchgit, fetchurl, writeScript
2018-06-16 16:15:16 +01:00
, libGL, libX11, libXext, python3, libXrandr, libXrender, libpulseaudio, libXcomposite
, enableGlfw ? false, glfw }:
let
inherit (stdenv.lib) optional makeLibraryPath;
wrapperScript = writeScript "glava" ''
#!${stdenv.shell}
case "$1" in
--copy-config)
# 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 {
name = "glava-${version}";
2018-10-11 10:53:41 +01:00
version = "1.5.5";
2018-06-16 16:15:16 +01:00
2018-09-13 02:40:23 +01:00
src = fetchgit {
url = "https://github.com/wacossusca34/glava.git";
2018-06-16 16:15:16 +01:00
rev = "v${version}";
2018-10-11 10:53:41 +01:00
sha256 = "0mpbgllwz45wkax6pgvnh1pz2q4yvbzq2l8z8kff13wrsdvl8lh0";
2018-06-16 16:15:16 +01:00
};
buildInputs = [
libX11
libXext
libXrandr
libXrender
libpulseaudio
libXcomposite
] ++ optional enableGlfw glfw;
nativeBuildInputs = [
python3
];
2018-10-11 10:53:41 +01:00
preConfigure = ''
export CFLAGS="-march=native"
2018-06-16 16:15:16 +01: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
patchelf \
2018-06-16 16:15:16 +01:00
--set-rpath "$(patchelf --print-rpath $out/bin/.glava-unwrapped):${makeLibraryPath [ libGL ]}" \
$out/bin/.glava-unwrapped
2018-06-16 16:15:16 +01:00
substitute ${wrapperScript} $out/bin/glava --subst-var out
chmod +x $out/bin/glava
'';
meta = with stdenv.lib; {
description = ''
OpenGL audio spectrum visualizer
'';
homepage = https://github.com/wacossusca34/glava;
platforms = platforms.linux;
license = licenses.gpl3;
maintainers = with maintainers; [
eadwu
];
};
}