diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd')
20 files changed, 1591 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch new file mode 100644 index 000000000000..1f75fc63ffe7 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0001-Start-device-units-for-uninitialised-encrypted-devic.patch @@ -0,0 +1,32 @@ +From 46c8ccfeb61253cd3dff5f34013670c7e3366ef5 Mon Sep 17 00:00:00 2001 +From: Eelco Dolstra <eelco.dolstra@logicblox.com> +Date: Tue, 8 Jan 2013 15:46:30 +0100 +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 +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.d/99-systemd.rules.in | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/rules.d/99-systemd.rules.in b/rules.d/99-systemd.rules.in +index 1c60eec587..b2486da130 100644 +--- a/rules.d/99-systemd.rules.in ++++ b/rules.d/99-systemd.rules.in +@@ -17,10 +17,6 @@ SUBSYSTEM=="ubi", TAG+="systemd" + SUBSYSTEM=="block", TAG+="systemd" + SUBSYSTEM=="block", ACTION=="add", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0" + +-# Ignore encrypted devices with no identified superblock on it, since +-# we are probably still calling mke2fs or mkswap on it. +-SUBSYSTEM=="block", ENV{DM_UUID}=="CRYPT-*", ENV{ID_PART_TABLE_TYPE}=="", ENV{ID_FS_USAGE}=="", ENV{SYSTEMD_READY}="0" +- + # add symlink to GPT root disk + 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.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch new file mode 100644 index 000000000000..7c025cbb7d79 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0002-Don-t-try-to-unmount-nix-or-nix-store.patch @@ -0,0 +1,42 @@ +From 139c420de62e078182eaf48b541c4b912d445fd9 Mon Sep 17 00:00:00 2001 +From: Eelco Dolstra <eelco.dolstra@logicblox.com> +Date: Fri, 12 Apr 2013 13:16:57 +0200 +Subject: [PATCH 02/18] Don't try to unmount /nix or /nix/store + +They'll still be remounted read-only. + +https://github.com/NixOS/nixos/issues/126 +--- + src/shared/fstab-util.c | 2 ++ + src/shutdown/umount.c | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c +index 806dda8475..0220741c91 100644 +--- a/src/shared/fstab-util.c ++++ b/src/shared/fstab-util.c +@@ -40,6 +40,8 @@ bool fstab_is_extrinsic(const char *mount, const char *opts) { + /* Don't bother with the OS data itself */ + if (PATH_IN_SET(mount, + "/", ++ "/nix", ++ "/nix/store", + "/usr", + "/etc")) + return true; +diff --git a/src/shutdown/umount.c b/src/shutdown/umount.c +index 8a5e80eeaa..fab35ed6f3 100644 +--- a/src/shutdown/umount.c ++++ b/src/shutdown/umount.c +@@ -414,6 +414,8 @@ static int delete_dm(dev_t devnum) { + + static bool nonunmountable_path(const char *path) { + return path_equal(path, "/") ++ || path_equal(path, "/nix") ++ || path_equal(path, "/nix/store") + #if ! HAVE_SPLIT_USR + || path_equal(path, "/usr") + #endif +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch new file mode 100644 index 000000000000..1f0b8aaf38b3 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0003-Fix-NixOS-containers.patch @@ -0,0 +1,34 @@ +From a889dbe796cd72425f38dec3d2aaab44a914ac60 Mon Sep 17 00:00:00 2001 +From: Eelco Dolstra <eelco.dolstra@logicblox.com> +Date: Wed, 16 Apr 2014 10:59:28 +0200 +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. +--- + src/nspawn/nspawn.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index 43712565c2..07f294c78a 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -5122,6 +5122,7 @@ static int run(int argc, char *argv[]) { + goto finish; + } + } else { ++#if 0 + const char *p, *q; + + if (arg_pivot_root_new) +@@ -5136,6 +5137,7 @@ static int run(int argc, char *argv[]) { + r = -EINVAL; + goto finish; + } ++#endif + } + + } else { +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch new file mode 100644 index 000000000000..f9e7bc9d8766 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0004-Look-for-fsck-in-the-right-place.patch @@ -0,0 +1,25 @@ +From 5098b1aad07356e04fcd12f2c77ea4fd17460411 Mon Sep 17 00:00:00 2001 +From: Eelco Dolstra <eelco.dolstra@logicblox.com> +Date: Thu, 1 May 2014 14:10:10 +0200 +Subject: [PATCH 04/18] Look for fsck in the right place + +--- + src/fsck/fsck.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c +index 80f7107b9d..74e48a385f 100644 +--- a/src/fsck/fsck.c ++++ b/src/fsck/fsck.c +@@ -370,7 +370,7 @@ static int run(int argc, char *argv[]) { + } else + dash_c[0] = 0; + +- cmdline[i++] = "/sbin/fsck"; ++ cmdline[i++] = "/run/current-system/sw/bin/fsck"; + cmdline[i++] = arg_repair; + cmdline[i++] = "-T"; + +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch new file mode 100644 index 000000000000..91d6fbf41d62 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch @@ -0,0 +1,124 @@ +From b46f1b20e990f01af4bdf3dd6fef45f5b4a5993e Mon Sep 17 00:00:00 2001 +From: Eelco Dolstra <eelco.dolstra@logicblox.com> +Date: Fri, 19 Dec 2014 14:46:17 +0100 +Subject: [PATCH 05/18] Add some NixOS-specific unit directories + +Look in `/nix/var/nix/profiles/default/lib/systemd` for units provided +by packages installed into the default profile via +`nix-env -iA nixos.$package`, and into `/etc/systemd-mutable/system` for +persistent, mutable units (used for Dysnomia). + +Also, remove /usr and /lib as these don't exist on NixOS. +--- + src/basic/path-lookup.c | 20 +++++--------------- + src/core/systemd.pc.in | 5 +++-- + 2 files changed, 8 insertions(+), 17 deletions(-) + +diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c +index 52968dee34..bba2eb09b8 100644 +--- a/src/basic/path-lookup.c ++++ b/src/basic/path-lookup.c +@@ -94,17 +94,14 @@ int xdg_user_data_dir(char **ret, const char *suffix) { + } + + static const char* const user_data_unit_paths[] = { +- "/usr/local/lib/systemd/user", +- "/usr/local/share/systemd/user", + USER_DATA_UNIT_DIR, +- "/usr/lib/systemd/user", +- "/usr/share/systemd/user", + NULL + }; + + static const char* const user_config_unit_paths[] = { + USER_CONFIG_UNIT_DIR, + "/etc/systemd/user", ++ "/etc/systemd-mutable/user", + NULL + }; + +@@ -616,15 +613,14 @@ int lookup_paths_init( + persistent_config, + SYSTEM_CONFIG_UNIT_DIR, + "/etc/systemd/system", ++ "/etc/systemd-mutable/system", ++ "/nix/var/nix/profiles/default/lib/systemd/system", + STRV_IFNOTNULL(persistent_attached), + runtime_config, + "/run/systemd/system", + STRV_IFNOTNULL(runtime_attached), + STRV_IFNOTNULL(generator), +- "/usr/local/lib/systemd/system", + SYSTEM_DATA_UNIT_PATH, +- "/usr/lib/systemd/system", +- STRV_IFNOTNULL(flags & LOOKUP_PATHS_SPLIT_USR ? "/lib/systemd/system" : NULL), + STRV_IFNOTNULL(generator_late)); + break; + +@@ -640,14 +636,12 @@ int lookup_paths_init( + persistent_config, + USER_CONFIG_UNIT_DIR, + "/etc/systemd/user", ++ "/etc/systemd-mutable/user", ++ "/nix/var/nix/profiles/default/lib/systemd/user", + runtime_config, + "/run/systemd/user", + STRV_IFNOTNULL(generator), +- "/usr/local/share/systemd/user", +- "/usr/share/systemd/user", +- "/usr/local/lib/systemd/user", + USER_DATA_UNIT_DIR, +- "/usr/lib/systemd/user", + STRV_IFNOTNULL(generator_late)); + break; + +@@ -797,7 +791,6 @@ char **generator_binary_paths(UnitFileScope scope) { + case UNIT_FILE_SYSTEM: + add = strv_new("/run/systemd/system-generators", + "/etc/systemd/system-generators", +- "/usr/local/lib/systemd/system-generators", + SYSTEM_GENERATOR_DIR); + break; + +@@ -805,7 +798,6 @@ char **generator_binary_paths(UnitFileScope scope) { + case UNIT_FILE_USER: + add = strv_new("/run/systemd/user-generators", + "/etc/systemd/user-generators", +- "/usr/local/lib/systemd/user-generators", + USER_GENERATOR_DIR); + break; + +@@ -844,12 +836,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", +- "/usr/local/lib/systemd/system-environment-generators", + SYSTEM_ENV_GENERATOR_DIR); + else + add = strv_new("/run/systemd/user-environment-generators", + "/etc/systemd/user-environment-generators", +- "/usr/local/lib/systemd/user-environment-generators", + USER_ENV_GENERATOR_DIR); + + if (!add) +diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in +index 8424837824..b1c541bc52 100644 +--- a/src/core/systemd.pc.in ++++ b/src/core/systemd.pc.in +@@ -38,10 +38,11 @@ systemdsystemconfdir=${systemd_system_conf_dir} + systemd_user_conf_dir=${sysconfdir}/systemd/user + systemduserconfdir=${systemd_user_conf_dir} + +-systemd_system_unit_path=${systemd_system_conf_dir}:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:${systemd_system_unit_dir}:/usr/lib/systemd/system:/lib/systemd/system ++systemd_system_unit_path=${systemd_system_conf_dir}:/etc/systemd/system:/etc/systemd-mutable/system:/nix/var/nix/profiles/default/lib/systemd/system:/run/systemd/system:${systemdsystemunitdir} + systemdsystemunitpath=${systemd_system_unit_path} + +-systemd_user_unit_path=${systemd_user_conf_dir}:/etc/systemd/user:/run/systemd/user:/usr/local/lib/systemd/user:/usr/local/share/systemd/user:${systemd_user_unit_dir}:/usr/lib/systemd/user:/usr/share/systemd/user ++systemd_user_unit_path=${systemd_user_conf_dir}:/etc/systemd/user:/etc/systemd-mutable/user:/nix/var/nix/profiles/default/lib/systemd/user:/run/systemd/user:${systemduserunitdir} ++ + systemduserunitpath=${systemd_user_unit_path} + + systemd_system_generator_dir=${root_prefix}/lib/systemd/system-generators +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch new file mode 100644 index 000000000000..8021472ea339 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0006-Get-rid-of-a-useless-message-in-user-sessions.patch @@ -0,0 +1,31 @@ +From 4c9f9d192182f1051dba1c547e182e7c8f549b0f Mon Sep 17 00:00:00 2001 +From: Eelco Dolstra <eelco.dolstra@logicblox.com> +Date: Mon, 11 May 2015 15:39:38 +0200 +Subject: [PATCH 06/18] Get rid of a useless message in user sessions + +Namely lots of variants of + + Unit nix-var-nix-db.mount is bound to inactive unit dev-disk-by\x2dlabel-nixos.device. Stopping, too. + +in containers. +--- + src/core/unit.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/core/unit.c b/src/core/unit.c +index 1bda568560..5b44970763 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -2150,7 +2150,8 @@ static void unit_check_binds_to(Unit *u) { + } + + assert(other); +- log_unit_info(u, "Unit is bound to inactive unit %s. Stopping, too.", other->id); ++ if (u->type != UNIT_MOUNT || detect_container() <= 0) ++ log_unit_info(u, "Unit is bound to inactive unit %s. Stopping, too.", other->id); + + /* A unit we need to run is gone. Sniff. Let's stop this. */ + r = manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, NULL, &error, NULL); +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch new file mode 100644 index 000000000000..6c24821c2a0d --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0007-hostnamed-localed-timedated-disable-methods-that-cha.patch @@ -0,0 +1,108 @@ +From 539f3af04963a6826d2b2d0ba2095af99a7a6294 Mon Sep 17 00:00:00 2001 +From: Gabriel Ebner <gebner@gebner.org> +Date: Sun, 6 Dec 2015 14:26:36 +0100 +Subject: [PATCH 07/18] hostnamed, localed, timedated: disable methods that + change system settings. + +--- + src/hostname/hostnamed.c | 6 ++++++ + src/locale/localed.c | 9 +++++++++ + src/timedate/timedated.c | 10 ++++++++++ + 3 files changed, 25 insertions(+) + +diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c +index 7f6607a527..b5a9388916 100644 +--- a/src/hostname/hostnamed.c ++++ b/src/hostname/hostnamed.c +@@ -626,6 +626,9 @@ static int method_set_static_hostname(sd_bus_message *m, void *userdata, sd_bus_ + if (r < 0) + return r; + ++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, ++ "Changing system settings via systemd is not supported on NixOS."); ++ + name = empty_to_null(name); + + context_read_etc_hostname(c); +@@ -685,6 +688,9 @@ static int set_machine_info(Context *c, sd_bus_message *m, int prop, sd_bus_mess + if (r < 0) + return r; + ++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, ++ "Changing system settings via systemd is not supported on NixOS."); ++ + name = empty_to_null(name); + + context_read_machine_info(c); +diff --git a/src/locale/localed.c b/src/locale/localed.c +index 715ce5cac7..014f7dcf6c 100644 +--- a/src/locale/localed.c ++++ b/src/locale/localed.c +@@ -317,6 +317,9 @@ static int method_set_locale(sd_bus_message *m, void *userdata, sd_bus_error *er + if (r < 0) + return r; + ++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, ++ "Changing system settings via systemd is not supported on NixOS."); ++ + /* If single locale without variable name is provided, then we assume it is LANG=. */ + if (strv_length(l) == 1 && !strchr(l[0], '=')) { + if (!locale_is_valid(l[0])) +@@ -432,6 +435,9 @@ static int method_set_vc_keyboard(sd_bus_message *m, void *userdata, sd_bus_erro + if (r < 0) + return r; + ++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, ++ "Changing system settings via systemd is not supported on NixOS."); ++ + keymap = empty_to_null(keymap); + keymap_toggle = empty_to_null(keymap_toggle); + +@@ -606,6 +612,9 @@ static int method_set_x11_keyboard(sd_bus_message *m, void *userdata, sd_bus_err + if (r < 0) + return r; + ++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, ++ "Changing system settings via systemd is not supported on NixOS."); ++ + layout = empty_to_null(layout); + model = empty_to_null(model); + variant = empty_to_null(variant); +diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c +index c467b85477..3e78b2f575 100644 +--- a/src/timedate/timedated.c ++++ b/src/timedate/timedated.c +@@ -646,6 +646,10 @@ static int method_set_timezone(sd_bus_message *m, void *userdata, sd_bus_error * + if (r < 0) + return r; + ++ if (getenv("NIXOS_STATIC_TIMEZONE")) ++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, ++ "Changing timezone via systemd is not supported when it is set in NixOS configuration."); ++ + 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); + +@@ -725,6 +729,9 @@ static int method_set_local_rtc(sd_bus_message *m, void *userdata, sd_bus_error + if (r < 0) + return r; + ++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, ++ "Changing system settings via systemd is not supported on NixOS."); ++ + if (lrtc == c->local_rtc) + return sd_bus_reply_method_return(m, NULL); + +@@ -917,6 +924,9 @@ static int method_set_ntp(sd_bus_message *m, void *userdata, sd_bus_error *error + if (r < 0) + return r; + ++ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, ++ "Changing system settings via systemd is not supported on NixOS."); ++ + r = context_update_ntp_status(c, bus, m); + if (r < 0) + return r; +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch new file mode 100644 index 000000000000..7b17c3bcb2ba --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0008-Fix-hwdb-paths.patch @@ -0,0 +1,32 @@ +From 5c2a1a6d33f7cdbcb8ddcc70b91ba4c7f3c383b3 Mon Sep 17 00:00:00 2001 +From: Nikolay Amiantov <ab@fmap.me> +Date: Thu, 7 Jul 2016 02:47:13 +0300 +Subject: [PATCH 08/18] Fix hwdb paths + +Patch by vcunat. +--- + src/libsystemd/sd-hwdb/sd-hwdb.c | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/src/libsystemd/sd-hwdb/sd-hwdb.c b/src/libsystemd/sd-hwdb/sd-hwdb.c +index b3febdbb31..eba00a5bc7 100644 +--- a/src/libsystemd/sd-hwdb/sd-hwdb.c ++++ b/src/libsystemd/sd-hwdb/sd-hwdb.c +@@ -297,13 +297,8 @@ static int trie_search_f(sd_hwdb *hwdb, const char *search) { + } + + static const char hwdb_bin_paths[] = +- "/etc/systemd/hwdb/hwdb.bin\0" + "/etc/udev/hwdb.bin\0" +- "/usr/lib/systemd/hwdb/hwdb.bin\0" +-#if HAVE_SPLIT_USR +- "/lib/systemd/hwdb/hwdb.bin\0" +-#endif +- UDEVLIBEXECDIR "/hwdb.bin\0"; ++ ; + + _public_ int sd_hwdb_new(sd_hwdb **ret) { + _cleanup_(sd_hwdb_unrefp) sd_hwdb *hwdb = NULL; +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch new file mode 100644 index 000000000000..e0fab399febf --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0009-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch @@ -0,0 +1,132 @@ +From a8ccba372d865429b578e72fd104a693b96101b3 Mon Sep 17 00:00:00 2001 +From: Nikolay Amiantov <ab@fmap.me> +Date: Tue, 11 Oct 2016 13:12:08 +0300 +Subject: [PATCH 09/18] Change /usr/share/zoneinfo to /etc/zoneinfo + +NixOS uses this path. +--- + man/localtime.xml | 4 ++-- + src/basic/time-util.c | 6 +++--- + src/firstboot/firstboot.c | 2 +- + src/nspawn/nspawn.c | 4 ++-- + src/timedate/timedated.c | 8 ++++---- + 5 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/man/localtime.xml b/man/localtime.xml +index 0f1652ee2e..71c4f95c2e 100644 +--- a/man/localtime.xml ++++ b/man/localtime.xml +@@ -20,7 +20,7 @@ + </refnamediv> + + <refsynopsisdiv> +- <para><filename>/etc/localtime</filename> -> <filename>../usr/share/zoneinfo/…</filename></para> ++ <para><filename>/etc/localtime</filename> -> <filename>zoneinfo/…</filename></para> + </refsynopsisdiv> + + <refsect1> +@@ -30,7 +30,7 @@ + system-wide timezone of the local system that is used by + applications for presentation to the user. It should be an + absolute or relative symbolic link pointing to +- <filename>/usr/share/zoneinfo/</filename>, followed by a timezone ++ <filename>/etc/zoneinfo/</filename>, followed by a timezone + identifier such as <literal>Europe/Berlin</literal> or + <literal>Etc/UTC</literal>. The resulting link should lead to the + corresponding binary +diff --git a/src/basic/time-util.c b/src/basic/time-util.c +index 15cc1b8851..d0abde5933 100644 +--- a/src/basic/time-util.c ++++ b/src/basic/time-util.c +@@ -1259,7 +1259,7 @@ int get_timezones(char ***ret) { + n_allocated = 2; + n_zones = 1; + +- f = fopen("/usr/share/zoneinfo/zone1970.tab", "re"); ++ f = fopen("/etc/zoneinfo/zone1970.tab", "re"); + if (f) { + for (;;) { + _cleanup_free_ char *line = NULL; +@@ -1354,7 +1354,7 @@ bool timezone_is_valid(const char *name, int log_level) { + if (p - name >= PATH_MAX) + return false; + +- t = strjoina("/usr/share/zoneinfo/", name); ++ t = strjoina("/etc/zoneinfo/", name); + + fd = open(t, O_RDONLY|O_CLOEXEC); + if (fd < 0) { +@@ -1452,7 +1452,7 @@ int get_timezone(char **ret) { + if (r < 0) + return r; /* returns EINVAL if not a symlink */ + +- e = PATH_STARTSWITH_SET(t, "/usr/share/zoneinfo/", "../usr/share/zoneinfo/"); ++ e = PATH_STARTSWITH_SET(t, "/etc/zoneinfo/", "../etc/zoneinfo/"); + if (!e) + return -EINVAL; + +diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c +index c9fc8dd5cd..44fc04dc88 100644 +--- a/src/firstboot/firstboot.c ++++ b/src/firstboot/firstboot.c +@@ -460,7 +460,7 @@ static int process_timezone(void) { + if (isempty(arg_timezone)) + return 0; + +- e = strjoina("../usr/share/zoneinfo/", arg_timezone); ++ e = strjoina("zoneinfo/", arg_timezone); + + (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 07f294c78a..cf86d1f494 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -1699,8 +1699,8 @@ static int userns_mkdir(const char *root, const char *path, mode_t mode, uid_t u + static const char *timezone_from_path(const char *path) { + return PATH_STARTSWITH_SET( + path, +- "../usr/share/zoneinfo/", +- "/usr/share/zoneinfo/"); ++ "../etc/zoneinfo/", ++ "/etc/zoneinfo/"); + } + + static bool etc_writable(void) { +diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c +index 3e78b2f575..de5477a08f 100644 +--- a/src/timedate/timedated.c ++++ b/src/timedate/timedated.c +@@ -269,7 +269,7 @@ static int context_read_data(Context *c) { + + r = get_timezone(&t); + if (r == -EINVAL) +- log_warning_errno(r, "/etc/localtime should be a symbolic link to a time zone data file in /usr/share/zoneinfo/."); ++ log_warning_errno(r, "/etc/localtime should be a symbolic link to a time zone data file in /etc/zoneinfo/."); + else if (r < 0) + log_warning_errno(r, "Failed to get target of /etc/localtime: %m"); + +@@ -293,7 +293,7 @@ static int context_write_data_timezone(Context *c) { + + if (isempty(c->zone) || streq(c->zone, "UTC")) { + +- if (access("/usr/share/zoneinfo/UTC", F_OK) < 0) { ++ if (access("/etc/zoneinfo/UTC", F_OK) < 0) { + + if (unlink("/etc/localtime") < 0 && errno != ENOENT) + return -errno; +@@ -301,9 +301,9 @@ static int context_write_data_timezone(Context *c) { + return 0; + } + +- source = "../usr/share/zoneinfo/UTC"; ++ source = "../etc/zoneinfo/UTC"; + } else { +- p = path_join("../usr/share/zoneinfo", c->zone); ++ p = path_join("../etc/zoneinfo", c->zone); + if (!p) + return -ENOMEM; + +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch new file mode 100644 index 000000000000..44ed04d9e7ea --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0010-localectl-use-etc-X11-xkb-for-list-x11.patch @@ -0,0 +1,27 @@ +From 84a2d35d4e75295edf7e190a94dfaf65db4973b6 Mon Sep 17 00:00:00 2001 +From: Imuli <i@imu.li> +Date: Wed, 19 Oct 2016 08:46:47 -0400 +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. +--- + src/locale/localectl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/locale/localectl.c b/src/locale/localectl.c +index e0664de826..c521f33a2a 100644 +--- a/src/locale/localectl.c ++++ b/src/locale/localectl.c +@@ -277,7 +277,7 @@ static int list_x11_keymaps(int argc, char **argv, void *userdata) { + } state = NONE, look_for; + int r; + +- f = fopen("/usr/share/X11/xkb/rules/base.lst", "re"); ++ f = fopen("/etc/X11/xkb/rules/base.lst", "re"); + if (!f) + return log_error_errno(errno, "Failed to open keyboard mapping list. %m"); + +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch new file mode 100644 index 000000000000..e5d4f1701ba5 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0011-build-don-t-create-statedir-and-don-t-touch-prefixdi.patch @@ -0,0 +1,26 @@ +From 81ee9b5cd46f78de139c39e2a18f39e658c60169 Mon Sep 17 00:00:00 2001 +From: Franz Pletz <fpletz@fnordicwalking.de> +Date: Sun, 11 Feb 2018 04:37:44 +0100 +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 ba9e7afe53..2ef9d4d770 100644 +--- a/meson.build ++++ b/meson.build +@@ -3371,9 +3371,6 @@ install_data('LICENSE.GPL2', + 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION', + install_dir : docdir) + +-meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir)) +-meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir)) +- + ############################################################ + + check_help = find_program('tools/check-help.sh') +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0012-Install-default-configuration-into-out-share-factory.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0012-Install-default-configuration-into-out-share-factory.patch new file mode 100644 index 000000000000..a2d08753d4df --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0012-Install-default-configuration-into-out-share-factory.patch @@ -0,0 +1,326 @@ +From 7dbe84b7c43669dccd90db8ac33c38a70e6b6914 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io> +Date: Mon, 26 Feb 2018 14:25:57 +0000 +Subject: [PATCH 12/18] Install default configuration into $out/share/factory + +By default systemd should read all its configuration from /etc. Therefor +we rely on -Dsysconfdir=/etc in meson as default value. Unfortunately +this would also lead to installation of systemd's own configuration +files to `/etc` whereas we are limited to /nix/store. To counter that +this commit introduces two new configuration variables `factoryconfdir` +and `factorypkgconfdir` to install systemd's own configuration into nix +store again, while having executables looking up files in /etc. +--- + hwdb.d/meson.build | 2 +- + meson.build | 11 +++++++---- + network/meson.build | 2 +- + src/core/meson.build | 10 +++++----- + src/coredump/meson.build | 2 +- + src/home/meson.build | 2 +- + src/journal-remote/meson.build | 4 ++-- + src/journal/meson.build | 2 +- + src/kernel-install/meson.build | 2 +- + src/login/meson.build | 2 +- + src/network/meson.build | 2 +- + src/pstore/meson.build | 2 +- + src/resolve/meson.build | 2 +- + src/timesync/meson.build | 2 +- + src/udev/meson.build | 4 ++-- + sysctl.d/meson.build | 2 +- + tmpfiles.d/meson.build | 2 +- + units/meson.build | 2 +- + 18 files changed, 30 insertions(+), 27 deletions(-) + +diff --git a/hwdb.d/meson.build b/hwdb.d/meson.build +index 5c77387a26..6404bc01ba 100644 +--- a/hwdb.d/meson.build ++++ b/hwdb.d/meson.build +@@ -43,7 +43,7 @@ if conf.get('ENABLE_HWDB') == 1 + install_dir : udevhwdbdir) + + meson.add_install_script('sh', '-c', +- mkdir_p.format(join_paths(sysconfdir, 'udev/hwdb.d'))) ++ mkdir_p.format(join_paths(factoryconfdir, 'udev/hwdb.d'))) + + meson.add_install_script('sh', '-c', + 'test -n "$DESTDIR" || @0@/systemd-hwdb update' +diff --git a/meson.build b/meson.build +index 2ef9d4d770..ae7acbd769 100644 +--- a/meson.build ++++ b/meson.build +@@ -163,6 +163,9 @@ udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d') + catalogdir = join_paths(prefixdir, 'lib/systemd/catalog') + kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d') + factorydir = join_paths(datadir, 'factory') ++factoryconfdir = join_paths(datadir, 'factory/etc') ++factorypkgconfdir = join_paths(datadir, 'factory/etc/systemd') ++factoryxinitrcdir = join_paths(datadir, 'factory/etc/X11/xinit/xinitrc.d') + bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi') + testsdir = join_paths(prefixdir, 'lib/systemd/tests') + systemdstatedir = join_paths(localstatedir, 'lib/systemd') +@@ -2653,7 +2656,7 @@ if conf.get('ENABLE_BINFMT') == 1 + meson.add_install_script('sh', '-c', + mkdir_p.format(binfmtdir)) + meson.add_install_script('sh', '-c', +- mkdir_p.format(join_paths(sysconfdir, 'binfmt.d'))) ++ mkdir_p.format(join_paths(factoryconfdir, 'binfmt.d'))) + endif + + if conf.get('ENABLE_REPART') == 1 +@@ -2769,7 +2772,7 @@ executable( + install_dir : rootlibexecdir) + + install_data('src/sleep/sleep.conf', +- install_dir : pkgsysconfdir) ++ install_dir : factorypkgconfdir) + + public_programs += executable( + 'systemd-sysctl', +@@ -3103,7 +3106,7 @@ if conf.get('HAVE_KMOD') == 1 + meson.add_install_script('sh', '-c', + mkdir_p.format(modulesloaddir)) + meson.add_install_script('sh', '-c', +- mkdir_p.format(join_paths(sysconfdir, 'modules-load.d'))) ++ mkdir_p.format(join_paths(factoryconfdir, 'modules-load.d'))) + endif + + public_programs += executable( +@@ -3354,7 +3357,7 @@ install_subdir('factory/etc', + install_dir : factorydir) + + install_data('xorg/50-systemd-user.sh', +- install_dir : xinitrcdir) ++ install_dir : factoryxinitrcdir) + install_data('modprobe.d/systemd.conf', + install_dir : modprobedir) + install_data('LICENSE.GPL2', +diff --git a/network/meson.build b/network/meson.build +index 99a650eac3..8105a4e48d 100644 +--- a/network/meson.build ++++ b/network/meson.build +@@ -11,7 +11,7 @@ if conf.get('ENABLE_NETWORKD') == 1 + install_dir : networkdir) + + meson.add_install_script('sh', '-c', +- mkdir_p.format(join_paths(sysconfdir, 'systemd/network'))) ++ mkdir_p.format(join_paths(factoryconfdir, 'systemd/network'))) + endif + + install_data('99-default.link', +diff --git a/src/core/meson.build b/src/core/meson.build +index fa95108523..60ee0e31c1 100644 +--- a/src/core/meson.build ++++ b/src/core/meson.build +@@ -183,8 +183,8 @@ libcore = static_library( + systemd_sources = files('main.c') + + in_files = [['macros.systemd', rpmmacrosdir], +- ['system.conf', pkgsysconfdir], +- ['user.conf', pkgsysconfdir], ++ ['system.conf', factorypkgconfdir], ++ ['user.conf', factorypkgconfdir], + ['systemd.pc', pkgconfigdatadir], + ['triggers.systemd', '']] + +@@ -216,6 +216,6 @@ meson.add_install_script('sh', '-c', mkdir_p.format(systemsleepdir)) + meson.add_install_script('sh', '-c', mkdir_p.format(systemgeneratordir)) + meson.add_install_script('sh', '-c', mkdir_p.format(usergeneratordir)) + +-meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'system'))) +-meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'user'))) +-meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(sysconfdir, 'xdg/systemd'))) ++meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(factorypkgconfdir, 'system'))) ++meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(factorypkgconfdir, 'user'))) ++meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(factorypkgconfdir, 'xdg/systemd'))) +diff --git a/src/coredump/meson.build b/src/coredump/meson.build +index 7fa5942697..34c865dfa0 100644 +--- a/src/coredump/meson.build ++++ b/src/coredump/meson.build +@@ -15,7 +15,7 @@ coredumpctl_sources = files('coredumpctl.c') + + if conf.get('ENABLE_COREDUMP') == 1 + install_data('coredump.conf', +- install_dir : pkgsysconfdir) ++ install_dir : factorypkgconfdir) + endif + + tests += [ +diff --git a/src/home/meson.build b/src/home/meson.build +index 797f3a3c6d..232904ab42 100644 +--- a/src/home/meson.build ++++ b/src/home/meson.build +@@ -98,5 +98,5 @@ if conf.get('ENABLE_HOMED') == 1 + install_dir : polkitpolicydir) + + install_data('homed.conf', +- install_dir : pkgsysconfdir) ++ install_dir : factoryconfdir) + endif +diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build +index 87b8ba6495..daff8ec967 100644 +--- a/src/journal-remote/meson.build ++++ b/src/journal-remote/meson.build +@@ -49,7 +49,7 @@ if conf.get('ENABLE_REMOTE') ==1 and conf.get('HAVE_LIBCURL') == 1 + output : 'journal-upload.conf', + configuration : substs) + install_data(journal_upload_conf, +- install_dir : pkgsysconfdir) ++ install_dir : factorypkgconfdir) + endif + + if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1 +@@ -58,7 +58,7 @@ if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1 + output : 'journal-remote.conf', + configuration : substs) + install_data(journal_remote_conf, +- install_dir : pkgsysconfdir) ++ install_dir : factorypkgconfdir) + + install_data('browse.html', + install_dir : join_paths(pkgdatadir, 'gatewayd')) +diff --git a/src/journal/meson.build b/src/journal/meson.build +index 5796f77cac..75d975c260 100644 +--- a/src/journal/meson.build ++++ b/src/journal/meson.build +@@ -109,7 +109,7 @@ if conf.get('HAVE_QRENCODE') == 1 + endif + + install_data('journald.conf', +- install_dir : pkgsysconfdir) ++ install_dir : factorypkgconfdir) + + if get_option('create-log-dirs') + meson.add_install_script( +diff --git a/src/kernel-install/meson.build b/src/kernel-install/meson.build +index 9ae342dfba..65df666337 100644 +--- a/src/kernel-install/meson.build ++++ b/src/kernel-install/meson.build +@@ -14,5 +14,5 @@ if want_kernel_install + install_dir : kernelinstalldir) + + meson.add_install_script('sh', '-c', +- mkdir_p.format(join_paths(sysconfdir, 'kernel/install.d'))) ++ mkdir_p.format(join_paths(factoryconfdir, 'kernel/install.d'))) + endif +diff --git a/src/login/meson.build b/src/login/meson.build +index 0a7d3d5440..ff90149c1c 100644 +--- a/src/login/meson.build ++++ b/src/login/meson.build +@@ -75,7 +75,7 @@ if conf.get('ENABLE_LOGIND') == 1 + output : 'logind.conf', + configuration : substs) + install_data(logind_conf, +- install_dir : pkgsysconfdir) ++ install_dir : factorypkgconfdir) + + install_data('org.freedesktop.login1.conf', + install_dir : dbuspolicydir) +diff --git a/src/network/meson.build b/src/network/meson.build +index b3a88d9910..be56d1e9d7 100644 +--- a/src/network/meson.build ++++ b/src/network/meson.build +@@ -229,7 +229,7 @@ if conf.get('ENABLE_NETWORKD') == 1 + endif + + install_data('networkd.conf', +- install_dir : pkgsysconfdir) ++ install_dir : factorypkgconfdir) + + fuzzers += [ + [['src/network/fuzz-netdev-parser.c', +diff --git a/src/pstore/meson.build b/src/pstore/meson.build +index adbac24b54..e9dc88dfa2 100644 +--- a/src/pstore/meson.build ++++ b/src/pstore/meson.build +@@ -6,5 +6,5 @@ systemd_pstore_sources = files(''' + + if conf.get('ENABLE_PSTORE') == 1 + install_data('pstore.conf', +- install_dir : pkgsysconfdir) ++ install_dir : factorypkgconfdir) + endif +diff --git a/src/resolve/meson.build b/src/resolve/meson.build +index 92b67b6333..ac5b9a0b0a 100644 +--- a/src/resolve/meson.build ++++ b/src/resolve/meson.build +@@ -168,7 +168,7 @@ if conf.get('ENABLE_RESOLVE') == 1 + output : 'resolved.conf', + configuration : substs) + install_data(resolved_conf, +- install_dir : pkgsysconfdir) ++ install_dir : factorypkgconfdir) + + install_data('resolv.conf', + install_dir : rootlibexecdir) +diff --git a/src/timesync/meson.build b/src/timesync/meson.build +index e5c118c8db..19235df9ca 100644 +--- a/src/timesync/meson.build ++++ b/src/timesync/meson.build +@@ -27,7 +27,7 @@ if conf.get('ENABLE_TIMESYNCD') == 1 + output : 'timesyncd.conf', + configuration : substs) + install_data(timesyncd_conf, +- install_dir : pkgsysconfdir) ++ install_dir : factorypkgconfdir) + install_data('org.freedesktop.timesync1.conf', + install_dir : dbuspolicydir) + install_data('org.freedesktop.timesync1.service', +diff --git a/src/udev/meson.build b/src/udev/meson.build +index aa23b07090..ad004d803a 100644 +--- a/src/udev/meson.build ++++ b/src/udev/meson.build +@@ -186,7 +186,7 @@ foreach prog : [['ata_id/ata_id.c'], + endforeach + + install_data('udev.conf', +- install_dir : join_paths(sysconfdir, 'udev')) ++ install_dir : join_paths(factoryconfdir, 'udev')) + + configure_file( + input : 'udev.pc.in', +@@ -195,7 +195,7 @@ configure_file( + install_dir : pkgconfigdatadir == 'no' ? '' : pkgconfigdatadir) + + meson.add_install_script('sh', '-c', +- mkdir_p.format(join_paths(sysconfdir, 'udev/rules.d'))) ++ mkdir_p.format(join_paths(factoryconfdir, 'udev/rules.d'))) + + fuzzers += [ + [['src/udev/net/fuzz-link-parser.c', +diff --git a/sysctl.d/meson.build b/sysctl.d/meson.build +index 3f072e3db7..bd9f843eba 100644 +--- a/sysctl.d/meson.build ++++ b/sysctl.d/meson.build +@@ -27,4 +27,4 @@ foreach file : in_files + endforeach + + meson.add_install_script('sh', '-c', +- mkdir_p.format(join_paths(sysconfdir, 'sysctl.d'))) ++ mkdir_p.format(join_paths(factoryconfdir, 'sysctl.d'))) +diff --git a/tmpfiles.d/meson.build b/tmpfiles.d/meson.build +index 0a9582d8b9..3c56ca7d83 100644 +--- a/tmpfiles.d/meson.build ++++ b/tmpfiles.d/meson.build +@@ -58,5 +58,5 @@ endforeach + if enable_tmpfiles + meson.add_install_script( + 'sh', '-c', +- mkdir_p.format(join_paths(sysconfdir, 'tmpfiles.d'))) ++ mkdir_p.format(join_paths(factoryconfdir, 'tmpfiles.d'))) + endif +diff --git a/units/meson.build b/units/meson.build +index 275daad3f4..491abd8eef 100644 +--- a/units/meson.build ++++ b/units/meson.build +@@ -324,7 +324,7 @@ install_data('user-.slice.d/10-defaults.conf', + + meson.add_install_script(meson_make_symlink, + join_paths(pkgsysconfdir, 'user'), +- join_paths(sysconfdir, 'xdg/systemd/user')) ++ join_paths(factorypkgconfdir, 'xdg/systemd/user')) + meson.add_install_script(meson_make_symlink, + join_paths(dbussystemservicedir, 'org.freedesktop.systemd1.service'), + join_paths(dbussessionservicedir, 'org.freedesktop.systemd1.service')) +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0013-inherit-systemd-environment-when-calling-generators.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0013-inherit-systemd-environment-when-calling-generators.patch new file mode 100644 index 000000000000..8df92b3e14f9 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0013-inherit-systemd-environment-when-calling-generators.patch @@ -0,0 +1,42 @@ +From 4cbc82570aa8671d260c37df58688cc07106e4b6 Mon Sep 17 00:00:00 2001 +From: Andreas Rammhold <andreas@rammhold.de> +Date: Fri, 2 Nov 2018 21:15:42 +0100 +Subject: [PATCH 13/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 | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/src/core/manager.c b/src/core/manager.c +index 6b7908fc6c..dff265c76f 100644 +--- a/src/core/manager.c ++++ b/src/core/manager.c +@@ -4098,9 +4098,14 @@ 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); +- ++ (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); + r = 0; + + finish: +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0014-add-rootprefix-to-lookup-dir-paths.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0014-add-rootprefix-to-lookup-dir-paths.patch new file mode 100644 index 000000000000..bb7a9f9474f1 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0014-add-rootprefix-to-lookup-dir-paths.patch @@ -0,0 +1,38 @@ +From 1f39dba787e07d0a6944416ec172ee5d7cc86acd Mon Sep 17 00:00:00 2001 +From: Andreas Rammhold <andreas@rammhold.de> +Date: Thu, 9 May 2019 11:15:22 +0200 +Subject: [PATCH 14/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 970654a1ad..bb261040f8 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.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0015-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0015-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch new file mode 100644 index 000000000000..86ab43c19085 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0015-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch @@ -0,0 +1,27 @@ +From f7c462d37063b0077345395f54377c39d1ef0590 Mon Sep 17 00:00:00 2001 +From: Nikolay Amiantov <ab@fmap.me> +Date: Thu, 25 Jul 2019 20:45:55 +0300 +Subject: [PATCH 15/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 06c9710c6e..dadcc3117d 100644 +--- a/src/shutdown/shutdown.c ++++ b/src/shutdown/shutdown.c +@@ -312,7 +312,7 @@ int main(int argc, char *argv[]) { + _cleanup_free_ char *cgroup = NULL; + char *arguments[3], *watchdog_device; + 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.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0016-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0016-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch new file mode 100644 index 000000000000..8d20b3723af0 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0016-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch @@ -0,0 +1,26 @@ +From ff7cfe2d112eb166cd1937c3cc8c25491e508313 Mon Sep 17 00:00:00 2001 +From: Nikolay Amiantov <ab@fmap.me> +Date: Thu, 25 Jul 2019 20:46:58 +0300 +Subject: [PATCH 16/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 600e9c23c0..66ef1a99e1 100644 +--- a/src/sleep/sleep.c ++++ b/src/sleep/sleep.c +@@ -182,6 +182,7 @@ static int execute(char **modes, char **states) { + }; + static const char* const dirs[] = { + SYSTEM_SLEEP_PATH, ++ "/etc/systemd/system-sleep", + NULL + }; + +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0017-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0017-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch new file mode 100644 index 000000000000..6dc33fd0341a --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0017-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch @@ -0,0 +1,27 @@ +From 600ac2dd3fc15c5717fcdf8f37899fdabf97268c Mon Sep 17 00:00:00 2001 +From: Florian Klink <flokli@flokli.de> +Date: Sat, 7 Mar 2020 22:40:27 +0100 +Subject: [PATCH 17/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 0971edf9ec..87105a87b9 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 for the current kernel + 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.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0018-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0018-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch new file mode 100644 index 000000000000..bf011f701ec6 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0018-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch @@ -0,0 +1,33 @@ +From 42419ff4dc7a36607189f8d3765aa836d5c5eaf9 Mon Sep 17 00:00:00 2001 +From: Florian Klink <flokli@flokli.de> +Date: Sun, 8 Mar 2020 01:05:54 +0100 +Subject: [PATCH 18/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 30031fca8e..d97145539a 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.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0019-logind-seat-debus-show-CanMultiSession-again.patch b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0019-logind-seat-debus-show-CanMultiSession-again.patch new file mode 100644 index 000000000000..4f8cc0822d36 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/0019-logind-seat-debus-show-CanMultiSession-again.patch @@ -0,0 +1,26 @@ +From 3999d8949ddaf9296928f603661abcea13576d83 Mon Sep 17 00:00:00 2001 +From: Thomas Tuegel <ttuegel@mailbox.org> +Date: Mon, 26 Oct 2020 21:21:38 +0100 +Subject: [PATCH 19/19] logind-seat-debus: show CanMultiSession again + +Fixes the "switch user" function in Plasma < 5.20. +--- + src/login/logind-seat-dbus.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/login/logind-seat-dbus.c b/src/login/logind-seat-dbus.c +index a91765205c..742aeb1064 100644 +--- a/src/login/logind-seat-dbus.c ++++ b/src/login/logind-seat-dbus.c +@@ -451,7 +451,7 @@ static const sd_bus_vtable seat_vtable[] = { + + SD_BUS_PROPERTY("Id", "s", NULL, offsetof(Seat, id), SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("ActiveSession", "(so)", property_get_active_session, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), +- SD_BUS_PROPERTY("CanMultiSession", "b", property_get_const_true, 0, SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_HIDDEN), ++ SD_BUS_PROPERTY("CanMultiSession", "b", property_get_const_true, 0, SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("CanTTY", "b", property_get_can_tty, 0, SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("CanGraphical", "b", property_get_can_graphical, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), + SD_BUS_PROPERTY("Sessions", "a(so)", property_get_sessions, 0, 0), +-- +2.28.0 + diff --git a/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/default.nix b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/default.nix new file mode 100644 index 000000000000..f7a51ff9a036 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/os-specific/linux/systemd/default.nix @@ -0,0 +1,433 @@ +{ stdenv +, lib +, fetchFromGitHub +, buildPackages +, ninja +, meson +, m4 +, pkgconfig +, coreutils +, gperf +, getent +, patchelf +, glibcLocales +, glib +, substituteAll +, gettext +, python3Packages + + # Mandatory dependencies +, libcap +, util-linux +, kbd +, kmod + + # Optional dependencies +, pam +, cryptsetup +, lvm2 +, audit +, acl +, lz4 +, libgcrypt +, libgpgerror +, libidn2 +, curl +, gnutar +, gnupg +, zlib +, xz +, libuuid +, libapparmor +, intltool +, bzip2 +, pcre2 +, e2fsprogs +, linuxHeaders ? stdenv.cc.libc.linuxHeaders +, gnu-efi +, iptables +, withSelinux ? false +, libselinux +, withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms +, libseccomp +, withKexectools ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) kexectools.meta.platforms +, kexectools +, bashInteractive +, libmicrohttpd + +, withAnalyze ? true +, withApparmor ? true +, withCompression ? true # adds bzip2, lz4 and xz +, withCoredump ? true +, withCryptsetup ? true +, withDocumentation ? true +, withEfi ? stdenv.hostPlatform.isEfi +, withHomed ? false +, withHostnamed ? true +, withHwdb ? true +, withImportd ? true +, withLocaled ? true +, withLogind ? true +, withMachined ? true +, withNetworkd ? true +, withNss ? true +, withPCRE2 ? true +, withPolkit ? true +, withPortabled ? false +, withRemote ? true +, withResolved ? true +, withShellCompletions ? true +, withTimedated ? true +, withTimesyncd ? true +, withUserDb ? true +, p11-kit +, libfido2 + + # name argument +, pname ? "systemd" + + +, libxslt +, docbook_xsl +, docbook_xml_dtd_42 +, docbook_xml_dtd_45 +}: + +assert withResolved -> (libgcrypt != null && libgpgerror != null); +assert withImportd -> +(curl.dev != null && zlib != null && xz != null && libgcrypt != null + && gnutar != null && gnupg != null && withCompression); + +assert withEfi -> (gnu-efi != null); +assert withRemote -> lib.getDev curl != null; +assert withCoredump -> withCompression; + +assert withHomed -> withCryptsetup; + +assert withCryptsetup -> +(cryptsetup != null); +let + wantCurl = withRemote || withImportd; + + version = "246.6"; +in +stdenv.mkDerivation { + inherit version pname; + + # We use systemd/systemd-stable for src, and ship NixOS-specific patches inside nixpkgs directly + # This has proven to be less error-prone than the previous systemd fork. + src = fetchFromGitHub { + owner = "systemd"; + repo = "systemd-stable"; + rev = "v${version}"; + sha256 = "1yhj2jlighqqpw1xk9q52f3pncjn47ipi224k35d6syb94q2b988"; + }; + + # If these need to be regenerated, `git am path/to/00*.patch` them into a + # systemd worktree, rebase to the more recent systemd version, and export the + # patches again via `git format-patch v${version}`. + patches = [ + ./0001-Start-device-units-for-uninitialised-encrypted-devic.patch + ./0002-Don-t-try-to-unmount-nix-or-nix-store.patch + ./0003-Fix-NixOS-containers.patch + ./0004-Look-for-fsck-in-the-right-place.patch + ./0005-Add-some-NixOS-specific-unit-directories.patch + ./0006-Get-rid-of-a-useless-message-in-user-sessions.patch + ./0007-hostnamed-localed-timedated-disable-methods-that-cha.patch + ./0008-Fix-hwdb-paths.patch + ./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-Install-default-configuration-into-out-share-factory.patch + ./0013-inherit-systemd-environment-when-calling-generators.patch + ./0014-add-rootprefix-to-lookup-dir-paths.patch + ./0015-systemd-shutdown-execute-scripts-in-etc-systemd-syst.patch + ./0016-systemd-sleep-execute-scripts-in-etc-systemd-system-.patch + ./0017-kmod-static-nodes.service-Update-ConditionFileNotEmp.patch + ./0018-path-util.h-add-placeholder-for-DEFAULT_PATH_NORMAL.patch + ./0019-logind-seat-debus-show-CanMultiSession-again.patch + ]; + + postPatch = '' + substituteInPlace src/basic/path-util.h --replace "@defaultPathNormal@" "${placeholder "out"}/bin/" + substituteInPlace src/boot/efi/meson.build \ + --replace \ + "find_program('ld'" \ + "find_program('${stdenv.cc.bintools.targetPrefix}ld'" \ + --replace \ + "find_program('objcopy'" \ + "find_program('${stdenv.cc.bintools.targetPrefix}objcopy'" + ''; + + outputs = [ "out" "man" "dev" ]; + + nativeBuildInputs = + [ + pkgconfig + gperf + ninja + meson + coreutils # meson calls date, stat etc. + glibcLocales + patchelf + getent + m4 + + intltool + gettext + + libxslt + docbook_xsl + docbook_xml_dtd_42 + docbook_xml_dtd_45 + (buildPackages.python3Packages.python.withPackages (ps: with ps; [ python3Packages.lxml ])) + ]; + + buildInputs = + [ + acl + audit + glib + kmod + libcap + libgcrypt + libidn2 + libuuid + linuxHeaders + pam + ] + + ++ lib.optional withApparmor libapparmor + ++ lib.optional wantCurl (lib.getDev curl) + ++ lib.optionals withCompression [ bzip2 lz4 xz ] + ++ lib.optional withCryptsetup (lib.getDev cryptsetup.dev) + ++ lib.optional withEfi gnu-efi + ++ lib.optional withKexectools kexectools + ++ lib.optional withLibseccomp libseccomp + ++ lib.optional withNetworkd iptables + ++ lib.optional withPCRE2 pcre2 + ++ lib.optional withResolved libgpgerror + ++ lib.optional withSelinux libselinux + ++ lib.optional withRemote libmicrohttpd + ++ lib.optionals withHomed [ p11-kit libfido2 ] + ; + + #dontAddPrefix = true; + + mesonFlags = [ + "-Ddbuspolicydir=${placeholder "out"}/share/dbus-1/system.d" + "-Ddbussessionservicedir=${placeholder "out"}/share/dbus-1/services" + "-Ddbussystemservicedir=${placeholder "out"}/share/dbus-1/system-services" + "-Dpamconfdir=${placeholder "out"}/etc/pam.d" + "-Drootprefix=${placeholder "out"}" + "-Dpkgconfiglibdir=${placeholder "dev"}/lib/pkgconfig" + "-Dpkgconfigdatadir=${placeholder "dev"}/share/pkgconfig" + "-Dloadkeys-path=${kbd}/bin/loadkeys" + "-Dsetfont-path=${kbd}/bin/setfont" + "-Dtty-gid=3" # tty in NixOS has gid 3 + "-Ddebug-shell=${bashInteractive}/bin/bash" + "-Dglib=${lib.boolToString (glib != null)}" + # while we do not run tests we should also not build them. Removes about 600 targets + "-Dtests=false" + "-Danalyze=${lib.boolToString withAnalyze}" + "-Dgcrypt=${lib.boolToString (libgcrypt != null)}" + "-Dimportd=${lib.boolToString withImportd}" + "-Dlz4=${lib.boolToString withCompression}" + "-Dhomed=${stdenv.lib.boolToString withHomed}" + "-Dlogind=${lib.boolToString withLogind}" + "-Dlocaled=${lib.boolToString withLocaled}" + "-Dhostnamed=${lib.boolToString withHostnamed}" + "-Dmachined=${lib.boolToString withMachined}" + "-Dnetworkd=${lib.boolToString withNetworkd}" + "-Dpolkit=${lib.boolToString withPolkit}" + "-Dcryptsetup=${lib.boolToString withCryptsetup}" + "-Dportabled=${lib.boolToString withPortabled}" + "-Dhwdb=${lib.boolToString withHwdb}" + "-Dremote=${lib.boolToString withRemote}" + "-Dsysusers=false" + "-Dtimedated=${lib.boolToString withTimedated}" + "-Dtimesyncd=${lib.boolToString withTimesyncd}" + "-Duserdb=${lib.boolToString withUserDb}" + "-Dcoredump=${lib.boolToString withCoredump}" + "-Dfirstboot=false" + "-Dresolve=${lib.boolToString withResolved}" + "-Dsplit-usr=false" + "-Dlibcurl=${lib.boolToString wantCurl}" + "-Dlibidn=false" + "-Dlibidn2=true" + "-Dquotacheck=false" + "-Dldconfig=false" + "-Dsmack=true" + "-Db_pie=true" + /* + As of now, systemd doesn't allow runtime configuration of these values. So + the settings in /etc/login.defs have no effect on it. Many people think this + should be supported however, see + - https://github.com/systemd/systemd/issues/3855 + - https://github.com/systemd/systemd/issues/4850 + - https://github.com/systemd/systemd/issues/9769 + - https://github.com/systemd/systemd/issues/9843 + - https://github.com/systemd/systemd/issues/10184 + */ + "-Dsystem-uid-max=999" + "-Dsystem-gid-max=999" + # "-Dtime-epoch=1" + + "-Dsysvinit-path=" + "-Dsysvrcnd-path=" + + "-Dkill-path=${coreutils}/bin/kill" + "-Dkmod-path=${kmod}/bin/kmod" + "-Dsulogin-path=${util-linux}/bin/sulogin" + "-Dmount-path=${util-linux}/bin/mount" + "-Dumount-path=${util-linux}/bin/umount" + "-Dcreate-log-dirs=false" + + # Use cgroupsv2. This is already the upstream default, but better be explicit. + "-Ddefault-hierarchy=unified" + # Upstream defaulted to disable manpages since they optimize for the much + # more frequent development builds + "-Dman=true" + + "-Defi=${lib.boolToString withEfi}" + "-Dgnu-efi=${lib.boolToString withEfi}" + ] ++ lib.optionals withEfi [ + "-Defi-libdir=${toString gnu-efi}/lib" + "-Defi-includedir=${toString gnu-efi}/include/efi" + "-Defi-ldsdir=${toString gnu-efi}/lib" + ] ++ lib.optionals (withShellCompletions == false) [ + "-Dbashcompletiondir=no" + "-Dzshcompletiondir=no" + ] ++ lib.optionals (!withNss) [ + "-Dnss-myhostname=false" + "-Dnss-mymachines=false" + "-Dnss-resolve=false" + "-Dnss-systemd=false" + ]; + + preConfigure = '' + mesonFlagsArray+=(-Dntp-servers="0.nixos.pool.ntp.org 1.nixos.pool.ntp.org 2.nixos.pool.ntp.org 3.nixos.pool.ntp.org") + export LC_ALL="en_US.UTF-8"; + # FIXME: patch this in systemd properly (and send upstream). + # already fixed in f00929ad622c978f8ad83590a15a765b4beecac9: (u)mount + for i in \ + src/core/mount.c \ + src/core/swap.c \ + src/cryptsetup/cryptsetup-generator.c \ + src/journal/cat.c \ + src/nspawn/nspawn.c \ + src/remount-fs/remount-fs.c \ + src/shared/generator.c \ + src/shutdown/shutdown.c \ + units/emergency.service.in \ + units/rescue.service.in \ + units/systemd-logind.service.in \ + units/systemd-nspawn@.service.in; \ + do + test -e $i + substituteInPlace $i \ + --replace /usr/bin/getent ${getent}/bin/getent \ + --replace /sbin/mkswap ${lib.getBin util-linux}/sbin/mkswap \ + --replace /sbin/swapon ${lib.getBin util-linux}/sbin/swapon \ + --replace /sbin/swapoff ${lib.getBin util-linux}/sbin/swapoff \ + --replace /bin/echo ${coreutils}/bin/echo \ + --replace /bin/cat ${coreutils}/bin/cat \ + --replace /sbin/sulogin ${lib.getBin util-linux}/sbin/sulogin \ + --replace /sbin/modprobe ${lib.getBin kmod}/sbin/modprobe \ + --replace /usr/lib/systemd/systemd-fsck $out/lib/systemd/systemd-fsck \ + --replace /bin/plymouth /run/current-system/sw/bin/plymouth # To avoid dependency + done + + for dir in tools src/resolve test src/test; do + patchShebangs $dir + done + + # absolute paths to gpg & tar + substituteInPlace src/import/pull-common.c \ + --replace '"gpg"' '"${gnupg}/bin/gpg"' + for file in src/import/{{export,import,pull}-tar,import-common}.c; do + substituteInPlace $file \ + --replace '"tar"' '"${gnutar}/bin/tar"' + done + + substituteInPlace src/journal/catalog.c \ + --replace /usr/lib/systemd/catalog/ $out/lib/systemd/catalog/ + ''; + + # These defines are overridden by CFLAGS and would trigger annoying + # warning messages + postConfigure = '' + substituteInPlace config.h \ + --replace "POLKIT_AGENT_BINARY_PATH" "_POLKIT_AGENT_BINARY_PATH" \ + --replace "SYSTEMD_BINARY_PATH" "_SYSTEMD_BINARY_PATH" \ + --replace "SYSTEMD_CGROUP_AGENT_PATH" "_SYSTEMD_CGROUP_AGENT_PATH" + ''; + + NIX_CFLAGS_COMPILE = toString [ + # Can't say ${polkit.bin}/bin/pkttyagent here because that would + # lead to a cyclic dependency. + "-UPOLKIT_AGENT_BINARY_PATH" + "-DPOLKIT_AGENT_BINARY_PATH=\"/run/current-system/sw/bin/pkttyagent\"" + + # Set the release_agent on /sys/fs/cgroup/systemd to the + # currently running systemd (/run/current-system/systemd) so + # that we don't use an obsolete/garbage-collected release agent. + "-USYSTEMD_CGROUP_AGENT_PATH" + "-DSYSTEMD_CGROUP_AGENT_PATH=\"/run/current-system/systemd/lib/systemd/systemd-cgroups-agent\"" + + "-USYSTEMD_BINARY_PATH" + "-DSYSTEMD_BINARY_PATH=\"/run/current-system/systemd/lib/systemd/systemd\"" + ]; + + doCheck = false; # fails a bunch of tests + + # trigger the test -n "$DESTDIR" || mutate in upstreams build system + preInstall = '' + export DESTDIR=/ + ''; + + postInstall = '' + # sysinit.target: Don't depend on + # systemd-tmpfiles-setup.service. This interferes with NixOps's + # send-keys feature (since sshd.service depends indirectly on + # sysinit.target). + mv $out/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service $out/lib/systemd/system/multi-user.target.wants/ + + mkdir -p $out/example/systemd + mv $out/lib/{modules-load.d,binfmt.d,sysctl.d,tmpfiles.d} $out/example + mv $out/lib/systemd/{system,user} $out/example/systemd + + rm -rf $out/etc/systemd/system + + # Fix reference to /bin/false in the D-Bus services. + for i in $out/share/dbus-1/system-services/*.service; do + substituteInPlace $i --replace /bin/false ${coreutils}/bin/false + done + + rm -rf $out/etc/rpm + + # "kernel-install" shouldn't be used on NixOS. + find $out -name "*kernel-install*" -exec rm {} \; + '' + lib.optionalString (!withDocumentation) '' + rm -rf $out/share/doc + ''; + + enableParallelBuilding = true; + + # The interface version prevents NixOS from switching to an + # incompatible systemd at runtime. (Switching across reboots is + # fine, of course.) It should be increased whenever systemd changes + # in a backwards-incompatible way. If the interface version of two + # systemd builds is the same, then we can switch between them at + # runtime; otherwise we can't and we need to reboot. + passthru.interfaceVersion = 2; + + meta = with lib; { + homepage = "https://www.freedesktop.org/wiki/Software/systemd/"; + description = "A system and service manager for Linux"; + license = licenses.lgpl21Plus; + platforms = platforms.linux; + priority = 10; + maintainers = with maintainers; [ andir eelco flokli kloenk ]; + }; +} |