From 2e41a1bab32e49568a037ddd962ebbe01c8c2f40 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Wed, 7 Sep 2022 10:09:17 -0700 Subject: [PATCH] systemd: handle `Install.RequiredBy` Units with Install.RequiredBy = [ target ] set will now be linked in the ${target}.requires directory. Similar to how `Install.WantedBy` already causes a link in the ${target}.wants directory. --- modules/systemd.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/systemd.nix b/modules/systemd.nix index 0be586d7..ff70edf8 100644 --- a/modules/systemd.nix +++ b/modules/systemd.nix @@ -44,14 +44,15 @@ let destination = "/${filename}"; } + "/${filename}"; - wantedBy = target: { - name = "systemd/user/${target}.wants/${filename}"; + install = variant: target: { + name = "systemd/user/${target}.${variant}/${filename}"; value = { inherit source; }; }; in lib.singleton { name = "systemd/user/${filename}"; value = { inherit source; }; - } ++ map wantedBy (serviceCfg.Install.WantedBy or [ ]); + } ++ map (install "wants") (serviceCfg.Install.WantedBy or [ ]) + ++ map (install "requires") (serviceCfg.Install.RequiredBy or [ ]); buildServices = style: serviceCfgs: lib.concatLists (lib.mapAttrsToList (buildService style) serviceCfgs);