mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 23:43:30 +00:00
6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
51 lines
1.3 KiB
Nix
51 lines
1.3 KiB
Nix
{ 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 "setting up wifi hotspots using create_ap";
|
|
settings = mkOption {
|
|
type = with types; attrsOf (oneOf [ int bool str ]);
|
|
default = {};
|
|
description = ''
|
|
Configuration for `create_ap`.
|
|
See [upstream example configuration](https://raw.githubusercontent.com/lakinduakash/linux-wifi-hotspot/master/src/scripts/create_ap.conf)
|
|
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 ];
|
|
|
|
}
|