diff options
| author | Isabella Bastaja <isabella@sorre.xyz> | 2026-06-29 18:09:59 +0200 |
|---|---|---|
| committer | Isabella Bastaja <isabella@sorre.xyz> | 2026-06-30 16:13:35 +0200 |
| commit | 814b3399f355b645626cf03b0b6c45e37bc2bf8f (patch) | |
| tree | fc83c0911010e9ad0aa407b2506590141ecbf19e /share/nixos-modules/iwd-ext.nix | |
| parent | 0044c98c0abc4b7ec3c37db8816e58c385d94234 (diff) | |
iwd-ext: add extra config lines field
In order to add embeds which are non-standard ini I added an
extraConfigLines field. Then I also had to fix substution so that I can
use a literal '@' in the extra lines. Still not perfect, but works
just well enough for me to set up eduroam correctly for my uni.
Diffstat (limited to 'share/nixos-modules/iwd-ext.nix')
| -rw-r--r-- | share/nixos-modules/iwd-ext.nix | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/share/nixos-modules/iwd-ext.nix b/share/nixos-modules/iwd-ext.nix index 9aaae22..483b688 100644 --- a/share/nixos-modules/iwd-ext.nix +++ b/share/nixos-modules/iwd-ext.nix @@ -17,6 +17,7 @@ let inherit (pkgs) concatTextFile + writeText ; inherit (lib.strings) @@ -47,12 +48,16 @@ let let name = "${k}.${v.networkType}"; generatedConfig = ini.generate "${name}" v.config; + extraLinesFile = writeText "${name}-extra-lines" v.extraConfigLines; in { inherit name; value = concatTextFile { name = "${k}-network"; - files = [ generatedConfig ]; + files = [ + generatedConfig + extraLinesFile + ]; destination = "/var/lib/iwd/${name}"; }; } @@ -78,6 +83,11 @@ let ''; }; config = mkOption { type = ini.type; }; + extraConfigLines = mkOption { + type = types.lines; + default = ""; + description = "Extra lines to append to the network config verbatim."; + }; }; }; in @@ -204,7 +214,7 @@ in for f in ${networkTemplateDir}/var/lib/iwd/*; do cat "$f" | - sed -E 's/@([A-Za-z_][A-Za-z0-9_]*)@/$\{\1}/g' | + sed -E 's/@@/\x00/g; s/@([A-Za-z_][A-Za-z0-9_]*)@/$\{\1}/g; s/\x00/@/g' | envsubst > "$STATE_DIRECTORY/$(basename "$f")" done ''; |
