···592 systemd.services.systemd-importd.environment = proxy_env;
593 systemd.services.systemd-pstore.wantedBy = [ "sysinit.target" ]; # see #81138
594000000595 # Don't bother with certain units in containers.
596 systemd.services.systemd-remount-fs.unitConfig.ConditionVirtualization = "!container";
597 systemd.services.systemd-random-seed.unitConfig.ConditionVirtualization = "!container";
···592 systemd.services.systemd-importd.environment = proxy_env;
593 systemd.services.systemd-pstore.wantedBy = [ "sysinit.target" ]; # see #81138
594595+ # NixOS has kernel modules in a different location, so override that here.
596+ systemd.services.kmod-static-nodes.unitConfig.ConditionFileNotEmpty = [
597+ "" # required to unset the previous value!
598+ "/run/booted-system/kernel-modules/lib/modules/%v/modules.devname"
599+ ];
600+601 # Don't bother with certain units in containers.
602 systemd.services.systemd-remount-fs.unitConfig.ConditionVirtualization = "!container";
603 systemd.services.systemd-random-seed.unitConfig.ConditionVirtualization = "!container";
···1-From c8b50208dce4c467c1f85c3db3e05bdcfd43c378 Mon Sep 17 00:00:00 2001
2From: Eelco Dolstra <eelco.dolstra@logicblox.com>
3Date: Tue, 8 Jan 2013 15:46:30 +0100
4-Subject: [PATCH 01/18] Start device units for uninitialised encrypted devices
56This is necessary because the NixOS service that initialises the
7filesystem depends on the appearance of the device unit. Also, this
···27 # add symlink to GPT root disk
28 SUBSYSTEM=="block", ENV{ID_PART_GPT_AUTO_ROOT}=="1", ENV{ID_FS_TYPE}!="crypto_LUKS", SYMLINK+="gpt-auto-root"
29 SUBSYSTEM=="block", ENV{ID_PART_GPT_AUTO_ROOT}=="1", ENV{ID_FS_TYPE}=="crypto_LUKS", SYMLINK+="gpt-auto-root-luks"
30---
31-2.36.1
32-
···1+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Eelco Dolstra <eelco.dolstra@logicblox.com>
3Date: Tue, 8 Jan 2013 15:46:30 +0100
4+Subject: [PATCH] Start device units for uninitialised encrypted devices
56This is necessary because the NixOS service that initialises the
7filesystem depends on the appearance of the device unit. Also, this
···27 # add symlink to GPT root disk
28 SUBSYSTEM=="block", ENV{ID_PART_GPT_AUTO_ROOT}=="1", ENV{ID_FS_TYPE}!="crypto_LUKS", SYMLINK+="gpt-auto-root"
29 SUBSYSTEM=="block", ENV{ID_PART_GPT_AUTO_ROOT}=="1", ENV{ID_FS_TYPE}=="crypto_LUKS", SYMLINK+="gpt-auto-root-luks"
000
···1-From 67daf22c74a780e283a493a0f9fdbbea2ce0aaba Mon Sep 17 00:00:00 2001
2From: Eelco Dolstra <eelco.dolstra@logicblox.com>
3Date: Mon, 11 May 2015 15:39:38 +0200
4-Subject: [PATCH 06/18] Get rid of a useless message in user sessions
56Namely lots of variants of
7···2627 /* If stopping a unit fails continuously we might enter a stop loop here, hence stop acting on the
28 * service being unnecessary after a while. */
29---
30-2.36.1
31-
···1+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Eelco Dolstra <eelco.dolstra@logicblox.com>
3Date: Mon, 11 May 2015 15:39:38 +0200
4+Subject: [PATCH] Get rid of a useless message in user sessions
56Namely lots of variants of
7···2627 /* If stopping a unit fails continuously we might enter a stop loop here, hence stop acting on the
28 * service being unnecessary after a while. */
000
···1-From 35dd77fafe73cc4a648f101163945cbcae8ed6b9 Mon Sep 17 00:00:00 2001
2From: Imuli <i@imu.li>
3Date: Wed, 19 Oct 2016 08:46:47 -0400
4-Subject: [PATCH 10/18] localectl: use /etc/X11/xkb for list-x11-*
56NixOS has an option to link the xkb data files to /etc/X11, but not to
7/usr/share/X11.
···22 if (!f)
23 return log_error_errno(errno, "Failed to open keyboard mapping list. %m");
2425---
26-2.36.1
27-
···1+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Imuli <i@imu.li>
3Date: Wed, 19 Oct 2016 08:46:47 -0400
4+Subject: [PATCH] localectl: use /etc/X11/xkb for list-x11-*
56NixOS has an option to link the xkb data files to /etc/X11, but not to
7/usr/share/X11.
···22 if (!f)
23 return log_error_errno(errno, "Failed to open keyboard mapping list. %m");
24000
···1-From 201b588b4b30fb53aefaed43e5d434373a076cb0 Mon Sep 17 00:00:00 2001
2From: Andreas Rammhold <andreas@rammhold.de>
3Date: Thu, 9 May 2019 11:15:22 +0200
4-Subject: [PATCH 12/18] add rootprefix to lookup dir paths
56systemd does not longer use the UDEVLIBEXEC directory as root for
7discovery default udev rules. By adding `$out/lib` to the lookup paths
···3334 #define CONF_PATHS(n) \
35 CONF_PATHS_USR(n) \
36---
37-2.36.1
38-
···1+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Andreas Rammhold <andreas@rammhold.de>
3Date: Thu, 9 May 2019 11:15:22 +0200
4+Subject: [PATCH] add rootprefix to lookup dir paths
56systemd does not longer use the UDEVLIBEXEC directory as root for
7discovery default udev rules. By adding `$out/lib` to the lookup paths
···3334 #define CONF_PATHS(n) \
35 CONF_PATHS_USR(n) \
000
···1-From 67434c58caddf7dd3cef66dd3e3f704d39e4bcb0 Mon Sep 17 00:00:00 2001
2From: Nikolay Amiantov <ab@fmap.me>
3Date: Thu, 25 Jul 2019 20:45:55 +0300
4-Subject: [PATCH 13/18] systemd-shutdown: execute scripts in
5 /etc/systemd/system-shutdown
67This is needed for NixOS to use such scripts as systemd directory is immutable.
···2223 /* The log target defaults to console, but the original systemd process will pass its log target in through a
24 * command line argument, which will override this default. Also, ensure we'll never log to the journal or
25---
26-2.36.1
27-
···1+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Nikolay Amiantov <ab@fmap.me>
3Date: Thu, 25 Jul 2019 20:45:55 +0300
4+Subject: [PATCH] systemd-shutdown: execute scripts in
5 /etc/systemd/system-shutdown
67This is needed for NixOS to use such scripts as systemd directory is immutable.
···2223 /* The log target defaults to console, but the original systemd process will pass its log target in through a
24 * command line argument, which will override this default. Also, ensure we'll never log to the journal or
000
···1-From db1280d020e6d46a994240e755ce369d895322c5 Mon Sep 17 00:00:00 2001
2From: Nikolay Amiantov <ab@fmap.me>
3Date: Thu, 25 Jul 2019 20:46:58 +0300
4-Subject: [PATCH 14/18] systemd-sleep: execute scripts in
5- /etc/systemd/system-sleep
67This is needed for NixOS to use such scripts as systemd directory is immutable.
8---
···21 NULL
22 };
2324---
25-2.36.1
26-
···1+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Nikolay Amiantov <ab@fmap.me>
3Date: Thu, 25 Jul 2019 20:46:58 +0300
4+Subject: [PATCH] systemd-sleep: execute scripts in /etc/systemd/system-sleep
056This is needed for NixOS to use such scripts as systemd directory is immutable.
7---
···20 NULL
21 };
22000
···1-From 291ead07daab980fa39fd18512c8266c23161540 Mon Sep 17 00:00:00 2001
2From: Yuriy Taraday <yorik.sar@gmail.com>
3Date: Fri, 17 Jun 2022 12:45:10 +0000
4-Subject: [PATCH 18/18] inherit systemd environment when calling generators.
56Systemd generators need access to the environment configured in
7stage-2-init.sh since it schedules fsck and mkfs executions based on
···3738 r = strv_env_assign(&nl, "SYSTEMD_SCOPE", MANAGER_IS_SYSTEM(m) ? "system" : "user");
39 if (r < 0)
40---
41-2.36.1
42-
···1+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Yuriy Taraday <yorik.sar@gmail.com>
3Date: Fri, 17 Jun 2022 12:45:10 +0000
4+Subject: [PATCH] inherit systemd environment when calling generators.
56Systemd generators need access to the environment configured in
7stage-2-init.sh since it schedules fsck and mkfs executions based on
···3738 r = strv_env_assign(&nl, "SYSTEMD_SCOPE", MANAGER_IS_SYSTEM(m) ? "system" : "user");
39 if (r < 0)
000
+5-5
pkgs/os-specific/linux/systemd/default.nix
···149150 # On major changes, or when otherwise required, you *must* reformat the patches,
151 # `git am path/to/00*.patch` them into a systemd worktree, rebase to the more recent
152- # systemd version, and export the patches again via `git -c format.signoff=false format-patch v${version}`.
0153 # Use `find . -name "*.patch" | sort` to get an up-to-date listing of all patches
154 patches = [
155 ./0001-Start-device-units-for-uninitialised-encrypted-devic.patch
···166 ./0012-add-rootprefix-to-lookup-dir-paths.patch
167 ./0013-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch
168 ./0014-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch
169- ./0015-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch
170- ./0016-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch
171- ./0017-pkg-config-derive-prefix-from-prefix.patch
172- ./0018-inherit-systemd-environment-when-calling-generators.patch
173 ] ++ lib.optional stdenv.hostPlatform.isMusl (
174 let
175 oe-core = fetchzip {
···149150 # On major changes, or when otherwise required, you *must* reformat the patches,
151 # `git am path/to/00*.patch` them into a systemd worktree, rebase to the more recent
152+ # systemd version, and export the patches again via
153+ # `git -c format.signoff=false format-patch v${version} --no-numbered --zero-commit --no-signature`.
154 # Use `find . -name "*.patch" | sort` to get an up-to-date listing of all patches
155 patches = [
156 ./0001-Start-device-units-for-uninitialised-encrypted-devic.patch
···167 ./0012-add-rootprefix-to-lookup-dir-paths.patch
168 ./0013-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch
169 ./0014-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch
170+ ./0015-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch
171+ ./0016-pkg-config-derive-prefix-from-prefix.patch
172+ ./0017-inherit-systemd-environment-when-calling-generators.patch
0173 ] ++ lib.optional stdenv.hostPlatform.isMusl (
174 let
175 oe-core = fetchzip {