summary refs log tree commit diff
path: root/pkgs/os-specific/linux/systemd/0005-Add-some-NixOS-specific-unit-directories.patch
blob: 8680d147ad17f2118622cf98ee13d884d93bc9aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
From 82698c6a5142e710c302f9c38367ed00d8ec94ba 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/19] 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
`nix-env -iA nixos.$package`.

Also, remove /usr and /lib as these don't exist on NixOS.
---
 src/basic/path-lookup.c | 17 ++---------------
 src/core/systemd.pc.in  |  8 ++++----
 2 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c
index 05eb17d66c..1cd141d012 100644
--- a/src/basic/path-lookup.c
+++ b/src/basic/path-lookup.c
@@ -91,11 +91,7 @@ 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
 };
 
@@ -613,15 +609,13 @@ int lookup_paths_init(
                                         persistent_config,
                                         SYSTEM_CONFIG_UNIT_DIR,
                                         "/etc/systemd/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_DIR,
-                                        "/usr/lib/systemd/system",
-                                        STRV_IFNOTNULL(flags & LOOKUP_PATHS_SPLIT_USR ? "/lib/systemd/system" : NULL),
                                         STRV_IFNOTNULL(generator_late));
                         break;
 
@@ -637,14 +631,11 @@ int lookup_paths_init(
                                         persistent_config,
                                         USER_CONFIG_UNIT_DIR,
                                         "/etc/systemd/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;
 
@@ -794,7 +785,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;
 
@@ -802,7 +792,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;
 
@@ -841,12 +830,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 fc0f8c34fa..ded74ce50a 100644
--- a/src/core/systemd.pc.in
+++ b/src/core/systemd.pc.in
@@ -38,10 +38,10 @@ 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:/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:/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
@@ -50,10 +50,10 @@ systemdsystemgeneratordir=${systemd_system_generator_dir}
 systemd_user_generator_dir=${prefix}/lib/systemd/user-generators
 systemdusergeneratordir=${systemd_user_generator_dir}
 
-systemd_system_generator_path=/run/systemd/system-generators:/etc/systemd/system-generators:/usr/local/lib/systemd/system-generators:${systemd_system_generator_dir}
+systemd_system_generator_path=/run/systemd/system-generators:/etc/systemd/system-generators:${systemd_system_generator_dir}
 systemdsystemgeneratorpath=${systemd_system_generator_path}
 
-systemd_user_generator_path=/run/systemd/user-generators:/etc/systemd/user-generators:/usr/local/lib/systemd/user-generators:${systemd_user_generator_dir}
+systemd_user_generator_path=/run/systemd/user-generators:/etc/systemd/user-generators:${systemd_user_generator_dir}
 systemdusergeneratorpath=${systemd_user_generator_path}
 
 systemd_sleep_dir=${root_prefix}/lib/systemd/system-sleep
-- 
2.32.0