chore: update modules from PRs

This commit is contained in:
oddlama 2023-04-06 00:57:00 +02:00
parent 5d095392cf
commit c01ee0f409
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
6 changed files with 36 additions and 52 deletions

View file

@ -1,4 +1,5 @@
{ {
lib,
config, config,
nodeSecrets, nodeSecrets,
... ...
@ -8,12 +9,8 @@
services.esphome = { services.esphome = {
enable = true; enable = true;
enableUnixSocket = true; enableUnixSocket = true;
allowedDevices = [ #allowedDevices = lib.mkForce ["/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0"];
{ # TODO instead deny the zigbee device
node = "/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0";
modifier = "rw";
}
];
}; };
systemd.services.nginx = { systemd.services.nginx = {

View file

@ -120,6 +120,7 @@ in {
''; '';
}; };
virtualHosts."${nodeSecrets.homeassistant.domain}" = { virtualHosts."${nodeSecrets.homeassistant.domain}" = {
serverAliases = ["192.168.1.21"]; # TODO remove later
forceSSL = true; forceSSL = true;
#enableACME = true; #enableACME = true;
sslCertificate = config.rekey.secrets."selfcert.crt".path; sslCertificate = config.rekey.secrets."selfcert.crt".path;

View file

@ -20,17 +20,23 @@
wifi4.capabilities = ["LDPC" "HT40+" "HT40-" "GF" "SHORT-GI-20" "SHORT-GI-40" "TX-STBC" "RX-STBC1"]; wifi4.capabilities = ["LDPC" "HT40+" "HT40-" "GF" "SHORT-GI-20" "SHORT-GI-40" "TX-STBC" "RX-STBC1"];
networks.wlan1 = { networks.wlan1 = {
inherit (nodeSecrets.hostapd) ssid; inherit (nodeSecrets.hostapd) ssid;
macAcl = "deny"; macAcl = "allow";
apIsolate = true; apIsolate = true;
authentication = { authentication = {
saePasswordsFile = config.rekey.secrets.wifi-clients.path; saePasswordsFile = config.rekey.secrets.wifi-clients.path;
saeAddToMacAllow = true; saeAddToMacAllow = true;
enableRecommendedPairwiseCiphers = true; enableRecommendedPairwiseCiphers = true;
}; };
extraConfig = ''
bssid=00:c0:ca:b1:4f:9e
'';
}; };
networks.wlan1-1 = { networks.testtest = {
ssid = "Open"; ssid = "Open";
authentication.mode = "none"; authentication.mode = "none";
extraConfig = ''
bssid=00:c0:ca:b1:4f:9f
'';
}; };
}; };
}; };

View file

@ -25,7 +25,7 @@
user = "zigbee2mqtt"; user = "zigbee2mqtt";
password = "!${config.rekey.secrets."mosquitto-pw-zigbee2mqtt.yaml".path} password"; password = "!${config.rekey.secrets."mosquitto-pw-zigbee2mqtt.yaml".path} password";
}; };
# TODO once > 1.30.2 is out # TODO once 1.30.3 is out
# frontend.host = "/run/zigbee2mqtt/zigbee2mqtt.sock"; # frontend.host = "/run/zigbee2mqtt/zigbee2mqtt.sock";
frontend.port = 8072; frontend.port = 8072;
}; };

View file

@ -61,37 +61,15 @@ in {
}; };
allowedDevices = mkOption { allowedDevices = mkOption {
default = []; default = ["char-ttyS" "char-ttyUSB"];
example = [ example = ["/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0"];
{
node = "/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0";
modifier = "rw";
}
];
description = lib.mdDoc '' description = lib.mdDoc ''
A list of device nodes to which {command}`esphome` has access to. A list of device nodes to which {command}`esphome` has access to.
Beware that permissions are not added dynamically when a device Refer to DeviceAllow in systemd.resource-control(5) for more information.
is plugged in while the service is already running. Beware that if a device is referred to by an absolute path instead of a device category,
it will only allow devices that already are plugged in when the service is started.
''; '';
type = types.listOf (types.submodule { type = types.listOf types.str;
options = {
node = mkOption {
example = "/dev/ttyUSB*";
type = types.str;
description = lib.mdDoc "Path to device node";
};
modifier = mkOption {
example = "rw";
type = types.str;
description = lib.mdDoc ''
Device node access modifier. Takes a combination
`r` (read), `w` (write), and `m` (mknod). See the
`systemd.resource-control(5)` man page for more
information.
'';
};
};
});
}; };
}; };
@ -103,6 +81,8 @@ in {
after = ["network.target"]; after = ["network.target"];
wantedBy = ["multi-user.target"]; wantedBy = ["multi-user.target"];
path = [cfg.package]; path = [cfg.package];
# platformio fails to determine the home directory when using DynamicUser
environment.PLATFORMIO_CORE_DIR = "${stateDir}/.platformio"; environment.PLATFORMIO_CORE_DIR = "${stateDir}/.platformio";
serviceConfig = { serviceConfig = {
@ -122,11 +102,11 @@ in {
LockPersonality = true; LockPersonality = true;
MemoryDenyWriteExecute = true; MemoryDenyWriteExecute = true;
DevicePolicy = "closed"; DevicePolicy = "closed";
DeviceAllow = map (d: "${d.node} ${d.modifier}") cfg.allowedDevices; DeviceAllow = map (d: "${d} rw") cfg.allowedDevices;
SupplementaryGroups = ["dialout"]; SupplementaryGroups = ["dialout"];
NoNewPrivileges = true; #NoNewPrivileges = true; # Implied by DynamicUser
PrivateUsers = true; PrivateUsers = true;
PrivateTmp = true; #PrivateTmp = true; # Implied by DynamicUser
ProtectClock = true; ProtectClock = true;
ProtectControlGroups = true; ProtectControlGroups = true;
ProtectHome = true; ProtectHome = true;
@ -137,7 +117,7 @@ in {
ProtectProc = "invisible"; ProtectProc = "invisible";
ProcSubset = "pid"; ProcSubset = "pid";
ProtectSystem = "strict"; ProtectSystem = "strict";
RemoveIPC = true; #RemoveIPC = true; # Implied by DynamicUser
RestrictAddressFamilies = [ RestrictAddressFamilies = [
"AF_INET" "AF_INET"
"AF_INET6" "AF_INET6"
@ -146,7 +126,7 @@ in {
]; ];
RestrictNamespaces = false; # Required by platformio for chroot RestrictNamespaces = false; # Required by platformio for chroot
RestrictRealtime = true; RestrictRealtime = true;
RestrictSUIDSGID = true; #RestrictSUIDSGID = true; # Implied by DynamicUser
SystemCallArchitectures = "native"; SystemCallArchitectures = "native";
SystemCallFilter = [ SystemCallFilter = [
"@system-service" "@system-service"

View file

@ -149,19 +149,19 @@ let
channel=${toString radioCfg.channel} channel=${toString radioCfg.channel}
noscan=${bool01 radioCfg.noScan} noscan=${bool01 radioCfg.noScan}
##### IEEE 802.11n (WiFi 4) related configuration #######################################
ieee80211n=${bool01 radioCfg.wifi4.enable}
${optionalString radioCfg.wifi4.enable '' ${optionalString radioCfg.wifi4.enable ''
##### IEEE 802.11n (WiFi 4) related configuration #######################################
ieee80211n=1
${optionalString radioCfg.wifi4.require "require_ht=1"}
ht_capab=${concatMapStrings (x: "[${x}]") radioCfg.wifi4.capabilities} ht_capab=${concatMapStrings (x: "[${x}]") radioCfg.wifi4.capabilities}
require_ht=${bool01 radioCfg.wifi4.require}
''} ''}
##### IEEE 802.11ac (WiFi 5) related configuration #####################################
ieee80211ac=${bool01 radioCfg.wifi5.enable}
${optionalString radioCfg.wifi5.enable '' ${optionalString radioCfg.wifi5.enable ''
vht_capab=${concatMapStrings (x: "[${x}]") radioCfg.wifi5.capabilities} ##### IEEE 802.11ac (WiFi 5) related configuration #####################################
require_vht=${bool01 radioCfg.wifi5.require} ieee80211ac=1
${optionalString radioCfg.wifi5.require "require_vht=1"}
vht_oper_chwidth=${radioCfg.wifi5.operatingChannelWidth} vht_oper_chwidth=${radioCfg.wifi5.operatingChannelWidth}
vht_capab=${concatMapStrings (x: "[${x}]") radioCfg.wifi5.capabilities}
''} ''}
${ # ieee80211ax support must be enabled in hostapd, ${ # ieee80211ax support must be enabled in hostapd,
@ -169,7 +169,7 @@ let
optionalString radioCfg.wifi6.enable '' optionalString radioCfg.wifi6.enable ''
##### IEEE 802.11ax (WiFi 6) related configuration ##################################### ##### IEEE 802.11ax (WiFi 6) related configuration #####################################
ieee80211ax=1 ieee80211ax=1
require_he=${bool01 radioCfg.wifi6.require} ${optionalString radioCfg.wifi6.require "require_he=1"}
he_oper_chwidth=${radioCfg.wifi6.operatingChannelWidth} he_oper_chwidth=${radioCfg.wifi6.operatingChannelWidth}
he_su_beamformer=${bool01 radioCfg.wifi6.singleUserBeamformer} he_su_beamformer=${bool01 radioCfg.wifi6.singleUserBeamformer}
he_su_beamformee=${bool01 radioCfg.wifi6.singleUserBeamformee} he_su_beamformee=${bool01 radioCfg.wifi6.singleUserBeamformee}
@ -203,7 +203,7 @@ let
##### User-provided extra radio configuration ########################################## ##### User-provided extra radio configuration ##########################################
EOF EOF
cat ${escapeShellArg (pkgs.writeText radioCfg.extraConfig)} >> "$hostapd_config_file" cat ${escapeShellArg (pkgs.writeText "hostapd-radio-${radio}-extra.conf" radioCfg.extraConfig)} >> "$hostapd_config_file"
''} ''}
'' ''
+ concatStringsSep "\n" (imap0 (i: f: f i) (mapAttrsToList ( + concatStringsSep "\n" (imap0 (i: f: f i) (mapAttrsToList (
@ -274,7 +274,7 @@ let
##### User-provided extra BSS configuration ########################################## ##### User-provided extra BSS configuration ##########################################
EOF EOF
cat ${escapeShellArg (pkgs.writeText bssCfg.extraConfig)} >> "$hostapd_config_file" cat ${escapeShellArg (pkgs.writeText "hostapd-radio-${radio}-bss-${bss}-extra.conf" bssCfg.extraConfig)} >> "$hostapd_config_file"
'' ''
) )
) )