Skip to content

Instantly share code, notes, and snippets.

@maxsei
Created December 14, 2022 00:13
Show Gist options
  • Select an option

  • Save maxsei/f0cdee5808295c76ae2d4e25513dded0 to your computer and use it in GitHub Desktop.

Select an option

Save maxsei/f0cdee5808295c76ae2d4e25513dded0 to your computer and use it in GitHub Desktop.
Patching executables with presumed dynamically linked libarary locations (these systems that aren't nix lol)
{ stdenv, lib, gcc-unwrapped }:
stdenv.mkDerivation rec {
name = "mercurytcpclient";
version = "0.0.1";
src = ./.;
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
installPhase = ''
mkdir $out
cp ${src}/mercurytcpclient $out
'';
preFixup = let
# Include dependencies here.
libPath = lib.makeLibraryPath [ gcc-unwrapped ];
in ''
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${libPath}" \
$out/mercurytcpclient
'';
meta = with lib; {
homepage = "https://www.algoseek.com/";
description = "a test client for connecting to algoseek";
# license = licenses.unfree;
platforms = platforms.linux;
# maintainers = [ your_name ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment