nixos/create_ap: add module
This commit is contained in:
parent
379f69851f
commit
24b53785cc
|
@ -375,6 +375,14 @@
|
||||||
<link xlink:href="options.html#opt-services.headscale.enable">services.headscale</link>
|
<link xlink:href="options.html#opt-services.headscale.enable">services.headscale</link>
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</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>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
<link xlink:href="https://0xerr0r.github.io/blocky/">blocky</link>,
|
<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)
|
- [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.
|
- [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
|
- [pacemaker](https://clusterlabs.org/pacemaker/) cluster resource manager
|
||||||
|
|
|
@ -740,6 +740,7 @@
|
||||||
./services/networking/coredns.nix
|
./services/networking/coredns.nix
|
||||||
./services/networking/corerad.nix
|
./services/networking/corerad.nix
|
||||||
./services/networking/coturn.nix
|
./services/networking/coturn.nix
|
||||||
|
./services/networking/create_ap.nix
|
||||||
./services/networking/croc.nix
|
./services/networking/croc.nix
|
||||||
./services/networking/dante.nix
|
./services/networking/dante.nix
|
||||||
./services/networking/ddclient.nix
|
./services/networking/ddclient.nix
|
||||||
|
|
50
nixos/modules/services/networking/create_ap.nix
Normal file
50
nixos/modules/services/networking/create_ap.nix
Normal file
|
@ -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
|
, iw
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
, qrencode
|
, qrencode
|
||||||
, hostapd }:
|
, hostapd
|
||||||
|
, getopt
|
||||||
|
, dnsmasq
|
||||||
|
, iproute2
|
||||||
|
, flock
|
||||||
|
, iptables
|
||||||
|
, gawk }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "linux-wifi-hotspot";
|
pname = "linux-wifi-hotspot";
|
||||||
|
@ -41,9 +47,6 @@ stdenv.mkDerivation rec {
|
||||||
--replace "etc" "$out/etc"
|
--replace "etc" "$out/etc"
|
||||||
substituteInPlace ./src/scripts/wihotspot \
|
substituteInPlace ./src/scripts/wihotspot \
|
||||||
--replace "/usr" "$out"
|
--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 = [
|
makeFlags = [
|
||||||
|
@ -52,7 +55,9 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
wrapProgram $out/bin/create_ap \
|
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 \
|
wrapProgram $out/bin/wihotspot-gui \
|
||||||
--prefix PATH : ${lib.makeBinPath [ iw ]} \
|
--prefix PATH : ${lib.makeBinPath [ iw ]} \
|
||||||
|
|
Loading…
Reference in a new issue