diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-07-30 10:28:05 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-07-30 10:28:05 +0200 |
commit | 9956b97b2f35a2cf87570e230abe0c5161d3944a (patch) | |
tree | 2212c3d65fcd81be640f1a43853dd1737dc3fa01 /nixos/modules/system | |
parent | 6479d6fea4e107019e3aa9f0606346260358f4a8 (diff) | |
download | nixlib-9956b97b2f35a2cf87570e230abe0c5161d3944a.tar nixlib-9956b97b2f35a2cf87570e230abe0c5161d3944a.tar.gz nixlib-9956b97b2f35a2cf87570e230abe0c5161d3944a.tar.bz2 nixlib-9956b97b2f35a2cf87570e230abe0c5161d3944a.tar.lz nixlib-9956b97b2f35a2cf87570e230abe0c5161d3944a.tar.xz nixlib-9956b97b2f35a2cf87570e230abe0c5161d3944a.tar.zst nixlib-9956b97b2f35a2cf87570e230abe0c5161d3944a.zip |
Check for systemd environment variables that are too long
Issue #3403. For the case of $PATH being too long, we could call buildEnv automatically.
Diffstat (limited to 'nixos/modules/system')
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 14caa5d360d5..777c1ea74d88 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -317,7 +317,9 @@ let '' [Service] ${let env = cfg.globalEnvironment // def.environment; - in concatMapStrings (n: "Environment=\"${n}=${getAttr n env}\"\n") (attrNames env)} + in concatMapStrings (n: + let s = "Environment=\"${n}=${getAttr n env}\"\n"; + in if stringLength s >= 2048 then throw "The value of the environment variable ‘${n}’ in systemd service ‘${name}.service’ is too long." else s) (attrNames env)} ${if def.reloadIfChanged then '' X-ReloadIfChanged=true '' else if !def.restartIfChanged then '' |