aboutsummaryrefslogtreecommitdiff
path: root/share/nixos-modules
diff options
context:
space:
mode:
Diffstat (limited to 'share/nixos-modules')
-rw-r--r--share/nixos-modules/iwd-ext.nix14
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
'';