diff options
| author | Fuwn <[email protected]> | 2024-08-31 17:06:30 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-08-31 17:06:30 -0700 |
| commit | 1884048a0ab148721a7e9f74c3c419863b47f0a7 (patch) | |
| tree | ec4eb4ad05a600b0bc9d42d3116151b34f8fc945 /pkgs | |
| parent | f (diff) | |
| download | nixos-config-1884048a0ab148721a7e9f74c3c419863b47f0a7.tar.xz nixos-config-1884048a0ab148721a7e9f74c3c419863b47f0a7.zip | |
hi
Diffstat (limited to 'pkgs')
| -rw-r--r-- | pkgs/bindtointerface.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/pkgs/bindtointerface.nix b/pkgs/bindtointerface.nix new file mode 100644 index 0000000..dfba655 --- /dev/null +++ b/pkgs/bindtointerface.nix @@ -0,0 +1,46 @@ +{ pkgs, lib, stdenv, fetchurl, gcc }: +stdenv.mkDerivation { + pname = "bindtointerface"; + version = "1.0"; + + src = pkgs.fetchFromGitHub { + owner = "JsBergbau"; + repo = "BindToInterface"; + rev = "d477326d85f64fdd1dc46382fe698e46f4843100"; + hash = "sha256-B29nXjy8RyFEOsYtko8l9i38sDauX2eW+pLsQssNTmQ="; + }; + + nativeBuildInputs = [ gcc ]; + + buildPhase = '' + gcc \ + -nostartfiles \ + -fpic \ + -shared $src/bindToInterface.c \ + -o bindToInterface.so \ + -ldl \ + -D_GNU_SOURCE + ''; + + installPhase = '' + mkdir -p $out/bin $out/lib + + cp bindToInterface.so $out/lib + + cat <<EOF > $out/bin/vpn + #!/usr/bin/env bash + + env LD_PRELOAD=$out/lib/bindToInterface.so "\$@" + EOF + + chmod +x $out/bin/vpn + ''; + + meta = with lib; { + description = "With this program you can bind applications to a specific network interface / network adapter."; + homepage = "https://github.com/JsBergbau/BindToInterface"; + license = licenses.gpl2; + maintainers = with lib.maintainers; [ Fuwn ]; + platforms = platforms.linux; + }; +} |