nixpkgs-suyu/pkgs/tools/networking/linux-router/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

82 lines
2.7 KiB
Nix
Raw Normal View History

linux-router: init at 0.6.2 Squashed commits: - Give wrapped executable a nicer name The filename of the wrapped binary is used to generate usage examples in `--help`. The `wrapProgram` command renames the executable to a hidden file and appends `-wrapped` this is then shown in the usage example: ``` Usage: .lnxrouter-wrapped <options> ``` - Using `makeWrapper` the executable can be moved to another directory but can keep it's oroginal name. - Replace alias with real package name - Fix variable name - Import `makeWrapper` directly instead of importing `pkgs` Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Move `let` to where it is actually used - Do not set optional packages `null` - Remove `name` property Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Quote url Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Remove additional link in long description - Remove unnecessary comment Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Place optional packages below their respective `use*` - Shorten description See discussion: https://github.com/NixOS/nixpkgs/pull/137133#discussion_r705230260 - FIX: Remove duplicate description - Remove empty line Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Make packages section more compact - Make wifi dependencies optional - Add package without wifi dependencies - Fix indentation Co-authored-by: Sandro <sandro.jaeckel@gmail.com> - Use `with lib` only where it is needed Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2021-09-08 21:29:52 +02:00
{ 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";
2021-12-07 13:09:39 +01:00
version = "0.6.6";
linux-router: init at 0.6.2 Squashed commits: - Give wrapped executable a nicer name The filename of the wrapped binary is used to generate usage examples in `--help`. The `wrapProgram` command renames the executable to a hidden file and appends `-wrapped` this is then shown in the usage example: ``` Usage: .lnxrouter-wrapped <options> ``` - Using `makeWrapper` the executable can be moved to another directory but can keep it's oroginal name. - Replace alias with real package name - Fix variable name - Import `makeWrapper` directly instead of importing `pkgs` Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Move `let` to where it is actually used - Do not set optional packages `null` - Remove `name` property Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Quote url Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Remove additional link in long description - Remove unnecessary comment Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Place optional packages below their respective `use*` - Shorten description See discussion: https://github.com/NixOS/nixpkgs/pull/137133#discussion_r705230260 - FIX: Remove duplicate description - Remove empty line Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Make packages section more compact - Make wifi dependencies optional - Add package without wifi dependencies - Fix indentation Co-authored-by: Sandro <sandro.jaeckel@gmail.com> - Use `with lib` only where it is needed Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2021-09-08 21:29:52 +02:00
src = fetchFromGitHub {
owner = "garywill";
repo = "linux-router";
rev = "${version}";
2021-12-07 13:09:39 +01:00
sha256 = "sha256-QBxlqKNaCUMVkm8rVTZ5z6tTN9WxgDQxeNkbgCe9KEg=";
linux-router: init at 0.6.2 Squashed commits: - Give wrapped executable a nicer name The filename of the wrapped binary is used to generate usage examples in `--help`. The `wrapProgram` command renames the executable to a hidden file and appends `-wrapped` this is then shown in the usage example: ``` Usage: .lnxrouter-wrapped <options> ``` - Using `makeWrapper` the executable can be moved to another directory but can keep it's oroginal name. - Replace alias with real package name - Fix variable name - Import `makeWrapper` directly instead of importing `pkgs` Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Move `let` to where it is actually used - Do not set optional packages `null` - Remove `name` property Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Quote url Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Remove additional link in long description - Remove unnecessary comment Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Place optional packages below their respective `use*` - Shorten description See discussion: https://github.com/NixOS/nixpkgs/pull/137133#discussion_r705230260 - FIX: Remove duplicate description - Remove empty line Co-authored-by: markuskowa <markus.kowalewski@gmail.com> - Make packages section more compact - Make wifi dependencies optional - Add package without wifi dependencies - Fix indentation Co-authored-by: Sandro <sandro.jaeckel@gmail.com> - Use `with lib` only where it is needed Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2021-09-08 21:29:52 +02:00
};
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;
};
}