From a14d1a2e7e8c19087897bc646a37f50096b736b1 Mon Sep 17 00:00:00 2001 From: Jörg Thalheim Date: Thu, 30 Jun 2022 09:46:32 +0200 Subject: systemd: 250.4 -> 251.3 --- ...e-units-for-uninitialised-encrypted-devic.patch | 6 +- ...002-Don-t-try-to-unmount-nix-or-nix-store.patch | 10 +-- .../linux/systemd/0003-Fix-NixOS-containers.patch | 16 ++--- .../0004-Look-for-fsck-in-the-right-place.patch | 6 +- ...-Add-some-NixOS-specific-unit-directories.patch | 22 +++--- ...rid-of-a-useless-message-in-user-sessions.patch | 10 +-- ...ocaled-timedated-disable-methods-that-cha.patch | 26 +++---- .../linux/systemd/0008-Fix-hwdb-paths.patch | 10 +-- ...Change-usr-share-zoneinfo-to-etc-zoneinfo.patch | 30 ++++---- ...10-localectl-use-etc-X11-xkb-for-list-x11.patch | 10 +-- ...-create-statedir-and-don-t-touch-prefixdi.patch | 10 +-- .../0012-add-rootprefix-to-lookup-dir-paths.patch | 38 ++++++++++ ...stemd-environment-when-calling-generators.patch | 44 ------------ .../0013-add-rootprefix-to-lookup-dir-paths.patch | 38 ---------- ...tdown-execute-scripts-in-etc-systemd-syst.patch | 27 ++++++++ ...tdown-execute-scripts-in-etc-systemd-syst.patch | 27 -------- ...ep-execute-scripts-in-etc-systemd-system-.patch | 26 +++++++ ...-nodes.service-Update-ConditionFileNotEmp.patch | 27 ++++++++ ...ep-execute-scripts-in-etc-systemd-system-.patch | 26 ------- ...-nodes.service-Update-ConditionFileNotEmp.patch | 27 -------- ...h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch | 33 +++++++++ ...h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch | 33 --------- ...0017-pkg-config-derive-prefix-from-prefix.patch | 33 +++++++++ ...stemd-environment-when-calling-generators.patch | 42 ++++++++++++ ...0018-pkg-config-derive-prefix-from-prefix.patch | 33 --------- ...9-core-handle-lookup-paths-being-symlinks.patch | 80 ---------------------- pkgs/os-specific/linux/systemd/default.nix | 73 ++++++++++---------- 27 files changed, 340 insertions(+), 423 deletions(-) create mode 100644 pkgs/os-specific/linux/systemd/0012-add-rootprefix-to-lookup-dir-paths.patch delete mode 100644 pkgs/os-specific/linux/systemd/0012-inherit-systemd-environment-when-calling-generators.patch delete mode 100644 pkgs/os-specific/linux/systemd/0013-add-rootprefix-to-lookup-dir-paths.patch create mode 100644 pkgs/os-specific/linux/systemd/0013-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch delete mode 100644 pkgs/os-specific/linux/systemd/0014-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch create mode 100644 pkgs/os-specific/linux/systemd/0014-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch create mode 100644 pkgs/os-specific/linux/systemd/0015-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch delete mode 100644 pkgs/os-specific/linux/systemd/0015-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch delete mode 100644 pkgs/os-specific/linux/systemd/0016-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch create mode 100644 pkgs/os-specific/linux/systemd/0016-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch delete mode 100644 pkgs/os-specific/linux/systemd/0017-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch create mode 100644 pkgs/os-specific/linux/systemd/0017-pkg-config-derive-prefix-from-prefix.patch create mode 100644 pkgs/os-specific/linux/systemd/0018-inherit-systemd-environment-when-calling-generators.patch delete mode 100644 pkgs/os-specific/linux/systemd/0018-pkg-config-derive-prefix-from-prefix.patch delete mode 100644 pkgs/os-specific/linux/systemd/0019-core-handle-lookup-paths-being-symlinks.patch diff --git a/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch b/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch index 404b0d2ee6f..4b11aa1b136 100644 --- a/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch +++ b/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch @@ -1,7 +1,7 @@ -From 8622539fe2ce67934ed2e60626a2303ef8191e40 Mon Sep 17 00:00:00 2001 +From c8b50208dce4c467c1f85c3db3e05bdcfd43c378 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 8 Jan 2013 15:46:30 +0100 -Subject: [PATCH 01/19] Start device units for uninitialised encrypted devices +Subject: [PATCH 01/18] 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 @@ -28,5 +28,5 @@ index 25b8a590a6..d18999ea87 100644 SUBSYSTEM=="block", ENV{ID_PART_GPT_AUTO_ROOT}=="1", ENV{ID_FS_TYPE}!="crypto_LUKS", SYMLINK+="gpt-auto-root" SUBSYSTEM=="block", ENV{ID_PART_GPT_AUTO_ROOT}=="1", ENV{ID_FS_TYPE}=="crypto_LUKS", SYMLINK+="gpt-auto-root-luks" -- -2.34.0 +2.36.1 diff --git a/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch b/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch index d37ace3250c..e05a7af17dc 100644 --- a/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch +++ b/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch @@ -1,7 +1,7 @@ -From a845786195182c376b72a85433e278c35243676d Mon Sep 17 00:00:00 2001 +From c884aee4c66c97f592ae0f8ebd97f48a39d8c53c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 12 Apr 2013 13:16:57 +0200 -Subject: [PATCH 02/19] Don't try to unmount /nix or /nix/store +Subject: [PATCH 02/18] Don't try to unmount /nix or /nix/store They'll still be remounted read-only. @@ -25,10 +25,10 @@ index f683f05981..5a04c2c2a6 100644 "/etc")) return true; diff --git a/src/shutdown/umount.c b/src/shutdown/umount.c -index f5a2cb20c1..51608d24c0 100644 +index 820aa8e286..653e43053d 100644 --- a/src/shutdown/umount.c +++ b/src/shutdown/umount.c -@@ -502,6 +502,8 @@ static int delete_md(MountPoint *m) { +@@ -518,6 +518,8 @@ static int delete_md(MountPoint *m) { static bool nonunmountable_path(const char *path) { return path_equal(path, "/") @@ -38,5 +38,5 @@ index f5a2cb20c1..51608d24c0 100644 || path_equal(path, "/usr") #endif -- -2.34.0 +2.36.1 diff --git a/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch b/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch index 56c6238b81f..6db68f5e011 100644 --- a/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch +++ b/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch @@ -1,7 +1,7 @@ -From d33f3461fa2202ef9b0d6cdf2137c510c59fb052 Mon Sep 17 00:00:00 2001 +From eb3ff76f95bfe248f517e029ea1b152f4983370a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 16 Apr 2014 10:59:28 +0200 -Subject: [PATCH 03/19] Fix NixOS containers +Subject: [PATCH 03/18] Fix NixOS containers In NixOS containers, the init script is bind-mounted into the container, so checking early whether it exists will fail. @@ -10,19 +10,19 @@ container, so checking early whether it exists will fail. 1 file changed, 2 insertions(+) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c -index 8f17ab8810..197e5aa252 100644 +index c5fd978395..0fa415f5b5 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c -@@ -5625,6 +5625,7 @@ static int run(int argc, char *argv[]) { +@@ -5651,6 +5651,7 @@ static int run(int argc, char *argv[]) { goto finish; } } else { +#if 0 - const char *p, *q; + _cleanup_free_ char *p = NULL; if (arg_pivot_root_new) -@@ -5639,6 +5640,7 @@ static int run(int argc, char *argv[]) { - r = -EINVAL; +@@ -5665,6 +5666,7 @@ static int run(int argc, char *argv[]) { + "Directory %s doesn't look like it has an OS tree (/usr/ directory is missing). Refusing.", arg_directory); goto finish; } +#endif @@ -30,5 +30,5 @@ index 8f17ab8810..197e5aa252 100644 } else { -- -2.34.0 +2.36.1 diff --git a/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch b/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch index 36d0ee0cde2..ce3263a2bdb 100644 --- a/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch +++ b/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch @@ -1,7 +1,7 @@ -From 8fd5968163f3a1cb5f196d934756ba08ccaa5b1e Mon Sep 17 00:00:00 2001 +From 789ca236fdc81dc3f514ddad3354eeb5fa8cc7d8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 1 May 2014 14:10:10 +0200 -Subject: [PATCH 04/19] Look for fsck in the right place +Subject: [PATCH 04/18] Look for fsck in the right place --- src/fsck/fsck.c | 2 +- @@ -21,5 +21,5 @@ index 745d01ff50..dd4eef45c3 100644 cmdline[i++] = "-T"; -- -2.34.0 +2.36.1 diff --git a/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch b/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch index 6acac84a9d2..89804466ad0 100644 --- a/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch +++ b/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch @@ -1,7 +1,7 @@ -From 90d1a90d3147e9c8db5caec8befabda270e755d4 Mon Sep 17 00:00:00 2001 +From 6871d9637bc653a976e04cd595697d7244a293e2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 19 Dec 2014 14:46:17 +0100 -Subject: [PATCH 05/19] Add some NixOS-specific unit directories +Subject: [PATCH 05/18] Add some NixOS-specific unit directories Look in `/nix/var/nix/profiles/default/lib/systemd/{system,user}` for units provided by packages installed into the default profile via @@ -14,7 +14,7 @@ Also, remove /usr and /lib as these don't exist on NixOS. 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c -index 6fb8c40e7a..142ecdecec 100644 +index 1f4331a8bf..4b9a8ae26e 100644 --- a/src/basic/path-lookup.c +++ b/src/basic/path-lookup.c @@ -92,11 +92,7 @@ int xdg_user_data_dir(char **ret, const char *suffix) { @@ -29,7 +29,7 @@ index 6fb8c40e7a..142ecdecec 100644 NULL }; -@@ -614,15 +610,13 @@ int lookup_paths_init( +@@ -617,15 +613,13 @@ int lookup_paths_init( persistent_config, SYSTEM_CONFIG_UNIT_DIR, "/etc/systemd/system", @@ -46,7 +46,7 @@ index 6fb8c40e7a..142ecdecec 100644 STRV_IFNOTNULL(generator_late)); break; -@@ -638,14 +632,11 @@ int lookup_paths_init( +@@ -641,14 +635,11 @@ int lookup_paths_init( persistent_config, USER_CONFIG_UNIT_DIR, "/etc/systemd/user", @@ -62,23 +62,23 @@ index 6fb8c40e7a..142ecdecec 100644 STRV_IFNOTNULL(generator_late)); break; -@@ -795,7 +786,6 @@ char **generator_binary_paths(UnitFileScope scope) { - case UNIT_FILE_SYSTEM: +@@ -808,7 +799,6 @@ char **generator_binary_paths(LookupScope scope) { + case LOOKUP_SCOPE_SYSTEM: add = strv_new("/run/systemd/system-generators", "/etc/systemd/system-generators", - "/usr/local/lib/systemd/system-generators", SYSTEM_GENERATOR_DIR); break; -@@ -803,7 +793,6 @@ char **generator_binary_paths(UnitFileScope scope) { - case UNIT_FILE_USER: +@@ -816,7 +806,6 @@ char **generator_binary_paths(LookupScope scope) { + case LOOKUP_SCOPE_USER: add = strv_new("/run/systemd/user-generators", "/etc/systemd/user-generators", - "/usr/local/lib/systemd/user-generators", USER_GENERATOR_DIR); break; -@@ -842,12 +831,10 @@ char **env_generator_binary_paths(bool is_system) { +@@ -855,12 +844,10 @@ char **env_generator_binary_paths(bool is_system) { if (is_system) add = strv_new("/run/systemd/system-environment-generators", "/etc/systemd/system-environment-generators", @@ -122,5 +122,5 @@ index fc0f8c34fa..162432e77f 100644 systemd_sleep_dir=${root_prefix}/lib/systemd/system-sleep -- -2.34.0 +2.36.1 diff --git a/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch b/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch index 438d841bb1c..2cb85655e67 100644 --- a/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch +++ b/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch @@ -1,7 +1,7 @@ -From 213279752124dc4a57a4189df9b5b2e96feaa0b3 Mon Sep 17 00:00:00 2001 +From 67daf22c74a780e283a493a0f9fdbbea2ce0aaba Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 11 May 2015 15:39:38 +0200 -Subject: [PATCH 06/19] Get rid of a useless message in user sessions +Subject: [PATCH 06/18] Get rid of a useless message in user sessions Namely lots of variants of @@ -13,10 +13,10 @@ in containers. 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/manager.c b/src/core/manager.c -index 9368a1dfa1..5b0bdb1bc7 100644 +index 296b759959..71ef7f27b4 100644 --- a/src/core/manager.c +++ b/src/core/manager.c -@@ -1408,7 +1408,8 @@ static unsigned manager_dispatch_stop_when_bound_queue(Manager *m) { +@@ -1428,7 +1428,8 @@ static unsigned manager_dispatch_stop_when_bound_queue(Manager *m) { if (!unit_is_bound_by_inactive(u, &culprit)) continue; @@ -27,5 +27,5 @@ index 9368a1dfa1..5b0bdb1bc7 100644 /* If stopping a unit fails continuously we might enter a stop loop here, hence stop acting on the * service being unnecessary after a while. */ -- -2.34.0 +2.36.1 diff --git a/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch b/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch index a93488afbf9..e9d9ef6b5fe 100644 --- a/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch +++ b/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch @@ -1,7 +1,7 @@ -From 14474d5e116609ce4fac60d779b08fa3eab840c3 Mon Sep 17 00:00:00 2001 +From 21b9acb1d4202a022475a24db727055f9dd2532a Mon Sep 17 00:00:00 2001 From: Gabriel Ebner Date: Sun, 6 Dec 2015 14:26:36 +0100 -Subject: [PATCH 07/19] hostnamed, localed, timedated: disable methods that +Subject: [PATCH 07/18] hostnamed, localed, timedated: disable methods that change system settings. --- @@ -11,10 +11,10 @@ Subject: [PATCH 07/19] hostnamed, localed, timedated: disable methods that 3 files changed, 25 insertions(+) diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c -index b20a93ad81..6292fca4fc 100644 +index 5f09e6d0eb..46bef3b59d 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c -@@ -813,6 +813,9 @@ static int method_set_static_hostname(sd_bus_message *m, void *userdata, sd_bus_ +@@ -910,6 +910,9 @@ static int method_set_static_hostname(sd_bus_message *m, void *userdata, sd_bus_ if (r < 0) return r; @@ -24,7 +24,7 @@ index b20a93ad81..6292fca4fc 100644 name = empty_to_null(name); context_read_etc_hostname(c); -@@ -876,6 +879,9 @@ static int set_machine_info(Context *c, sd_bus_message *m, int prop, sd_bus_mess +@@ -973,6 +976,9 @@ static int set_machine_info(Context *c, sd_bus_message *m, int prop, sd_bus_mess if (r < 0) return r; @@ -35,10 +35,10 @@ index b20a93ad81..6292fca4fc 100644 context_read_machine_info(c); diff --git a/src/locale/localed.c b/src/locale/localed.c -index c228385d0e..942ccaa038 100644 +index 89bf9c6fba..af2f37a4ca 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c -@@ -360,6 +360,9 @@ static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *er +@@ -359,6 +359,9 @@ static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *er if (r < 0) return r; @@ -48,7 +48,7 @@ index c228385d0e..942ccaa038 100644 use_localegen = locale_gen_check_available(); /* If single locale without variable name is provided, then we assume it is LANG=. */ -@@ -485,6 +488,9 @@ static int method_set_vc_keyboard(sd_bus_message *m, void *userdata, sd_bus_erro +@@ -484,6 +487,9 @@ static int method_set_vc_keyboard(sd_bus_message *m, void *userdata, sd_bus_erro if (r < 0) return r; @@ -58,7 +58,7 @@ index c228385d0e..942ccaa038 100644 keymap = empty_to_null(keymap); keymap_toggle = empty_to_null(keymap_toggle); -@@ -665,6 +671,9 @@ static int method_set_x11_keyboard(sd_bus_message *m, void *userdata, sd_bus_err +@@ -664,6 +670,9 @@ static int method_set_x11_keyboard(sd_bus_message *m, void *userdata, sd_bus_err if (r < 0) return r; @@ -69,10 +69,10 @@ index c228385d0e..942ccaa038 100644 model = empty_to_null(model); variant = empty_to_null(variant); diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c -index 66b454269d..0a8fe25d0f 100644 +index 9ca5d37b75..e41d8d73df 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c -@@ -668,6 +668,10 @@ static int method_set_timezone(sd_bus_message *m, void *userdata, sd_bus_error * +@@ -669,6 +669,10 @@ static int method_set_timezone(sd_bus_message *m, void *userdata, sd_bus_error * if (r < 0) return r; @@ -83,7 +83,7 @@ index 66b454269d..0a8fe25d0f 100644 if (!timezone_is_valid(z, LOG_DEBUG)) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid or not installed time zone '%s'", z); -@@ -747,6 +751,9 @@ static int method_set_local_rtc(sd_bus_message *m, void *userdata, sd_bus_error +@@ -748,6 +752,9 @@ static int method_set_local_rtc(sd_bus_message *m, void *userdata, sd_bus_error if (r < 0) return r; @@ -104,5 +104,5 @@ index 66b454269d..0a8fe25d0f 100644 if (r < 0) return r; -- -2.34.0 +2.36.1 diff --git a/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch b/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch index e1bc44a148e..67e63298f23 100644 --- a/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch +++ b/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch @@ -1,7 +1,7 @@ -From d668df39728c992ec0c691ef6e76664e7121f5bd Mon Sep 17 00:00:00 2001 +From 3894fcd76e5791e094c685c0095006b6867893c1 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Thu, 7 Jul 2016 02:47:13 +0300 -Subject: [PATCH 08/19] Fix hwdb paths +Subject: [PATCH 08/18] Fix hwdb paths Patch by vcunat. --- @@ -9,10 +9,10 @@ Patch by vcunat. 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/libsystemd/sd-hwdb/hwdb-internal.h b/src/libsystemd/sd-hwdb/hwdb-internal.h -index 5ddc2211e6..ee621eec46 100644 +index 62d27f7b89..87318e041b 100644 --- a/src/libsystemd/sd-hwdb/hwdb-internal.h +++ b/src/libsystemd/sd-hwdb/hwdb-internal.h -@@ -82,8 +82,5 @@ struct trie_value_entry2_f { +@@ -83,8 +83,5 @@ struct trie_value_entry2_f { } _packed_; #define hwdb_bin_paths \ @@ -24,5 +24,5 @@ index 5ddc2211e6..ee621eec46 100644 + "/etc/udev/hwdb.bin\0" + -- -2.34.0 +2.36.1 diff --git a/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch b/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch index 68d40980ab1..94d57bc7c05 100644 --- a/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch +++ b/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch @@ -1,7 +1,7 @@ -From dd59ce5f1bbdafb0b92f8aeacc68b000ec347a61 Mon Sep 17 00:00:00 2001 +From 322fe2a15ac92d38f6952a2f7fd66e56eaa0f1f4 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Tue, 11 Oct 2016 13:12:08 +0300 -Subject: [PATCH 09/19] Change /usr/share/zoneinfo to /etc/zoneinfo +Subject: [PATCH 09/18] Change /usr/share/zoneinfo to /etc/zoneinfo NixOS uses this path. --- @@ -35,10 +35,10 @@ index e486474c44..5f373d0723 100644 Etc/UTC. The resulting link should lead to the corresponding binary diff --git a/src/basic/time-util.c b/src/basic/time-util.c -index b659d6905d..660b1c6fed 100644 +index c309369406..e0d84a7cfa 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c -@@ -1267,7 +1267,7 @@ static int get_timezones_from_zone1970_tab(char ***ret) { +@@ -1281,7 +1281,7 @@ static int get_timezones_from_zone1970_tab(char ***ret) { assert(ret); @@ -47,7 +47,7 @@ index b659d6905d..660b1c6fed 100644 if (!f) return -errno; -@@ -1306,7 +1306,7 @@ static int get_timezones_from_tzdata_zi(char ***ret) { +@@ -1320,7 +1320,7 @@ static int get_timezones_from_tzdata_zi(char ***ret) { _cleanup_strv_free_ char **zones = NULL; int r; @@ -56,7 +56,7 @@ index b659d6905d..660b1c6fed 100644 if (!f) return -errno; -@@ -1419,7 +1419,7 @@ int verify_timezone(const char *name, int log_level) { +@@ -1433,7 +1433,7 @@ int verify_timezone(const char *name, int log_level) { if (p - name >= PATH_MAX) return -ENAMETOOLONG; @@ -65,7 +65,7 @@ index b659d6905d..660b1c6fed 100644 fd = open(t, O_RDONLY|O_CLOEXEC); if (fd < 0) -@@ -1510,7 +1510,7 @@ int get_timezone(char **ret) { +@@ -1491,7 +1491,7 @@ int get_timezone(char **ret) { if (r < 0) return r; /* returns EINVAL if not a symlink */ @@ -75,7 +75,7 @@ index b659d6905d..660b1c6fed 100644 return -EINVAL; diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c -index d28a416e5d..c7c215731d 100644 +index 39160182ef..8dcc3307c8 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -494,7 +494,7 @@ static int process_timezone(void) { @@ -88,10 +88,10 @@ index d28a416e5d..c7c215731d 100644 (void) mkdir_parents(etc_localtime, 0755); if (symlink(e, etc_localtime) < 0) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c -index 197e5aa252..c674fa61d5 100644 +index 0fa415f5b5..b4404fff49 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c -@@ -1899,8 +1899,8 @@ int userns_mkdir(const char *root, const char *path, mode_t mode, uid_t uid, gid +@@ -1901,8 +1901,8 @@ int userns_mkdir(const char *root, const char *path, mode_t mode, uid_t uid, gid static const char *timezone_from_path(const char *path) { return PATH_STARTSWITH_SET( path, @@ -103,10 +103,10 @@ index 197e5aa252..c674fa61d5 100644 static bool etc_writable(void) { diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c -index 0a8fe25d0f..2f02b9a520 100644 +index e41d8d73df..ff1a384b3b 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c -@@ -279,7 +279,7 @@ static int context_read_data(Context *c) { +@@ -282,7 +282,7 @@ static int context_read_data(Context *c) { r = get_timezone(&t); if (r == -EINVAL) @@ -115,7 +115,7 @@ index 0a8fe25d0f..2f02b9a520 100644 else if (r < 0) log_warning_errno(r, "Failed to get target of /etc/localtime: %m"); -@@ -303,7 +303,7 @@ static int context_write_data_timezone(Context *c) { +@@ -306,7 +306,7 @@ static int context_write_data_timezone(Context *c) { if (isempty(c->zone) || streq(c->zone, "UTC")) { @@ -124,7 +124,7 @@ index 0a8fe25d0f..2f02b9a520 100644 if (unlink("/etc/localtime") < 0 && errno != ENOENT) return -errno; -@@ -311,9 +311,9 @@ static int context_write_data_timezone(Context *c) { +@@ -314,9 +314,9 @@ static int context_write_data_timezone(Context *c) { return 0; } @@ -137,5 +137,5 @@ index 0a8fe25d0f..2f02b9a520 100644 return -ENOMEM; -- -2.34.0 +2.36.1 diff --git a/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch b/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch index f2514de6c66..23d12fb2f82 100644 --- a/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch +++ b/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch @@ -1,7 +1,7 @@ -From a93da270bed88972f4d60a1fa08f24e00712d7fb Mon Sep 17 00:00:00 2001 +From 35dd77fafe73cc4a648f101163945cbcae8ed6b9 Mon Sep 17 00:00:00 2001 From: Imuli Date: Wed, 19 Oct 2016 08:46:47 -0400 -Subject: [PATCH 10/19] localectl: use /etc/X11/xkb for list-x11-* +Subject: [PATCH 10/18] localectl: use /etc/X11/xkb for list-x11-* NixOS has an option to link the xkb data files to /etc/X11, but not to /usr/share/X11. @@ -10,10 +10,10 @@ NixOS has an option to link the xkb data files to /etc/X11, but not to 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locale/localectl.c b/src/locale/localectl.c -index b5624209dc..4ab7adfdb6 100644 +index 661d54c27d..e98b578531 100644 --- a/src/locale/localectl.c +++ b/src/locale/localectl.c -@@ -279,7 +279,7 @@ static int list_x11_keymaps(int argc, char **argv, void *userdata) { +@@ -277,7 +277,7 @@ static int list_x11_keymaps(int argc, char **argv, void *userdata) { } state = NONE, look_for; int r; @@ -23,5 +23,5 @@ index b5624209dc..4ab7adfdb6 100644 return log_error_errno(errno, "Failed to open keyboard mapping list. %m"); -- -2.34.0 +2.36.1 diff --git a/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch b/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch index c21a1bda412..824ddb33bfb 100644 --- a/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch +++ b/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch @@ -1,17 +1,17 @@ -From 3bc3462165cd72de93a1c71f03e6c4150726b159 Mon Sep 17 00:00:00 2001 +From 1928e1d8eda7d3e296170bb5bd813463cc3e679c Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Sun, 11 Feb 2018 04:37:44 +0100 -Subject: [PATCH 11/19] build: don't create statedir and don't touch prefixdir +Subject: [PATCH 11/18] build: don't create statedir and don't touch prefixdir --- meson.build | 3 --- 1 file changed, 3 deletions(-) diff --git a/meson.build b/meson.build -index c0cbadecb1..8266bf57de 100644 +index 36cbfa4893..a10d6a3eb7 100644 --- a/meson.build +++ b/meson.build -@@ -3729,9 +3729,6 @@ install_data('LICENSE.GPL2', +@@ -3926,9 +3926,6 @@ install_data('LICENSE.GPL2', install_subdir('LICENSES', install_dir : docdir) @@ -22,5 +22,5 @@ index c0cbadecb1..8266bf57de 100644 # Ensure that changes to the docs/ directory do not break the -- -2.34.0 +2.36.1 diff --git a/pkgs/os-specific/linux/systemd/0012-add-rootprefix-to-lookup-dir-paths.patch b/pkgs/os-specific/linux/systemd/0012-add-rootprefix-to-lookup-dir-paths.patch new file mode 100644 index 00000000000..86ebfa5d4b0 --- /dev/null +++ b/pkgs/os-specific/linux/systemd/0012-add-rootprefix-to-lookup-dir-paths.patch @@ -0,0 +1,38 @@ +From 201b588b4b30fb53aefaed43e5d434373a076cb0 Mon Sep 17 00:00:00 2001 +From: Andreas Rammhold +Date: Thu, 9 May 2019 11:15:22 +0200 +Subject: [PATCH 12/18] add rootprefix to lookup dir paths + +systemd does not longer use the UDEVLIBEXEC directory as root for +discovery default udev rules. By adding `$out/lib` to the lookup paths +we should again be able to discover the udev rules amongst other default +files that I might have missed. +--- + src/basic/def.h | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/basic/def.h b/src/basic/def.h +index 0a1ae023a3..cc00ff6c68 100644 +--- a/src/basic/def.h ++++ b/src/basic/def.h +@@ -39,13 +39,15 @@ + "/run/" n "\0" \ + "/usr/local/lib/" n "\0" \ + "/usr/lib/" n "\0" \ +- _CONF_PATHS_SPLIT_USR_NULSTR(n) ++ _CONF_PATHS_SPLIT_USR_NULSTR(n) \ ++ ROOTPREFIX "/lib/" n "\0" + + #define CONF_PATHS_USR(n) \ + "/etc/" n, \ + "/run/" n, \ + "/usr/local/lib/" n, \ +- "/usr/lib/" n ++ "/usr/lib/" n, \ ++ ROOTPREFIX "/lib/" n + + #define CONF_PATHS(n) \ + CONF_PATHS_USR(n) \ +-- +2.36.1 + diff --git a/pkgs/os-specific/linux/systemd/0012-inherit-systemd-environment-when-calling-generators.patch b/pkgs/os-specific/linux/systemd/0012-inherit-systemd-environment-when-calling-generators.patch deleted file mode 100644 index 5f27e417523..00000000000 --- a/pkgs/os-specific/linux/systemd/0012-inherit-systemd-environment-when-calling-generators.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 85f0ad0cb7b4f0cfd482c9611f9cbc2dacbba33a Mon Sep 17 00:00:00 2001 -From: Andreas Rammhold -Date: Fri, 2 Nov 2018 21:15:42 +0100 -Subject: [PATCH 12/19] inherit systemd environment when calling generators. - -Systemd generators need access to the environment configured in -stage-2-init.sh since it schedules fsck and mkfs executions based on -being able to find an appropriate binary for the target filesystem. - -With this commit I am altering the systemd behaviour since upstream -tries to gather environments with that they call -"environment-generators" and then seems to pass that on to all the other -executables that are being called from managers. ---- - src/core/manager.c | 13 +++++++++---- - 1 file changed, 9 insertions(+), 4 deletions(-) - -diff --git a/src/core/manager.c b/src/core/manager.c -index 5b0bdb1bc7..1538a5200a 100644 ---- a/src/core/manager.c -+++ b/src/core/manager.c -@@ -3653,10 +3653,15 @@ static int manager_run_generators(Manager *m) { - argv[4] = NULL; - - RUN_WITH_UMASK(0022) -- (void) execute_directories((const char* const*) paths, DEFAULT_TIMEOUT_USEC, NULL, NULL, -- (char**) argv, m->transient_environment, -- EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS | EXEC_DIR_SET_SYSTEMD_EXEC_PID); -- -+ (void) execute_directories((const char* const*) paths, DEFAULT_TIMEOUT_USEC, -+ // On NixOS we must propagate PATH to generators so they are -+ // able to find binaries such as `fsck.${fstype}` and -+ // `mkfs.${fstype}`. That is why the last argument of the -+ // function (envp) is set to NULL. This propagates systemd's -+ // environment (e.g. PATH) that was setup -+ // before calling systemd from stage-2-init.sh. -+ NULL, NULL, (char**) argv, /* NixOS: use inherited env */ NULL, -+ EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS | EXEC_DIR_SET_SYSTEMD_EXEC_PID); - r = 0; - - finish: --- -2.34.0 - diff --git a/pkgs/os-specific/linux/systemd/0013-add-rootprefix-to-lookup-dir-paths.patch b/pkgs/os-specific/linux/systemd/0013-add-rootprefix-to-lookup-dir-paths.patch deleted file mode 100644 index d008cf2821c..00000000000 --- a/pkgs/os-specific/linux/systemd/0013-add-rootprefix-to-lookup-dir-paths.patch +++ /dev/null @@ -1,38 +0,0 @@ -From b30d2273d3ce1480b0c4c27c25211f84e04172e9 Mon Sep 17 00:00:00 2001 -From: Andreas Rammhold -Date: Thu, 9 May 2019 11:15:22 +0200 -Subject: [PATCH 13/19] add rootprefix to lookup dir paths - -systemd does not longer use the UDEVLIBEXEC directory as root for -discovery default udev rules. By adding `$out/lib` to the lookup paths -we should again be able to discover the udev rules amongst other default -files that I might have missed. ---- - src/basic/def.h | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/src/basic/def.h b/src/basic/def.h -index eccee3d3fa..e94a2c8bd0 100644 ---- a/src/basic/def.h -+++ b/src/basic/def.h -@@ -39,13 +39,15 @@ - "/run/" n "\0" \ - "/usr/local/lib/" n "\0" \ - "/usr/lib/" n "\0" \ -- _CONF_PATHS_SPLIT_USR_NULSTR(n) -+ _CONF_PATHS_SPLIT_USR_NULSTR(n) \ -+ ROOTPREFIX "/lib/" n "\0" - - #define CONF_PATHS_USR(n) \ - "/etc/" n, \ - "/run/" n, \ - "/usr/local/lib/" n, \ -- "/usr/lib/" n -+ "/usr/lib/" n, \ -+ ROOTPREFIX "/lib/" n - - #define CONF_PATHS(n) \ - CONF_PATHS_USR(n) \ --- -2.34.0 - diff --git a/pkgs/os-specific/linux/systemd/0013-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch b/pkgs/os-specific/linux/systemd/0013-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch new file mode 100644 index 00000000000..21cbde9a92d --- /dev/null +++ b/pkgs/os-specific/linux/systemd/0013-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch @@ -0,0 +1,27 @@ +From 67434c58caddf7dd3cef66dd3e3f704d39e4bcb0 Mon Sep 17 00:00:00 2001 +From: Nikolay Amiantov +Date: Thu, 25 Jul 2019 20:45:55 +0300 +Subject: [PATCH 13/18] systemd-shutdown: execute scripts in + /etc/systemd/system-shutdown + +This is needed for NixOS to use such scripts as systemd directory is immutable. +--- + src/shutdown/shutdown.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c +index 2c3cbec02c..1b876203c6 100644 +--- a/src/shutdown/shutdown.c ++++ b/src/shutdown/shutdown.c +@@ -335,7 +335,7 @@ int main(int argc, char *argv[]) { + _cleanup_free_ char *cgroup = NULL; + char *arguments[3]; + int cmd, r, umount_log_level = LOG_INFO; +- static const char* const dirs[] = {SYSTEM_SHUTDOWN_PATH, NULL}; ++ static const char* const dirs[] = {SYSTEM_SHUTDOWN_PATH, "/etc/systemd/system-shutdown", NULL}; + + /* The log target defaults to console, but the original systemd process will pass its log target in through a + * command line argument, which will override this default. Also, ensure we'll never log to the journal or +-- +2.36.1 + diff --git a/pkgs/os-specific/linux/systemd/0014-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch b/pkgs/os-specific/linux/systemd/0014-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch deleted file mode 100644 index 49c6651c0ed..00000000000 --- a/pkgs/os-specific/linux/systemd/0014-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 76da27ff77e5db07e502d4d8d26286d69c3f0319 Mon Sep 17 00:00:00 2001 -From: Nikolay Amiantov -Date: Thu, 25 Jul 2019 20:45:55 +0300 -Subject: [PATCH 14/19] systemd-shutdown: execute scripts in - /etc/systemd/system-shutdown - -This is needed for NixOS to use such scripts as systemd directory is immutable. ---- - src/shutdown/shutdown.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c -index 7ad9930677..fdb03a2e1a 100644 ---- a/src/shutdown/shutdown.c -+++ b/src/shutdown/shutdown.c -@@ -335,7 +335,7 @@ int main(int argc, char *argv[]) { - _cleanup_free_ char *cgroup = NULL; - char *arguments[3]; - int cmd, r, umount_log_level = LOG_INFO; -- static const char* const dirs[] = {SYSTEM_SHUTDOWN_PATH, NULL}; -+ static const char* const dirs[] = {SYSTEM_SHUTDOWN_PATH, "/etc/systemd/system-shutdown", NULL}; - - /* The log target defaults to console, but the original systemd process will pass its log target in through a - * command line argument, which will override this default. Also, ensure we'll never log to the journal or --- -2.34.0 - diff --git a/pkgs/os-specific/linux/systemd/0014-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch b/pkgs/os-specific/linux/systemd/0014-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch new file mode 100644 index 00000000000..2d6f6aefbbb --- /dev/null +++ b/pkgs/os-specific/linux/systemd/0014-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch @@ -0,0 +1,26 @@ +From db1280d020e6d46a994240e755ce369d895322c5 Mon Sep 17 00:00:00 2001 +From: Nikolay Amiantov +Date: Thu, 25 Jul 2019 20:46:58 +0300 +Subject: [PATCH 14/18] systemd-sleep: execute scripts in + /etc/systemd/system-sleep + +This is needed for NixOS to use such scripts as systemd directory is immutable. +--- + src/sleep/sleep.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c +index 65e391d02a..28af2f8bf5 100644 +--- a/src/sleep/sleep.c ++++ b/src/sleep/sleep.c +@@ -180,6 +180,7 @@ static int execute( + }; + static const char* const dirs[] = { + SYSTEM_SLEEP_PATH, ++ "/etc/systemd/system-sleep", + NULL + }; + +-- +2.36.1 + diff --git a/pkgs/os-specific/linux/systemd/0015-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch b/pkgs/os-specific/linux/systemd/0015-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch new file mode 100644 index 00000000000..9adeed284fb --- /dev/null +++ b/pkgs/os-specific/linux/systemd/0015-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch @@ -0,0 +1,27 @@ +From ac9f97341e6fe3fb4b5fe22e72f43312ef5b1ca4 Mon Sep 17 00:00:00 2001 +From: Florian Klink +Date: Sat, 7 Mar 2020 22:40:27 +0100 +Subject: [PATCH 15/18] kmod-static-nodes.service: Update ConditionFileNotEmpty + +On NixOS, kernel modules of the currently booted systems are located at +/run/booted-system/kernel-modules/lib/modules/%v/, not /lib/modules/%v/. +--- + units/kmod-static-nodes.service.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/units/kmod-static-nodes.service.in b/units/kmod-static-nodes.service.in +index 777e82d16b..b6abc2bba0 100644 +--- a/units/kmod-static-nodes.service.in ++++ b/units/kmod-static-nodes.service.in +@@ -12,7 +12,7 @@ Description=Create List of Static Device Nodes + DefaultDependencies=no + Before=sysinit.target systemd-tmpfiles-setup-dev.service + ConditionCapability=CAP_SYS_MODULE +-ConditionFileNotEmpty=/lib/modules/%v/modules.devname ++ConditionFileNotEmpty=/run/booted-system/kernel-modules/lib/modules/%v/modules.devname + + [Service] + Type=oneshot +-- +2.36.1 + diff --git a/pkgs/os-specific/linux/systemd/0015-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch b/pkgs/os-specific/linux/systemd/0015-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch deleted file mode 100644 index 78d77c00582..00000000000 --- a/pkgs/os-specific/linux/systemd/0015-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 47c651f97acae814d4ff679ae04d78d4532cbca6 Mon Sep 17 00:00:00 2001 -From: Nikolay Amiantov -Date: Thu, 25 Jul 2019 20:46:58 +0300 -Subject: [PATCH 15/19] systemd-sleep: execute scripts in - /etc/systemd/system-sleep - -This is needed for NixOS to use such scripts as systemd directory is immutable. ---- - src/sleep/sleep.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c -index 7064f3a905..b60ced9d9b 100644 ---- a/src/sleep/sleep.c -+++ b/src/sleep/sleep.c -@@ -182,6 +182,7 @@ static int execute( - }; - static const char* const dirs[] = { - SYSTEM_SLEEP_PATH, -+ "/etc/systemd/system-sleep", - NULL - }; - --- -2.34.0 - diff --git a/pkgs/os-specific/linux/systemd/0016-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch b/pkgs/os-specific/linux/systemd/0016-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch deleted file mode 100644 index 3c1643e0f1a..00000000000 --- a/pkgs/os-specific/linux/systemd/0016-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch +++ /dev/null @@ -1,27 +0,0 @@ -From df0fec7ac2f33bcca60ba9a2396af33397ba42cc Mon Sep 17 00:00:00 2001 -From: Florian Klink -Date: Sat, 7 Mar 2020 22:40:27 +0100 -Subject: [PATCH 16/19] kmod-static-nodes.service: Update ConditionFileNotEmpty - -On NixOS, kernel modules of the currently booted systems are located at -/run/booted-system/kernel-modules/lib/modules/%v/, not /lib/modules/%v/. ---- - units/kmod-static-nodes.service.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/units/kmod-static-nodes.service.in b/units/kmod-static-nodes.service.in -index 777e82d16b..b6abc2bba0 100644 ---- a/units/kmod-static-nodes.service.in -+++ b/units/kmod-static-nodes.service.in -@@ -12,7 +12,7 @@ Description=Create List of Static Device Nodes - DefaultDependencies=no - Before=sysinit.target systemd-tmpfiles-setup-dev.service - ConditionCapability=CAP_SYS_MODULE --ConditionFileNotEmpty=/lib/modules/%v/modules.devname -+ConditionFileNotEmpty=/run/booted-system/kernel-modules/lib/modules/%v/modules.devname - - [Service] - Type=oneshot --- -2.34.0 - diff --git a/pkgs/os-specific/linux/systemd/0016-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch b/pkgs/os-specific/linux/systemd/0016-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch new file mode 100644 index 00000000000..dc727586ce9 --- /dev/null +++ b/pkgs/os-specific/linux/systemd/0016-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch @@ -0,0 +1,33 @@ +From 6f40d7a9d0029b5a805245b938ac62e7b150ea75 Mon Sep 17 00:00:00 2001 +From: Florian Klink +Date: Sun, 8 Mar 2020 01:05:54 +0100 +Subject: [PATCH 16/18] path-util.h: add placeholder for DEFAULT_PATH_NORMAL + +This will be the $PATH used to lookup ExecStart= etc. options, which +systemd itself uses extensively. +--- + src/basic/path-util.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/basic/path-util.h b/src/basic/path-util.h +index 553aa4fb58..46294f4bb1 100644 +--- a/src/basic/path-util.h ++++ b/src/basic/path-util.h +@@ -24,11 +24,11 @@ + # define PATH_SBIN_BIN_NULSTR(x) PATH_NORMAL_SBIN_BIN_NULSTR(x) + #endif + +-#define DEFAULT_PATH_NORMAL PATH_SBIN_BIN("/usr/local/") ":" PATH_SBIN_BIN("/usr/") +-#define DEFAULT_PATH_NORMAL_NULSTR PATH_SBIN_BIN_NULSTR("/usr/local/") PATH_SBIN_BIN_NULSTR("/usr/") ++#define DEFAULT_PATH_NORMAL "@defaultPathNormal@" ++#define DEFAULT_PATH_NORMAL_NULSTR "@defaultPathNormal@\0" + #define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":" PATH_SBIN_BIN("/") + #define DEFAULT_PATH_SPLIT_USR_NULSTR DEFAULT_PATH_NORMAL_NULSTR PATH_SBIN_BIN_NULSTR("/") +-#define DEFAULT_PATH_COMPAT PATH_SPLIT_SBIN_BIN("/usr/local/") ":" PATH_SPLIT_SBIN_BIN("/usr/") ":" PATH_SPLIT_SBIN_BIN("/") ++#define DEFAULT_PATH_COMPAT DEFAULT_PATH_NORMAL + + #if HAVE_SPLIT_USR + # define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR +-- +2.36.1 + diff --git a/pkgs/os-specific/linux/systemd/0017-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch b/pkgs/os-specific/linux/systemd/0017-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch deleted file mode 100644 index 882690ad914..00000000000 --- a/pkgs/os-specific/linux/systemd/0017-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch +++ /dev/null @@ -1,33 +0,0 @@ -From f21722ac0f51b0b59a5c030af3db5fe4e6397f7c Mon Sep 17 00:00:00 2001 -From: Florian Klink -Date: Sun, 8 Mar 2020 01:05:54 +0100 -Subject: [PATCH 17/19] path-util.h: add placeholder for DEFAULT_PATH_NORMAL - -This will be the $PATH used to lookup ExecStart= etc. options, which -systemd itself uses extensively. ---- - src/basic/path-util.h | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/basic/path-util.h b/src/basic/path-util.h -index 518f3340bf..18e826ea0b 100644 ---- a/src/basic/path-util.h -+++ b/src/basic/path-util.h -@@ -24,11 +24,11 @@ - # define PATH_SBIN_BIN_NULSTR(x) PATH_NORMAL_SBIN_BIN_NULSTR(x) - #endif - --#define DEFAULT_PATH_NORMAL PATH_SBIN_BIN("/usr/local/") ":" PATH_SBIN_BIN("/usr/") --#define DEFAULT_PATH_NORMAL_NULSTR PATH_SBIN_BIN_NULSTR("/usr/local/") PATH_SBIN_BIN_NULSTR("/usr/") -+#define DEFAULT_PATH_NORMAL "@defaultPathNormal@" -+#define DEFAULT_PATH_NORMAL_NULSTR "@defaultPathNormal@\0" - #define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":" PATH_SBIN_BIN("/") - #define DEFAULT_PATH_SPLIT_USR_NULSTR DEFAULT_PATH_NORMAL_NULSTR PATH_SBIN_BIN_NULSTR("/") --#define DEFAULT_PATH_COMPAT PATH_SPLIT_SBIN_BIN("/usr/local/") ":" PATH_SPLIT_SBIN_BIN("/usr/") ":" PATH_SPLIT_SBIN_BIN("/") -+#define DEFAULT_PATH_COMPAT DEFAULT_PATH_NORMAL - - #if HAVE_SPLIT_USR - # define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR --- -2.34.0 - diff --git a/pkgs/os-specific/linux/systemd/0017-pkg-config-derive-prefix-from-prefix.patch b/pkgs/os-specific/linux/systemd/0017-pkg-config-derive-prefix-from-prefix.patch new file mode 100644 index 00000000000..7ca62eb7506 --- /dev/null +++ b/pkgs/os-specific/linux/systemd/0017-pkg-config-derive-prefix-from-prefix.patch @@ -0,0 +1,33 @@ +From 8d9355264f11034a28ad78e4e70809908acfdb3e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= +Date: Sun, 6 Dec 2020 08:34:19 +0100 +Subject: [PATCH 17/18] pkg-config: derive prefix from --prefix + +Point prefix to the one configured, instead of `/usr` `systemd` has limited +support for making the pkgconfig prefix overridable, and interpolates those +values later down. + +So we only need to patch this one value to get the correct paths. +See systemd/systemd@bc4e6e27922a2873985ab9367d79fb099f70b505 for details. + +Co-Authored-By: Florian Klink +--- + src/core/systemd.pc.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in +index 162432e77f..2fc20daf03 100644 +--- a/src/core/systemd.pc.in ++++ b/src/core/systemd.pc.in +@@ -11,7 +11,7 @@ + # considered deprecated (though there is no plan to remove them). New names + # shall have underscores. + +-prefix=/usr ++prefix={{PREFIX}} + root_prefix={{ROOTPREFIX_NOSLASH}} + rootprefix=${root_prefix} + sysconf_dir={{SYSCONF_DIR}} +-- +2.36.1 + diff --git a/pkgs/os-specific/linux/systemd/0018-inherit-systemd-environment-when-calling-generators.patch b/pkgs/os-specific/linux/systemd/0018-inherit-systemd-environment-when-calling-generators.patch new file mode 100644 index 00000000000..06902cbad1b --- /dev/null +++ b/pkgs/os-specific/linux/systemd/0018-inherit-systemd-environment-when-calling-generators.patch @@ -0,0 +1,42 @@ +From 291ead07daab980fa39fd18512c8266c23161540 Mon Sep 17 00:00:00 2001 +From: Yuriy Taraday +Date: Fri, 17 Jun 2022 12:45:10 +0000 +Subject: [PATCH 18/18] inherit systemd environment when calling generators. + +Systemd generators need access to the environment configured in +stage-2-init.sh since it schedules fsck and mkfs executions based on +being able to find an appropriate binary for the target filesystem. + +With this commit I am altering the systemd behaviour since upstream +tries to gather environments with that they call +"environment-generators" and then seems to pass that on to all the other +executables that are being called from managers. +--- + src/core/manager.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/core/manager.c b/src/core/manager.c +index 71ef7f27b4..33ded94a7c 100644 +--- a/src/core/manager.c ++++ b/src/core/manager.c +@@ -3704,9 +3704,17 @@ static int build_generator_environment(Manager *m, char ***ret) { + * adjust generated units to that. Let's pass down some bits of information that are easy for us to + * determine (but a bit harder for generator scripts to determine), as environment variables. */ + ++ // On NixOS we must propagate PATH to generators so they are ++ // able to find binaries such as `fsck.${fstype}` and ++ // `mkfs.${fstype}`. That is why we ignore transient_environment that ++ // overrides the PATH variable. This propagates systemd's ++ // environment (e.g. PATH) that was setup ++ // before calling systemd from stage-2-init.sh. ++#if 0 + nl = strv_copy(m->transient_environment); + if (!nl) + return -ENOMEM; ++#endif + + r = strv_env_assign(&nl, "SYSTEMD_SCOPE", MANAGER_IS_SYSTEM(m) ? "system" : "user"); + if (r < 0) +-- +2.36.1 + diff --git a/pkgs/os-specific/linux/systemd/0018-pkg-config-derive-prefix-from-prefix.patch b/pkgs/os-specific/linux/systemd/0018-pkg-config-derive-prefix-from-prefix.patch deleted file mode 100644 index e602bef9c3d..00000000000 --- a/pkgs/os-specific/linux/systemd/0018-pkg-config-derive-prefix-from-prefix.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 968bd0c7bc058a4b05b6457f9ff20d02b70c9852 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= -Date: Sun, 6 Dec 2020 08:34:19 +0100 -Subject: [PATCH 18/19] pkg-config: derive prefix from --prefix - -Point prefix to the one configured, instead of `/usr` `systemd` has limited -support for making the pkgconfig prefix overridable, and interpolates those -values later down. - -So we only need to patch this one value to get the correct paths. -See systemd/systemd@bc4e6e27922a2873985ab9367d79fb099f70b505 for details. - -Co-Authored-By: Florian Klink ---- - src/core/systemd.pc.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in -index 162432e77f..2fc20daf03 100644 ---- a/src/core/systemd.pc.in -+++ b/src/core/systemd.pc.in -@@ -11,7 +11,7 @@ - # considered deprecated (though there is no plan to remove them). New names - # shall have underscores. - --prefix=/usr -+prefix={{PREFIX}} - root_prefix={{ROOTPREFIX_NOSLASH}} - rootprefix=${root_prefix} - sysconf_dir={{SYSCONF_DIR}} --- -2.34.0 - diff --git a/pkgs/os-specific/linux/systemd/0019-core-handle-lookup-paths-being-symlinks.patch b/pkgs/os-specific/linux/systemd/0019-core-handle-lookup-paths-being-symlinks.patch deleted file mode 100644 index 916f95e194a..00000000000 --- a/pkgs/os-specific/linux/systemd/0019-core-handle-lookup-paths-being-symlinks.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 169fc6f270ff3e3903a7a31550c964152f9751ec Mon Sep 17 00:00:00 2001 -From: Andreas Rammhold -Date: Wed, 18 Aug 2021 19:10:08 +0200 -Subject: [PATCH 19/19] core: handle lookup paths being symlinks - -With a recent change paths leaving the statically known lookup paths -would be treated differently then those that remained within those. That -was done (AFAIK) to consistently handle alias names. Unfortunately that -means that on some distributions, especially those where /etc/ consists -mostly of symlinks, would trigger that new detection for every single -unit in /etc/systemd/system. The reason for that is that the units -directory itself is already a symlink. ---- - src/basic/unit-file.c | 33 +++++++++++++++++++++++++++++++-- - 1 file changed, 31 insertions(+), 2 deletions(-) - -diff --git a/src/basic/unit-file.c b/src/basic/unit-file.c -index 30c632dfce..6179100126 100644 ---- a/src/basic/unit-file.c -+++ b/src/basic/unit-file.c -@@ -255,6 +255,7 @@ int unit_file_build_name_map( - - _cleanup_hashmap_free_ Hashmap *ids = NULL, *names = NULL; - _cleanup_set_free_free_ Set *paths = NULL; -+ _cleanup_strv_free_ char **expanded_search_paths = NULL; - uint64_t timestamp_hash; - char **dir; - int r; -@@ -274,6 +275,34 @@ int unit_file_build_name_map( - return log_oom(); - } - -+ /* Go over all our search paths, chase their symlinks and store the -+ * result in the expanded_search_paths list. -+ * -+ * This is important for cases where any of the unit directories itself -+ * are symlinks into other directories and would therefore cause all of -+ * the unit files to be recognized as linked units. -+ * -+ * This is important for distributions such as NixOS where most paths -+ * in /etc/ are symlinks to some other location on the filesystem (e.g. -+ * into /nix/store/). -+ */ -+ STRV_FOREACH(dir, (char**) lp->search_path) { -+ _cleanup_free_ char *resolved_dir = NULL; -+ r = strv_extend(&expanded_search_paths, *dir); -+ if (r < 0) -+ return log_oom(); -+ -+ r = chase_symlinks(*dir, NULL, 0, &resolved_dir, NULL); -+ if (r < 0) { -+ if (r != -ENOENT) -+ log_warning_errno(r, "Failed to resolve symlink %s, ignoring: %m", *dir); -+ continue; -+ } -+ -+ if (strv_consume(&expanded_search_paths, TAKE_PTR(resolved_dir)) < 0) -+ return log_oom(); -+ } -+ - STRV_FOREACH(dir, (char**) lp->search_path) { - _cleanup_closedir_ DIR *d = NULL; - -@@ -386,11 +415,11 @@ int unit_file_build_name_map( - continue; - } - -- /* Check if the symlink goes outside of our search path. -+ /* Check if the symlink goes outside of our (expanded) search path. - * If yes, it's a linked unit file or mask, and we don't care about the target name. - * Let's just store the link source directly. - * If not, let's verify that it's a good symlink. */ -- char *tail = path_startswith_strv(simplified, lp->search_path); -+ char *tail = path_startswith_strv(simplified, expanded_search_paths); - if (!tail) { - log_debug("%s: linked unit file: %s → %s", - __func__, filename, simplified); --- -2.34.0 - diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index 5007895c006..48baed6615e 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -127,13 +127,13 @@ assert withCryptsetup -> (cryptsetup != null); let wantCurl = withRemote || withImportd; wantGcrypt = withResolved || withImportd; - version = "250.4"; + version = "251.3"; # Bump this variable on every (major) version change. See below (in the meson options list) for why. # command: # $ curl -s https://api.github.com/repos/systemd/systemd/releases/latest | \ # jq '.created_at|strptime("%Y-%m-%dT%H:%M:%SZ")|mktime' - releaseTimestamp = "1640290180"; + releaseTimestamp = "1653143108"; in stdenv.mkDerivation { inherit pname version; @@ -144,7 +144,7 @@ stdenv.mkDerivation { owner = "systemd"; repo = "systemd-stable"; rev = "v${version}"; - sha256 = "sha256-AdzPh7dGVrGbbjL9+PqytQOpRzNDUUEftmKZAbFH3L4="; + sha256 = "sha256-vcj+k/duRID2R+wGQIyq+dVRrFYNQTsjHya6k0hmZxk="; }; # On major changes, or when otherwise required, you *must* reformat the patches, @@ -163,28 +163,13 @@ stdenv.mkDerivation { ./0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch ./0010-localectl-use-etc-X11-xkb-for-list-x11.patch ./0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch - ./0012-inherit-systemd-environment-when-calling-generators.patch - ./0013-add-rootprefix-to-lookup-dir-paths.patch - ./0014-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch - ./0015-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch - ./0016-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch - ./0017-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch - ./0018-pkg-config-derive-prefix-from-prefix.patch - - # In v248 or v249 we started to get in trouble due to our - # /etc/systemd/system being a symlink and thus being treated differently by - # systemd. With the below patch we mitigate that effect by special casing - # all our root unit dirs if they are symlinks. This does exactly what we - # need (AFAICT). - # See https://github.com/systemd/systemd/pull/20479 for upstream discussion. - ./0019-core-handle-lookup-paths-being-symlinks.patch - - # fixes reproducability of dbus xml files - # Should no longer be necessary with v251. - (fetchpatch { - url = "https://github.com/systemd/systemd/pull/22174.patch"; - sha256 = "sha256-RVhxUEUiISgRlIP/AhU+w1VHfDQw2W16cFl2TXXyxno="; - }) + ./0012-add-rootprefix-to-lookup-dir-paths.patch + ./0013-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch + ./0014-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch + ./0015-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch + ./0016-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch + ./0017-pkg-config-derive-prefix-from-prefix.patch + ./0018-inherit-systemd-environment-when-calling-generators.patch ] ++ lib.optional stdenv.hostPlatform.isMusl ( let oe-core = fetchzip { @@ -547,6 +532,7 @@ stdenv.mkDerivation { "src/analyze/test-verify.c" "src/test/test-env-file.c" "src/test/test-fileio.c" + "src/test/test-load-fragment.c" ]; } { @@ -573,29 +559,39 @@ stdenv.mkDerivation { replacement = "\\\"${gnutar}/bin/tar\\\""; where = [ "src/import/export-tar.c" - "src/import/export.c" "src/import/import-common.c" "src/import/import-tar.c" + ]; + ignore = [ + # occurences here refer to the tar sub command + "src/sysupdate/sysupdate-resource.c" + "src/sysupdate/sysupdate-transfer.c" + "src/import/pull.c" + "src/import/export.c" "src/import/import.c" "src/import/importd.c" + # runs `tar` but also also creates a temporary directory with the string "src/import/pull-tar.c" - "src/import/pull.c" ]; } ]; # { replacement, search, where } -> List[str] - mkSubstitute = { replacement, search, where }: + mkSubstitute = { replacement, search, where, ignore ? [] }: map (path: "substituteInPlace ${path} --replace '${search}' \"${replacement}\"") where; - mkEnsureSubstituted = { replacement, search, where }: - '' - if [[ $(grep -r '${search}' | grep -v "${replacement}" | grep -Ev 'NEWS|^test/' | wc -l) -gt 0 ]]; then - echo "Not all references to '${search}' have been replaced. Found the following matches:" - grep '${search}' -r | grep -v "${replacement}" | grep -Ev 'NEWS|^test/' - exit 1 - fi - ''; - + mkEnsureSubstituted = { replacement, search, where, ignore ? [] }: + let + ignore' = lib.concatStringsSep "|" (ignore ++ ["^test" "NEWS"]); + in '' + set +e + search=$(grep '${search}' -r | grep -v "${replacement}" | grep -Ev "${ignore'}") + set -e + if [[ -n "$search" ]]; then + echo "Not all references to '${search}' have been replaced. Found the following matches:" + echo "$search" + exit 1 + fi + ''; in '' mesonFlagsArray+=(-Dntp-servers="0.nixos.pool.ntp.org 1.nixos.pool.ntp.org 2.nixos.pool.ntp.org 3.nixos.pool.ntp.org") @@ -606,6 +602,9 @@ stdenv.mkDerivation { substituteInPlace src/libsystemd/sd-journal/catalog.c \ --replace /usr/lib/systemd/catalog/ $out/lib/systemd/catalog/ + + substituteInPlace src/import/pull-tar.c \ + --replace 'wait_for_terminate_and_check("tar"' 'wait_for_terminate_and_check("${gnutar}/bin/tar"' ''; # These defines are overridden by CFLAGS and would trigger annoying -- cgit 1.4.1