Merge pull request #137133 from x3rAx/linux-router-0.6.2

linux-router: init at 0.6.2
This commit is contained in:
markuskowa 2021-09-12 12:46:29 +02:00 committed by GitHub
commit b4114db313
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 91 additions and 0 deletions

@ -11838,6 +11838,12 @@
githubId = 3992240;
name = "Elijah Rum";
};
x3ro = {
name = "^x3ro";
email = "nix@x3ro.dev";
github = "x3rAx";
githubId = 2268851;
};
xaverdh = {
email = "hoe.dom@gmx.de";
github = "xaverdh";

@ -0,0 +1,81 @@
{ stdenv, lib, fetchFromGitHub, makeWrapper
# --- Runtime Dependencies ---
, bash, procps, iproute2, dnsmasq, iptables
, coreutils, flock, gawk, getopt, gnugrep, gnused, which
# `nmcli` is not required for create_ap.
# Use NetworkManager by default because it is very likely already present
, useNetworkManager ? true
, networkmanager
# --- WiFi Hotspot Dependencies ---
, useWifiDependencies ? true
, hostapd, iw
# You only need this if 'iw' can not recognize your adapter.
, useWirelessTools ? true
, wirelesstools # for iwconfig
# To fall back to haveged if entropy is low.
# Defaulting to false because not having it does not break things.
# If it is really needed, warnings will be logged to journal.
, useHaveged ? false
, haveged
# You only need this if you wish to show WiFi QR codes in terminal
, useQrencode ? true
, qrencode
}:
stdenv.mkDerivation rec {
pname = "linux-router";
version = "0.6.2";
src = fetchFromGitHub {
owner = "garywill";
repo = "linux-router";
rev = "${version}";
sha256 = "193bnlwmjxsk0cri6xdylf218qayldn02pdnppvbd39ls361776z";
};
nativeBuildInputs = [ makeWrapper ];
dontBuild = true;
installPhase = with lib; let
binPath = makeBinPath ([ procps iproute2 getopt bash dnsmasq
iptables coreutils which flock gnugrep gnused gawk ]
++ optional useNetworkManager networkmanager
++ optional useWifiDependencies hostapd
++ optional useWifiDependencies iw
++ optional (useWifiDependencies && useWirelessTools) wirelesstools
++ optional (useWifiDependencies && useHaveged) haveged
++ optional (useWifiDependencies && useQrencode) qrencode);
in
''
mkdir -p $out/bin/ $out/.bin-wrapped
mv lnxrouter $out/.bin-wrapped/lnxrouter
makeWrapper $out/.bin-wrapped/lnxrouter $out/bin/lnxrouter --prefix PATH : ${binPath}
'';
meta = with lib; {
homepage = "https://github.com/garywill/linux-router";
description = "Set Linux as router / Wifi hotspot / proxy in one command";
longDescription = ''
Features:
- Create a NATed sub-network
- Provide Internet
- DHCP server and RA
- DNS server
- IPv6 (behind NATed LAN, like IPv4)
- Creating Wifi hotspot:
- Channel selecting
- Choose encryptions: WPA2/WPA, WPA2, WPA, No encryption
- Create AP on the same interface you are getting Internet (require same channel)
- Transparent proxy (redsocks)
- DNS proxy
- Compatible with NetworkManager (automatically set interface as unmanaged)
'';
license = licenses.lgpl21;
maintainers = with maintainers; [ x3ro ];
platforms = platforms.linux;
};
}

@ -899,6 +899,10 @@ with pkgs;
gofu = callPackage ../applications/misc/gofu { };
linux-router = callPackage ../tools/networking/linux-router { };
linux-router-without-wifi = linux-router.override { useWifiDependencies = false; };
metapixel = callPackage ../tools/graphics/metapixel { };
pferd = callPackage ../tools/misc/pferd {};