summary refs log tree commit diff
diff options
context:
space:
mode:
authorJaka Hudoklin <jakahudoklin@gmail.com>2014-12-07 21:44:20 +0100
committerJaka Hudoklin <jakahudoklin@gmail.com>2014-12-07 21:44:20 +0100
commit8bb6fdc4f9c9bd6f61a62dfd57180d394ced6fc8 (patch)
treefffffa91c5e89d22b3fe246880b06f19fa53b533
parentad4ad11fbc8871811d65d0b2427fd4bc38e54a14 (diff)
downloadnixlib-8bb6fdc4f9c9bd6f61a62dfd57180d394ced6fc8.tar
nixlib-8bb6fdc4f9c9bd6f61a62dfd57180d394ced6fc8.tar.gz
nixlib-8bb6fdc4f9c9bd6f61a62dfd57180d394ced6fc8.tar.bz2
nixlib-8bb6fdc4f9c9bd6f61a62dfd57180d394ced6fc8.tar.lz
nixlib-8bb6fdc4f9c9bd6f61a62dfd57180d394ced6fc8.tar.xz
nixlib-8bb6fdc4f9c9bd6f61a62dfd57180d394ced6fc8.tar.zst
nixlib-8bb6fdc4f9c9bd6f61a62dfd57180d394ced6fc8.zip
nixos/systemd: ignore null environment options
-rw-r--r--nixos/modules/system/boot/systemd.nix3
1 files changed, 2 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 78fe8c49fb05..05f8c8009bfd 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -348,7 +348,8 @@ let
           [Service]
           ${let env = cfg.globalEnvironment // def.environment;
             in concatMapStrings (n:
-              let s = "Environment=\"${n}=${env.${n}}\"\n";
+              let s = optionalString (env."${n}" != null)
+                "Environment=\"${n}=${env.${n}}\"\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