nixos/create_ap: add module

main
Jonas Heinrich 2 years ago committed by Yt
parent 379f69851f
commit 24b53785cc
  1. 8
      nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
  2. 2
      nixos/doc/manual/release-notes/rl-2205.section.md
  3. 1
      nixos/modules/module-list.nix
  4. 50
      nixos/modules/services/networking/create_ap.nix
  5. 15
      pkgs/os-specific/linux/linux-wifi-hotspot/default.nix

@ -375,6 +375,14 @@
<link xlink:href="options.html#opt-services.headscale.enable">services.headscale</link>
</para>
</listitem>
<listitem>
<para>
<link xlink:href="https://github.com/lakinduakash/linux-wifi-hotspot">create_ap</link>,
a module for creating wifi hotspots using the program
linux-wifi-hotspot. Available as
<link xlink:href="options.html#opt-services.create_ap.enable">services.create_ap</link>.
</para>
</listitem>
<listitem>
<para>
<link xlink:href="https://0xerr0r.github.io/blocky/">blocky</link>,

@ -107,6 +107,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- [headscale](https://github.com/juanfont/headscale), an Open Source implementation of the [Tailscale](https://tailscale.io) Control Server. Available as [services.headscale](options.html#opt-services.headscale.enable)
- [create_ap](https://github.com/lakinduakash/linux-wifi-hotspot), a module for creating wifi hotspots using the program linux-wifi-hotspot. Available as [services.create_ap](options.html#opt-services.create_ap.enable).
- [blocky](https://0xerr0r.github.io/blocky/), fast and lightweight DNS proxy as ad-blocker for local network with many features.
- [pacemaker](https://clusterlabs.org/pacemaker/) cluster resource manager

@ -740,6 +740,7 @@
./services/networking/coredns.nix
./services/networking/corerad.nix
./services/networking/coturn.nix
./services/networking/create_ap.nix
./services/networking/croc.nix
./services/networking/dante.nix
./services/networking/ddclient.nix

@ -0,0 +1,50 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.create_ap;
configFile = pkgs.writeText "create_ap.conf" (generators.toKeyValue { } cfg.settings);
in {
options = {
services.create_ap = {
enable = mkEnableOption "setup wifi hotspots using create_ap";
settings = mkOption {
type = with types; attrsOf (oneOf [ int bool str ]);
default = {};
description = ''
Configuration for <package>create_ap</package>.
See <link xlink:href="https://raw.githubusercontent.com/lakinduakash/linux-wifi-hotspot/master/src/scripts/create_ap.conf">upstream example configuration</link>
for supported values.
'';
example = {
INTERNET_IFACE = "eth0";
WIFI_IFACE = "wlan0";
SSID = "My Wifi Hotspot";
PASSPHRASE = "12345678";
};
};
};
};
config = mkIf cfg.enable {
systemd = {
services.create_ap = {
wantedBy = [ "multi-user.target" ];
description = "Create AP Service";
after = [ "network.target" ];
restartTriggers = [ configFile ];
serviceConfig = {
ExecStart = "${pkgs.linux-wifi-hotspot}/bin/create_ap --config ${configFile}";
KillSignal = "SIGINT";
Restart = "on-failure";
};
};
};
};
meta.maintainers = with lib.maintainers; [ onny ];
}

@ -8,7 +8,13 @@
, iw
, makeWrapper
, qrencode
, hostapd }:
, hostapd
, getopt
, dnsmasq
, iproute2
, flock
, iptables
, gawk }:
stdenv.mkDerivation rec {
pname = "linux-wifi-hotspot";
@ -41,9 +47,6 @@ stdenv.mkDerivation rec {
--replace "etc" "$out/etc"
substituteInPlace ./src/scripts/wihotspot \
--replace "/usr" "$out"
substituteInPlace ./src/scripts/create_ap.service \
--replace "/usr/bin/create_ap" "$out/bin/create_cap" \
--replace "/etc/create_ap.conf" "$out/etc/create_cap.conf"
'';
makeFlags = [
@ -52,7 +55,9 @@ stdenv.mkDerivation rec {
postInstall = ''
wrapProgram $out/bin/create_ap \
--prefix PATH : ${lib.makeBinPath [ hostapd ]}
--prefix PATH : ${lib.makeBinPath [
hostapd getopt iw which dnsmasq iproute2 flock iptables gawk
]}
wrapProgram $out/bin/wihotspot-gui \
--prefix PATH : ${lib.makeBinPath [ iw ]} \

Loading…
Cancel
Save