diff --git a/modules/system/boot/systemd.nix b/modules/system/boot/systemd.nix
index aa0b679ea2f5..2413509790d3 100644
--- a/modules/system/boot/systemd.nix
+++ b/modules/system/boot/systemd.nix
@@ -229,7 +229,8 @@ let
[Service]
Environment=PATH=${def.path}
- ${concatMapStrings (n: "Environment=${n}=${getAttr n def.environment}\n") (attrNames def.environment)}
+ ${let env = cfg.globalEnvironment // def.environment;
+ in concatMapStrings (n: "Environment=${n}=${getAttr n env}\n") (attrNames env)}
${optionalString (!def.restartIfChanged) "X-RestartIfChanged=false"}
${optionalString (def.preStart != "") ''
@@ -391,6 +392,15 @@ in
description = "Default unit started when the system boots.";
};
+ boot.systemd.globalEnvironment = mkOption {
+ type = types.attrs;
+ default = {};
+ example = { TZ = "CET"; };
+ description = ''
+ Environment variables passed to all systemd units.
+ '';
+ };
+
services.journald.console = mkOption {
default = "";
type = types.uniq types.string;
diff --git a/modules/system/upstart/upstart.nix b/modules/system/upstart/upstart.nix
index cfde1cc07538..44e6e8bb63b5 100644
--- a/modules/system/upstart/upstart.nix
+++ b/modules/system/upstart/upstart.nix
@@ -19,7 +19,7 @@ let
let
hasMain = job.script != "" || job.exec != "";
- env = config.system.upstartEnvironment // job.environment;
+ env = job.environment;
preStartScript = makeJobScript "${job.name}-pre-start"
''
@@ -270,15 +270,6 @@ in
options = [ jobOptions upstartJob ];
};
- system.upstartEnvironment = mkOption {
- type = types.attrs;
- default = {};
- example = { TZ = "CET"; };
- description = ''
- Environment variables passed to all Upstart jobs.
- '';
- };
-
};
diff --git a/modules/testing/test-instrumentation.nix b/modules/testing/test-instrumentation.nix
index c6c95e63af1b..8ceffbcb9ec6 100644
--- a/modules/testing/test-instrumentation.nix
+++ b/modules/testing/test-instrumentation.nix
@@ -55,10 +55,6 @@ let kernel = config.boot.kernelPackages.kernel; in
# Coverage data is written into /tmp/coverage-data.
mkdir -p /tmp/xchg/coverage-data
-
- # Mount debugfs to gain access to the kernel coverage data (if
- # available).
- mount -t debugfs none /sys/kernel/debug || true
'';
# If the kernel has been built with coverage instrumentation, make
@@ -80,7 +76,7 @@ let kernel = config.boot.kernelPackages.kernel; in
networking.defaultGateway = mkOverride 150 "";
networking.nameservers = mkOverride 150 [ ];
- system.upstartEnvironment.GCOV_PREFIX = "/tmp/xchg/coverage-data";
+ boot.systemd.globalEnvironment.GCOV_PREFIX = "/tmp/xchg/coverage-data";
system.requiredKernelConfig = with config.lib.kernelConfig; [
(isYes "SERIAL_8250_CONSOLE")