Skip to content

Instantly share code, notes, and snippets.

@tuuzdu
Last active June 21, 2020 10:31
Show Gist options
  • Save tuuzdu/9c35c39b6332c2531ce5bbc213d0b7a6 to your computer and use it in GitHub Desktop.
Save tuuzdu/9c35c39b6332c2531ce5bbc213d0b7a6 to your computer and use it in GitHub Desktop.
Nix hamachi aarch64
{ stdenv, fetchurl }:
with stdenv.lib;
let
arch =
if stdenv.hostPlatform.system == "x86_64-linux" then "x64"
else if stdenv.hostPlatform.system == "i686-linux" then "x86"
else if stdenv.hostPlatform.system == "aarch64-linux" then "armhf"
else throwSystem;
throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
sha256 =
if stdenv.hostPlatform.system == "x86_64-linux" then "11mxa4kls5xjj3462ycrfvfxb1xkk23p5m9iirvwsi0zdmhpnwm8"
else if stdenv.hostPlatform.system == "i686-linux" then "03ml9xv19km99f0z7fpr21b1zkxvw7q39kjzd8wpb2pds51wnc62"
else if stdenv.hostPlatform.system == "aarch64-linux" then "1r0iis8yvgy3ypsybfvfm61na12ikprz3q9zrz98pv3vf5xvxqdg"
else throwSystem;
libraries = stdenv.lib.makeLibraryPath [ stdenv.cc.cc ];
in stdenv.mkDerivation rec {
name = "logmein-hamachi-${version}";
version = "2.1.0.198";
src = fetchurl {
url = "https://www.vpn.net/installers/${name}-${arch}.tgz";
inherit sha256;
};
installPhase = ''
patchelf \
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
--set-rpath ${libraries} \
hamachid
install -D -m755 hamachid $out/bin/hamachid
ln -s $out/bin/hamachid $out/bin/hamachi
'';
dontStrip = true;
dontPatchELF = false;
meta = with stdenv.lib; {
description = "A hosted VPN service that lets you securely extend LAN-like networks to distributed teams";
homepage = https://secure.logmein.com/products/hamachi/;
license = licenses.unfreeRedistributable;
maintainers = with maintainers; [ abbradar ];
platforms = platforms.linux;
};
}
[de@nixos:~/tmp]$ patchelf --print-interpreter result/bin/hamachi
/nix/store/050idx5gi2kj7lpgn0j4py3l89fknbmh-glibc-2.27/lib/ld-linux-aarch64.so.1
[de@nixos:~/tmp]$ patchelf --print-rpath result/bin/hamachi
/nix/store/c9ib7vrzzrsccgwnpgkw0pi3pcpvkzvb-gcc-7.3.0-lib/lib
[de@nixos:~/tmp]$ ldd result/bin/hamachi
not a dynamic executable
[de@nixos:~/tmp]$ ldd result/bin/hamachid
not a dynamic executable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment