Skip to content

Instantly share code, notes, and snippets.

@velveteer
Created June 23, 2016 17:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velveteer/355183807a3f41bc1d631408f5e5c949 to your computer and use it in GitHub Desktop.
Save velveteer/355183807a3f41bc1d631408f5e5c949 to your computer and use it in GitHub Desktop.
Nix derivation for SunVox binary
{ stdenv, pkgs, patchelf, libX11, alsaLib, SDL }:
stdenv.mkDerivation rec {
name = "sunvox-${version}";
version = "1.9.1";
src = ./sunvox-1.9.1.zip;
buildInputs = [ pkgs.unzip patchelf];
libPath = stdenv.lib.makeLibraryPath [
stdenv.cc.cc
alsaLib
SDL
libX11
];
phases = [ "unpackPhase" "installPhase" ];
installPhase = ''
mkdir -p "$out/opt/sunvox"
cp -r sunvox/linux_x86_64/sunvox "$out/opt/sunvox"
chmod +x "$out/opt/sunvox/sunvox"
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
--set-rpath "$libPath" "$out/opt/sunvox/sunvox"
mkdir "$out/bin"
ln -s "$out/opt/sunvox/sunvox" "$out/bin/sunvox"
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment