net: simplify the iwd psk setup

This commit is contained in:
colin 2023-01-07 03:10:39 +00:00
parent bb41fb95fe
commit cc9e2d8e15

View File

@ -31,18 +31,12 @@
General.RoamThreshold5G = "-52"; # default -76 General.RoamThreshold5G = "-52"; # default -76
}; };
sane.fs."/var/lib/iwd/.secrets.psk.stamp" = let sane.fs."/var/lib/iwd/.secrets.psk.stamp" = {
unwrapped = ../../scripts/install-iwd;
install-iwd = pkgs.writeShellApplication {
name = "install-iwd";
runtimeInputs = with pkgs; [ coreutils gnused ];
text = ''${unwrapped} "$@"'';
};
in {
wantedBeforeBy = [ "iwd.service" ]; wantedBeforeBy = [ "iwd.service" ];
generated.acl.mode = "0600"; generated.acl.mode = "0600";
generated.script.script = '' # XXX: install-iwd uses sed, but that's part of the default systemd unit path, it seems
${install-iwd}/bin/install-iwd "$@" && touch "/var/lib/iwd/.secrets.psk.stamp" generated.script.script = builtins.readFile ../../scripts/install-iwd + ''
touch "/var/lib/iwd/.secrets.psk.stamp"
''; '';
generated.script.scriptArgs = [ "/run/secrets/iwd" "/var/lib/iwd" ]; generated.script.scriptArgs = [ "/run/secrets/iwd" "/var/lib/iwd" ];
}; };