···1-From d4ea219a35a09fe02bc9e47e8530644cb4fc4146 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/21] 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
···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.33.0
32
···1+From 93b2d29de784c68d1b4d70d7f214b19432aec6a8 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/19] 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
···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.33.1
32
···1-From da4f855044b2babe052ce303cca1de736cf952cd Mon Sep 17 00:00:00 2001
2From: Eelco Dolstra <eelco.dolstra@logicblox.com>
3Date: Fri, 19 Dec 2014 14:46:17 +0100
4-Subject: [PATCH 05/21] Add some NixOS-specific unit directories
56Look in `/nix/var/nix/profiles/default/lib/systemd/{system,user}` for
7units provided by packages installed into the default profile via
···122123 systemd_sleep_dir=${root_prefix}/lib/systemd/system-sleep
124--
125-2.33.0
126
···1+From ddcfae6de8c460903c5db8c536ffeb5771e976f8 Mon Sep 17 00:00:00 2001
2From: Eelco Dolstra <eelco.dolstra@logicblox.com>
3Date: Fri, 19 Dec 2014 14:46:17 +0100
4+Subject: [PATCH 05/19] Add some NixOS-specific unit directories
56Look in `/nix/var/nix/profiles/default/lib/systemd/{system,user}` for
7units provided by packages installed into the default profile via
···122123 systemd_sleep_dir=${root_prefix}/lib/systemd/system-sleep
124--
125+2.33.1
126
···1-From c06abdb631527f56a626b739340d1b275349612c 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/21] Get rid of a useless message in user sessions
56Namely lots of variants of
7···27 /* 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.33.0
31
···1+From b39b8871bcaa07280d6b0cf2226b1a3be31232b8 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/19] Get rid of a useless message in user sessions
56Namely lots of variants of
7···27 /* 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.33.1
31
···1-From 75d12cf65073458f091899d673c613dfc43f60c0 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/21] 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.
···23 return log_error_errno(errno, "Failed to open keyboard mapping list. %m");
2425--
26-2.33.0
27
···1+From f4e9304560ad42eeb8d42be583cc55eb2e5b4bb1 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/19] 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.
···23 return log_error_errno(errno, "Failed to open keyboard mapping list. %m");
2425--
26+2.33.1
27
···1-From ecdf0c5d9f88f526521f093cc9ee85f43efab4b7 Mon Sep 17 00:00:00 2001
2From: Andreas Rammhold <andreas@rammhold.de>
3Date: Fri, 2 Nov 2018 21:15:42 +0100
4-Subject: [PATCH 12/21] 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
···4041 finish:
42--
43-2.33.0
44
···1+From 7ea935a5ac4f31106ce9347227d4eb59b77b02cd Mon Sep 17 00:00:00 2001
2From: Andreas Rammhold <andreas@rammhold.de>
3Date: Fri, 2 Nov 2018 21:15:42 +0100
4+Subject: [PATCH 12/19] 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
···4041 finish:
42--
43+2.33.1
44
···1-From 39969a1b01d6c223a21c770093209b7f4047aaa4 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 13/21] 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
···34 #define CONF_PATHS(n) \
35 CONF_PATHS_USR(n) \
36--
37-2.33.0
38
···1+From eb93778af78a127e8e20d6ed7fd9f91fd22dc7c9 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 13/19] 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
···34 #define CONF_PATHS(n) \
35 CONF_PATHS_USR(n) \
36--
37+2.33.1
38
···1-From e7c960789b0ca97b24a66e9eeaa56ea645d9c66b 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 14/21] systemd-shutdown: execute scripts in
5 /etc/systemd/system-shutdown
67This is needed for NixOS to use such scripts as systemd directory is immutable.
···23 /* 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.33.0
27
···1+From 1d623def80a3532ac1445499c9d4673e21ae8195 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 14/19] systemd-shutdown: execute scripts in
5 /etc/systemd/system-shutdown
67This is needed for NixOS to use such scripts as systemd directory is immutable.
···23 /* 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.33.1
27
···1-From 7654964344ba083529cb232ab229db7c0888f782 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
3Date: Sun, 6 Dec 2020 08:34:19 +0100
4-Subject: [PATCH 18/21] pkg-config: derive prefix from --prefix
56Point prefix to the one configured, instead of `/usr` `systemd` has limited
7support for making the pkgconfig prefix overridable, and interpolates those
···29 rootprefix=${root_prefix}
30 sysconf_dir={{SYSCONF_DIR}}
31--
32-2.33.0
33
···1+From 50f2ada6cbfafa75b628410e8834f29581854e6f Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
3Date: Sun, 6 Dec 2020 08:34:19 +0100
4+Subject: [PATCH 18/19] pkg-config: derive prefix from --prefix
56Point prefix to the one configured, instead of `/usr` `systemd` has limited
7support for making the pkgconfig prefix overridable, and interpolates those
···29 rootprefix=${root_prefix}
30 sysconf_dir={{SYSCONF_DIR}}
31--
32+2.33.1
33
···1-From 4e9b4aa87d299be08cffc77a86d6f473a7a4109a Mon Sep 17 00:00:00 2001
2From: Andreas Rammhold <andreas@rammhold.de>
3Date: Wed, 18 Aug 2021 19:10:08 +0200
4-Subject: [PATCH 19/21] core: handle lookup paths being symlinks
56With a recent change paths leaving the statically known lookup paths
7would be treated differently then those that remained within those. That
···76 log_debug("%s: linked unit file: %s → %s",
77 __func__, filename, simplified);
78--
79-2.33.0
80
···1+From 2ab388cf0be320879e668a6206cb15d002b55f98 Mon Sep 17 00:00:00 2001
2From: Andreas Rammhold <andreas@rammhold.de>
3Date: Wed, 18 Aug 2021 19:10:08 +0200
4+Subject: [PATCH 19/19] core: handle lookup paths being symlinks
56With a recent change paths leaving the statically known lookup paths
7would be treated differently then those that remained within those. That
···76 log_debug("%s: linked unit file: %s → %s",
77 __func__, filename, simplified);
78--
79+2.33.1
80
···122assert withCryptsetup -> (cryptsetup != null);
123let
124 wantCurl = withRemote || withImportd;
125- version = "249.5";
126in
127stdenv.mkDerivation {
128 inherit pname version;
···133 owner = "systemd";
134 repo = "systemd-stable";
135 rev = "v${version}";
136- sha256 = "0bir2syy20rdi59sv8xp8nw1c92zl9z0wmv7ggsll8dca7niqwbp";
137 };
138139 # If these need to be regenerated, `git am path/to/00*.patch` them into a
···165 # systemd. With the below patch we mitigate that effect by special casing
166 # all our root unit dirs if they are symlinks. This does exactly what we
167 # need (AFAICT).
0168 ./0019-core-handle-lookup-paths-being-symlinks.patch
169-170- # In v248 compiler weirdness and refactoring lead to the bootloader
171- # erroring out handling keyboard input on some systems. See
172- # https://github.com/systemd/systemd/issues/19191
173- # This should be redundant in v249.6 when it offically gets tagged in
174- # systemd-stable
175- ./0020-sd-boot-Unify-error-handling.patch
176- ./0021-sd-boot-Rework-console-input-handling.patch
177 ] ++ lib.optional stdenv.hostPlatform.isMusl (let
178 oe-core = fetchzip {
179 url = "https://git.openembedded.org/openembedded-core/snapshot/openembedded-core-14c6e5a4b72d0e4665279158a0740dd1dc21f72f.tar.bz2";
···583 '';
584585 postInstall = ''
586- # sysinit.target: Don't depend on
587- # systemd-tmpfiles-setup.service. This interferes with NixOps's
588- # send-keys feature (since sshd.service depends indirectly on
589- # sysinit.target).
590- mv $out/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service $out/lib/systemd/system/multi-user.target.wants/
591-592 mkdir -p $out/example/systemd
593 mv $out/lib/{modules-load.d,binfmt.d,sysctl.d,tmpfiles.d} $out/example
594 mv $out/lib/systemd/{system,user} $out/example/systemd
···122assert withCryptsetup -> (cryptsetup != null);
123let
124 wantCurl = withRemote || withImportd;
125+ version = "249.7";
126in
127stdenv.mkDerivation {
128 inherit pname version;
···133 owner = "systemd";
134 repo = "systemd-stable";
135 rev = "v${version}";
136+ sha256 = "sha256-y33/BvvI+JyhsvuT1Cbm6J2Z72j71oXgLw6X9NwCMPE=";
137 };
138139 # If these need to be regenerated, `git am path/to/00*.patch` them into a
···165 # systemd. With the below patch we mitigate that effect by special casing
166 # all our root unit dirs if they are symlinks. This does exactly what we
167 # need (AFAICT).
168+ # See https://github.com/systemd/systemd/pull/20479 for upsteam discussion.
169 ./0019-core-handle-lookup-paths-being-symlinks.patch
00000000170 ] ++ lib.optional stdenv.hostPlatform.isMusl (let
171 oe-core = fetchzip {
172 url = "https://git.openembedded.org/openembedded-core/snapshot/openembedded-core-14c6e5a4b72d0e4665279158a0740dd1dc21f72f.tar.bz2";
···576 '';
577578 postInstall = ''
000000579 mkdir -p $out/example/systemd
580 mv $out/lib/{modules-load.d,binfmt.d,sysctl.d,tmpfiles.d} $out/example
581 mv $out/lib/systemd/{system,user} $out/example/systemd