linux_6_1: 6.1.117 -> 6.1.118
[NixPkgs.git] / pkgs / os-specific / linux / systemd / 0004-Add-some-NixOS-specific-unit-directories.patch
blob46623e87e8c30fdfa0eac7f2c6df559b5a4f3fdf
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Raito Bezarius <masterancpp@gmail.com>
3 Date: Mon, 19 Jun 2023 02:13:42 +0200
4 Subject: [PATCH] Add some NixOS-specific unit directories
6 Look in `/nix/var/nix/profiles/default/lib/systemd/{system,user}` for
7 units provided by packages installed into the default profile via
8 `nix-env -iA nixos.$package`.
10 Also, remove /usr and /lib as these don't exist on NixOS.
12 Original-Author: Eelco Dolstra <eelco.dolstra@logicblox.com>
13 ---
14 src/basic/path-lookup.c | 18 ++----------------
15 src/core/systemd.pc.in | 8 ++++----
16 2 files changed, 6 insertions(+), 20 deletions(-)
18 diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c
19 index 540256b73b..a115ec09a3 100644
20 --- a/src/basic/path-lookup.c
21 +++ b/src/basic/path-lookup.c
22 @@ -123,11 +123,7 @@ int runtime_directory(char **ret, RuntimeScope scope, const char *suffix) {
25 static const char* const user_data_unit_paths[] = {
26 - "/usr/local/lib/systemd/user",
27 - "/usr/local/share/systemd/user",
28 USER_DATA_UNIT_DIR,
29 - "/usr/lib/systemd/user",
30 - "/usr/share/systemd/user",
31 NULL
34 @@ -634,16 +630,13 @@ int lookup_paths_init(
35 persistent_config,
36 SYSTEM_CONFIG_UNIT_DIR,
37 "/etc/systemd/system",
38 + "/nix/var/nix/profiles/default/lib/systemd/system",
39 STRV_IFNOTNULL(persistent_attached),
40 runtime_config,
41 "/run/systemd/system",
42 STRV_IFNOTNULL(runtime_attached),
43 STRV_IFNOTNULL(generator),
44 - "/usr/local/lib/systemd/system",
45 SYSTEM_DATA_UNIT_DIR,
46 - "/usr/lib/systemd/system",
47 - /* To be used ONLY for images which might be legacy split-usr */
48 - STRV_IFNOTNULL(flags & LOOKUP_PATHS_SPLIT_USR ? "/lib/systemd/system" : NULL),
49 STRV_IFNOTNULL(generator_late));
50 break;
52 @@ -659,14 +652,11 @@ int lookup_paths_init(
53 persistent_config,
54 USER_CONFIG_UNIT_DIR,
55 "/etc/systemd/user",
56 + "/nix/var/nix/profiles/default/lib/systemd/user",
57 runtime_config,
58 "/run/systemd/user",
59 STRV_IFNOTNULL(generator),
60 - "/usr/local/share/systemd/user",
61 - "/usr/share/systemd/user",
62 - "/usr/local/lib/systemd/user",
63 USER_DATA_UNIT_DIR,
64 - "/usr/lib/systemd/user",
65 STRV_IFNOTNULL(generator_late));
66 break;
68 @@ -825,7 +815,6 @@ char **generator_binary_paths(RuntimeScope scope) {
69 case RUNTIME_SCOPE_SYSTEM:
70 add = strv_new("/run/systemd/system-generators",
71 "/etc/systemd/system-generators",
72 - "/usr/local/lib/systemd/system-generators",
73 SYSTEM_GENERATOR_DIR);
74 break;
76 @@ -833,7 +822,6 @@ char **generator_binary_paths(RuntimeScope scope) {
77 case RUNTIME_SCOPE_USER:
78 add = strv_new("/run/systemd/user-generators",
79 "/etc/systemd/user-generators",
80 - "/usr/local/lib/systemd/user-generators",
81 USER_GENERATOR_DIR);
82 break;
84 @@ -872,14 +860,12 @@ char **env_generator_binary_paths(RuntimeScope runtime_scope) {
85 case RUNTIME_SCOPE_SYSTEM:
86 add = strv_new("/run/systemd/system-environment-generators",
87 "/etc/systemd/system-environment-generators",
88 - "/usr/local/lib/systemd/system-environment-generators",
89 SYSTEM_ENV_GENERATOR_DIR);
90 break;
92 case RUNTIME_SCOPE_USER:
93 add = strv_new("/run/systemd/user-environment-generators",
94 "/etc/systemd/user-environment-generators",
95 - "/usr/local/lib/systemd/user-environment-generators",
96 USER_ENV_GENERATOR_DIR);
97 break;
99 diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in
100 index f3b85b0190..8ae544b495 100644
101 --- a/src/core/systemd.pc.in
102 +++ b/src/core/systemd.pc.in
103 @@ -43,10 +43,10 @@ systemdsystemconfdir=${systemd_system_conf_dir}
104 systemd_user_conf_dir=${sysconfdir}/systemd/user
105 systemduserconfdir=${systemd_user_conf_dir}
107 -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
108 +systemd_system_unit_path=${systemd_system_conf_dir}:/etc/systemd/system:/nix/var/nix/profiles/default/lib/systemd/system:/run/systemd/system:${systemdsystemunitdir}
109 systemdsystemunitpath=${systemd_system_unit_path}
111 -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
112 +systemd_user_unit_path=${systemd_user_conf_dir}:/etc/systemd/user:/nix/var/nix/profiles/default/lib/systemd/user:/run/systemd/user:${systemduserunitdir}
113 systemduserunitpath=${systemd_user_unit_path}
115 systemd_system_generator_dir=${prefix}/lib/systemd/system-generators
116 @@ -55,10 +55,10 @@ systemdsystemgeneratordir=${systemd_system_generator_dir}
117 systemd_user_generator_dir=${prefix}/lib/systemd/user-generators
118 systemdusergeneratordir=${systemd_user_generator_dir}
120 -systemd_system_generator_path=/run/systemd/system-generators:/etc/systemd/system-generators:/usr/local/lib/systemd/system-generators:${systemd_system_generator_dir}
121 +systemd_system_generator_path=/run/systemd/system-generators:/etc/systemd/system-generators:${systemd_system_generator_dir}
122 systemdsystemgeneratorpath=${systemd_system_generator_path}
124 -systemd_user_generator_path=/run/systemd/user-generators:/etc/systemd/user-generators:/usr/local/lib/systemd/user-generators:${systemd_user_generator_dir}
125 +systemd_user_generator_path=/run/systemd/user-generators:/etc/systemd/user-generators:${systemd_user_generator_dir}
126 systemdusergeneratorpath=${systemd_user_generator_path}
128 systemd_sleep_dir=${prefix}/lib/systemd/system-sleep