From 814b3399f355b645626cf03b0b6c45e37bc2bf8f Mon Sep 17 00:00:00 2001 From: Isabella Bastaja Date: Mon, 29 Jun 2026 18:09:59 +0200 Subject: 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. --- share/nixos-modules/iwd-ext.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'share/nixos-modules') 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 ''; -- cgit v1.3.1