nixpkgs/pkgs/by-name/li/linux-router/package.nix

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

100 lines
2.9 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
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 19:29:52 +00:00
# --- Runtime Dependencies ---
, bash
, procps
, iproute2
, dnsmasq
, iptables
, coreutils
, flock
, gawk
, getopt
, gnugrep
, gnused
, which
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 19:29:52 +00:00
# `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
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 19:29:52 +00:00
# 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";
2024-10-04 15:02:52 +00:00
version = "0.7.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 19:29:52 +00:00
src = fetchFromGitHub {
owner = "garywill";
repo = "linux-router";
rev = "refs/tags/${version}";
2024-10-04 15:02:52 +00:00
hash = "sha256-iiIDWDPz8MBwsBcJAWVNeuGwaNJ7xh7gFfRqXTG4oGQ=";
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 19:29:52 +00:00
};
nativeBuildInputs = [
makeWrapper
];
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 19:29:52 +00:00
dontBuild = true;
2024-08-16 21:18:07 +00:00
installPhase = let
binPath = lib.makeBinPath ([ procps iproute2 getopt bash dnsmasq
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 19:29:52 +00:00
iptables coreutils which flock gnugrep gnused gawk ]
2024-08-16 21:18:07 +00:00
++ lib.optional useNetworkManager networkmanager
++ lib.optional useWifiDependencies hostapd
++ lib.optional useWifiDependencies iw
++ lib.optional (useWifiDependencies && useWirelessTools) wirelesstools
++ lib.optional (useWifiDependencies && useHaveged) haveged
++ lib.optional (useWifiDependencies && useQrencode) qrencode);
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 19:29:52 +00:00
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)
'';
changelog = "https://github.com/garywill/linux-router/releases/tag/${version}";
license = licenses.lgpl21Only;
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 19:29:52 +00:00
maintainers = with maintainers; [ x3ro ];
platforms = platforms.linux;
2024-02-11 02:19:15 +00:00
mainProgram = "lnxrouter";
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 19:29:52 +00:00
};
}