This commit is contained in:
2026-03-04 21:56:41 +01:00
parent fc26270df4
commit ff644f312f
3 changed files with 347 additions and 331 deletions
+301 -296
View File
File diff suppressed because it is too large Load Diff
+11 -6
View File
@@ -1457,21 +1457,26 @@ The configuration is done in the home manager section.
** Setting the config ** Setting the config
#+begin_src nix :tangle configuration/end_script.nix :noweb tangle :mkdirp yes #+begin_src nix :tangle configuration/end_script.nix :noweb tangle :mkdirp yes
systemd.user.services.endScript = lib.mkIf scriptExists { { lib, ... }:
let
scriptPath = "/path/to/your/script";
scriptExists = lib.fileExists scriptPath;
in
{
systemd.user.services.endScript = lib.mkIf scriptExists {
description = "Run end script after Home Manager"; description = "Run end script after Home Manager";
wantedBy = [ ]; # Not needed for user services
after = [ after = [
"home-manager-activate.service" "home-manager-activate.service"
"graphical-session.target" # If using a graphical session "graphical-session.target"
]; ];
wantedBy = [ "default.target" ]; # This is redundant for user services
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = yes; RemainAfterExit = yes;
ExecStart = "${scriptPath}"; ExecStart = "${scriptPath}";
}; };
}; };
}
#+end_src #+end_src
+11 -5
View File
@@ -1,14 +1,20 @@
systemd.user.services.endScript = lib.mkIf scriptExists { { lib, ... }:
let
scriptPath = "/path/to/your/script";
scriptExists = lib.fileExists scriptPath;
in
{
systemd.user.services.endScript = lib.mkIf scriptExists {
description = "Run end script after Home Manager"; description = "Run end script after Home Manager";
wantedBy = [ ]; # Not needed for user services
after = [ after = [
"home-manager-activate.service" "home-manager-activate.service"
"graphical-session.target" # If using a graphical session "graphical-session.target"
]; ];
wantedBy = [ "default.target" ]; # This is redundant for user services
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = yes; RemainAfterExit = yes;
ExecStart = "${scriptPath}"; ExecStart = "${scriptPath}";
}; };
}; };
}