Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at github-to-sqlite-beautifulsoup4 98 lines 2.9 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, makeWrapper 5 6# --- Runtime Dependencies --- 7, bash 8, procps 9, iproute2 10, dnsmasq 11, iptables 12, coreutils 13, flock 14, gawk 15, getopt 16, gnugrep 17, gnused 18, which 19# `nmcli` is not required for create_ap. 20# Use NetworkManager by default because it is very likely already present 21, useNetworkManager ? true 22, networkmanager 23 24# --- WiFi Hotspot Dependencies --- 25, useWifiDependencies ? true 26, hostapd 27, iw 28# You only need this if 'iw' can not recognize your adapter. 29, useWirelessTools ? true 30, wirelesstools # for iwconfig 31# To fall back to haveged if entropy is low. 32# Defaulting to false because not having it does not break things. 33# If it is really needed, warnings will be logged to journal. 34, useHaveged ? false 35, haveged 36# You only need this if you wish to show WiFi QR codes in terminal 37, useQrencode ? true 38, qrencode 39}: 40 41stdenv.mkDerivation rec { 42 pname = "linux-router"; 43 version = "0.6.7"; 44 45 src = fetchFromGitHub { 46 owner = "garywill"; 47 repo = "linux-router"; 48 rev = "refs/tags/${version}"; 49 hash = "sha256-Ote/arHCU6qiTXdK2RXv9848aeW6rcBsrb6nfxIzQLs="; 50 }; 51 52 nativeBuildInputs = [ 53 makeWrapper 54 ]; 55 56 dontBuild = true; 57 58 installPhase = with lib; let 59 binPath = makeBinPath ([ procps iproute2 getopt bash dnsmasq 60 iptables coreutils which flock gnugrep gnused gawk ] 61 ++ optional useNetworkManager networkmanager 62 ++ optional useWifiDependencies hostapd 63 ++ optional useWifiDependencies iw 64 ++ optional (useWifiDependencies && useWirelessTools) wirelesstools 65 ++ optional (useWifiDependencies && useHaveged) haveged 66 ++ optional (useWifiDependencies && useQrencode) qrencode); 67 in 68 '' 69 mkdir -p $out/bin/ $out/.bin-wrapped 70 mv lnxrouter $out/.bin-wrapped/lnxrouter 71 makeWrapper $out/.bin-wrapped/lnxrouter $out/bin/lnxrouter --prefix PATH : ${binPath} 72 ''; 73 74 meta = with lib; { 75 homepage = "https://github.com/garywill/linux-router"; 76 description = "Set Linux as router / Wifi hotspot / proxy in one command"; 77 longDescription = '' 78 Features: 79 80 - Create a NATed sub-network 81 - Provide Internet 82 - DHCP server and RA 83 - DNS server 84 - IPv6 (behind NATed LAN, like IPv4) 85 - Creating Wifi hotspot: 86 - Channel selecting 87 - Choose encryptions: WPA2/WPA, WPA2, WPA, No encryption 88 - Create AP on the same interface you are getting Internet (require same channel) 89 - Transparent proxy (redsocks) 90 - DNS proxy 91 - Compatible with NetworkManager (automatically set interface as unmanaged) 92 ''; 93 changelog = "https://github.com/garywill/linux-router/releases/tag/${version}"; 94 license = licenses.lgpl21Only; 95 maintainers = with maintainers; [ x3ro ]; 96 platforms = platforms.linux; 97 }; 98}