update hostapd to "build" syntax

module-based-network
Daniel Barlow 2023-08-05 12:21:18 +01:00
parent 90c1d59aca
commit f82501d278
4 changed files with 14 additions and 18 deletions

View File

@ -54,7 +54,7 @@ in rec {
rootfsType = "jffs2"; rootfsType = "jffs2";
hostname = "rotuer"; hostname = "rotuer";
services.hostap = svc.hostapd { services.hostap = svc.hostapd.build {
interface = config.hardware.networkInterfaces.wlan_24; interface = config.hardware.networkInterfaces.wlan_24;
params = { params = {
ssid = "liminix"; ssid = "liminix";
@ -64,7 +64,7 @@ in rec {
} // wirelessConfig; } // wirelessConfig;
}; };
services.hostap5 = svc.hostapd { services.hostap5 = svc.hostapd.build {
interface = config.hardware.networkInterfaces.wlan_5; interface = config.hardware.networkInterfaces.wlan_5;
params = rec { params = rec {
ssid = "liminix_5"; ssid = "liminix_5";

View File

@ -1,13 +1,21 @@
{ lib, pkgs, config, ...}: { lib, pkgs, config, ...}:
let let
inherit (lib) mkOption types; inherit (lib) mkOption types;
inherit (pkgs) liminix;
in { in {
options = { options = {
system.service.hostapd = mkOption { system.service.hostapd = mkOption {
type = types.functionTo types.package; type = liminix.lib.types.serviceDefn;
}; };
}; };
config = { config = {
system.service.hostapd = pkgs.callPackage ./service.nix {}; system.service.hostapd = liminix.callService ./service.nix {
interface = mkOption {
type = liminix.lib.types.service;
};
params = mkOption {
type = types.attrs;
};
};
}; };
} }

View File

@ -4,6 +4,7 @@
, writeText , writeText
, lib , lib
}: }:
{ interface, params} :
let let
inherit (liminix.services) longrun; inherit (liminix.services) longrun;
inherit (lib) concatStringsSep mapAttrsToList; inherit (lib) concatStringsSep mapAttrsToList;
@ -16,19 +17,6 @@ let
# we'll add them as top-level attributes and rename params to # we'll add them as top-level attributes and rename params to
# extraParams # extraParams
t = {
interface = mkOption {
type = liminix.lib.types.service;
};
params = mkOption {
type = types.attrs;
};
};
in
args:
let
inherit (typeChecked "hostapd" t args)
interface params;
name = "${interface.device}.hostapd"; name = "${interface.device}.hostapd";
defaults = { defaults = {
driver = "nl80211"; driver = "nl80211";

View File

@ -10,7 +10,7 @@ in rec {
../../modules/hostapd ../../modules/hostapd
]; ];
services.hostap = config.system.service.hostapd { services.hostap = config.system.service.hostapd.build {
interface = config.hardware.networkInterfaces.wlan_24; interface = config.hardware.networkInterfaces.wlan_24;
params = { params = {
ssid = "liminix"; ssid = "liminix";