diff --git a/pkgs/os-specific/linux/systemd/reexec.patch b/pkgs/os-specific/linux/systemd/0001-Make-systemctl-daemon-reexec-do-the-right-thing-on-N.patch similarity index 57% rename from pkgs/os-specific/linux/systemd/reexec.patch rename to pkgs/os-specific/linux/systemd/0001-Make-systemctl-daemon-reexec-do-the-right-thing-on-N.patch index ff13a44ca0b2..dda9bea7674c 100644 --- a/pkgs/os-specific/linux/systemd/reexec.patch +++ b/pkgs/os-specific/linux/systemd/0001-Make-systemctl-daemon-reexec-do-the-right-thing-on-N.patch @@ -1,10 +1,18 @@ -Make "systemctl daemon-reexec" do the right thing on NixOS. +From 0085f49cd0ba889e3db9102f328f6044ae3a2c18 Mon Sep 17 00:00:00 2001 +From: Eelco Dolstra +Date: Tue, 8 Jan 2013 15:44:33 +0100 +Subject: [PATCH 1/5] Make "systemctl daemon-reexec" do the right thing on + NixOS + +--- + src/core/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/main.c b/src/core/main.c -index 04fc0b3..0f5b0e9 100644 +index 1ee3c9c..1686f60 100644 --- a/src/core/main.c +++ b/src/core/main.c -@@ -1819,7 +1819,7 @@ finish: +@@ -1858,7 +1858,7 @@ finish: char_array_0(sfd); i = 0; @@ -13,3 +21,6 @@ index 04fc0b3..0f5b0e9 100644 if (switch_root_dir) args[i++] = "--switched-root"; args[i++] = arg_running_as == SYSTEMD_SYSTEM ? "--system" : "--user"; +-- +1.8.0.1 + diff --git a/pkgs/os-specific/linux/systemd/ignore-duplicates.patch b/pkgs/os-specific/linux/systemd/0002-Ignore-duplicate-paths-in-systemctl-start.patch similarity index 58% rename from pkgs/os-specific/linux/systemd/ignore-duplicates.patch rename to pkgs/os-specific/linux/systemd/0002-Ignore-duplicate-paths-in-systemctl-start.patch index 764eead54eac..14795e521112 100644 --- a/pkgs/os-specific/linux/systemd/ignore-duplicates.patch +++ b/pkgs/os-specific/linux/systemd/0002-Ignore-duplicate-paths-in-systemctl-start.patch @@ -1,10 +1,17 @@ -Ignore duplicate paths in "systemctl start". +From 2b0a9106d3aabb365af0cc34b595a1e697120f37 Mon Sep 17 00:00:00 2001 +From: Eelco Dolstra +Date: Tue, 8 Jan 2013 15:45:01 +0100 +Subject: [PATCH 2/5] Ignore duplicate paths in "systemctl start" + +--- + src/systemctl/systemctl.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c -index a4290c4..d3ac3ad 100644 +index 2ebfff8..9f99df5 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c -@@ -1596,8 +1596,11 @@ static int start_unit_one( +@@ -1591,8 +1591,11 @@ static int start_unit_one( r = set_put(s, p); if (r < 0) { @@ -18,3 +25,6 @@ index a4290c4..d3ac3ad 100644 } p = NULL; +-- +1.8.0.1 + diff --git a/pkgs/os-specific/linux/systemd/crypt-devices-are-ready.patch b/pkgs/os-specific/linux/systemd/0003-Start-device-units-for-uninitialised-encrypted-devic.patch similarity index 58% rename from pkgs/os-specific/linux/systemd/crypt-devices-are-ready.patch rename to pkgs/os-specific/linux/systemd/0003-Start-device-units-for-uninitialised-encrypted-devic.patch index 4646ed0e44ca..63de58f97d5a 100644 --- a/pkgs/os-specific/linux/systemd/crypt-devices-are-ready.patch +++ b/pkgs/os-specific/linux/systemd/0003-Start-device-units-for-uninitialised-encrypted-devic.patch @@ -1,9 +1,16 @@ -Do start device units for uninitialised encrypted devices, because the -service that initialises the filesystem depends on the appearance of -the device unit. Also, this makes more sense to me: the device is -ready; it's the filesystem that's not, but taking care of that is the -responsibility of the mount unit. (However, this ignores the fsck -unit, so it's not perfect...) +From a013beb84f135cebf1c8c9363d5676c1c0a6be7a Mon Sep 17 00:00:00 2001 +From: Eelco Dolstra +Date: Tue, 8 Jan 2013 15:46:30 +0100 +Subject: [PATCH 3/5] Start device units for uninitialised encrypted devices + +This is necessary because the NixOS service that initialises the +filesystem depends on the appearance of the device unit. Also, this +makes more sense to me: the device is ready; it's the filesystem +that's not, but taking care of that is the responsibility of the mount +unit. (However, this ignores the fsck unit, so it's not perfect...) +--- + rules/99-systemd.rules.in | 4 ---- + 1 file changed, 4 deletions(-) diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in index d17bdd9..040b10e 100644 @@ -20,3 +27,6 @@ index d17bdd9..040b10e 100644 # Ignore raid devices that are not yet assembled and started SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", TEST!="md/array_state", ENV{SYSTEMD_READY}="0" SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0" +-- +1.8.0.1 + diff --git a/pkgs/os-specific/linux/systemd/0004-Set-switch-to-configuration-hints-for-some-units.patch b/pkgs/os-specific/linux/systemd/0004-Set-switch-to-configuration-hints-for-some-units.patch new file mode 100644 index 000000000000..f819d1640e83 --- /dev/null +++ b/pkgs/os-specific/linux/systemd/0004-Set-switch-to-configuration-hints-for-some-units.patch @@ -0,0 +1,74 @@ +From b40d8783f94666035baae567882c0d4be82cda01 Mon Sep 17 00:00:00 2001 +From: Eelco Dolstra +Date: Tue, 8 Jan 2013 15:48:19 +0100 +Subject: [PATCH 4/5] Set switch-to-configuration hints for some units +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Target units like local-fs.target need ‘X-StopOnReconfiguration=yes’ +to ensure dependencies *on* that target properly take into account the +dependencies *of* the target. + +‘X-RestartIfChanged=no’ is necessary for systemd-journald.service +because restarting it causes services connected to journald to stop +logging. + +‘X-RestartIfChanged=no’ is necessary for systemd-user-sessions.service +to prevent all user sessions from being killed when this unit changes. +--- + units/local-fs.target | 2 ++ + units/remote-fs.target | 2 ++ + units/systemd-journald.service.in | 5 +++++ + units/systemd-user-sessions.service.in | 3 +++ + 4 files changed, 12 insertions(+) + +diff --git a/units/local-fs.target b/units/local-fs.target +index dd92b17..dfcbc7b 100644 +--- a/units/local-fs.target ++++ b/units/local-fs.target +@@ -10,3 +10,5 @@ Description=Local File Systems + Documentation=man:systemd.special(7) + OnFailure=emergency.target + OnFailureIsolate=yes ++ ++X-StopOnReconfiguration=yes +diff --git a/units/remote-fs.target b/units/remote-fs.target +index 9e68878..85a53d7 100644 +--- a/units/remote-fs.target ++++ b/units/remote-fs.target +@@ -9,5 +9,7 @@ + Description=Remote File Systems + Documentation=man:systemd.special(7) + ++X-StopOnReconfiguration=yes ++ + [Install] + WantedBy=multi-user.target +diff --git a/units/systemd-journald.service.in b/units/systemd-journald.service.in +index ab2e50c..9563a7d 100644 +--- a/units/systemd-journald.service.in ++++ b/units/systemd-journald.service.in +@@ -24,3 +24,8 @@ CapabilityBoundingSet=CAP_SYS_ADMIN CAP_DAC_OVERRIDE CAP_SYS_PTRACE CAP_SYSLOG C + # Increase the default a bit in order to allow many simultaneous + # services being run since we keep one fd open per service. + LimitNOFILE=16384 ++ ++# Don't restart journald, since that causes services connected to ++# journald to stop logging (see ++# https://bugs.freedesktop.org/show_bug.cgi?id=56043). ++X-RestartIfChanged=no +diff --git a/units/systemd-user-sessions.service.in b/units/systemd-user-sessions.service.in +index 0869e73..b6ed958 100644 +--- a/units/systemd-user-sessions.service.in ++++ b/units/systemd-user-sessions.service.in +@@ -15,3 +15,6 @@ Type=oneshot + RemainAfterExit=yes + ExecStart=@rootlibexecdir@/systemd-user-sessions start + ExecStop=@rootlibexecdir@/systemd-user-sessions stop ++ ++# Restart kills all active sessions. ++X-RestartIfChanged=no +-- +1.8.0.1 + diff --git a/pkgs/os-specific/linux/systemd/0005-sysinit.target-Drop-the-dependency-on-local-fs.targe.patch b/pkgs/os-specific/linux/systemd/0005-sysinit.target-Drop-the-dependency-on-local-fs.targe.patch new file mode 100644 index 000000000000..54009f2e7fc7 --- /dev/null +++ b/pkgs/os-specific/linux/systemd/0005-sysinit.target-Drop-the-dependency-on-local-fs.targe.patch @@ -0,0 +1,33 @@ +From c5c8ac3a0420fb42ba2f629368fd5bd6ea1e753b Mon Sep 17 00:00:00 2001 +From: Eelco Dolstra +Date: Tue, 8 Jan 2013 15:56:03 +0100 +Subject: [PATCH 5/5] sysinit.target: Drop the dependency on local-fs.target + and swap.target + +Having all services with DefaultDependencies=yes depend on +local-fs.target is annoying, because some of those services might be +necessary to mount local filesystems. For instance, Charon's +send-keys feature requires sshd to be running in order to receive LUKS +encryption keys, which in turn requires dhcpcd, and so on. So we drop +this dependency (and swap.target as well for consistency). If +services require a specific mount, they should use RequiresMountsFor +in any case. +--- + units/sysinit.target | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/units/sysinit.target b/units/sysinit.target +index 8f4fb8f..e0f0147 100644 +--- a/units/sysinit.target ++++ b/units/sysinit.target +@@ -9,6 +9,5 @@ + Description=System Initialization + Documentation=man:systemd.special(7) + Conflicts=emergency.service emergency.target +-Wants=local-fs.target swap.target +-After=local-fs.target swap.target emergency.service emergency.target ++After=emergency.service emergency.target + RefuseManualStart=yes +-- +1.8.0.1 + diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index bab65600da64..975a37fffce0 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -14,9 +14,11 @@ stdenv.mkDerivation rec { }; patches = - [ ./reexec.patch - ./ignore-duplicates.patch - ./crypt-devices-are-ready.patch + [ ./0001-Make-systemctl-daemon-reexec-do-the-right-thing-on-N.patch + ./0002-Ignore-duplicate-paths-in-systemctl-start.patch + ./0003-Start-device-units-for-uninitialised-encrypted-devic.patch + ./0004-Set-switch-to-configuration-hints-for-some-units.patch + ./0005-sysinit.target-Drop-the-dependency-on-local-fs.targe.patch ]; buildInputs =