..
This commit is contained in:
+309
-304
File diff suppressed because it is too large
Load Diff
+19
-14
@@ -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, ... }:
|
||||||
description = "Run end script after Home Manager";
|
|
||||||
wantedBy = [ ]; # Not needed for user services
|
|
||||||
after = [
|
|
||||||
"home-manager-activate.service"
|
|
||||||
"graphical-session.target" # If using a graphical session
|
|
||||||
];
|
|
||||||
wantedBy = [ "default.target" ]; # This is redundant for user services
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
RemainAfterExit = yes;
|
|
||||||
ExecStart = "${scriptPath}";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
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";
|
||||||
|
after = [
|
||||||
|
"home-manager-activate.service"
|
||||||
|
"graphical-session.target"
|
||||||
|
];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = yes;
|
||||||
|
ExecStart = "${scriptPath}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
systemd.user.services.endScript = lib.mkIf scriptExists {
|
{ lib, ... }:
|
||||||
description = "Run end script after Home Manager";
|
|
||||||
wantedBy = [ ]; # Not needed for user services
|
let
|
||||||
after = [
|
scriptPath = "/path/to/your/script";
|
||||||
"home-manager-activate.service"
|
scriptExists = lib.fileExists scriptPath;
|
||||||
"graphical-session.target" # If using a graphical session
|
in
|
||||||
];
|
{
|
||||||
wantedBy = [ "default.target" ]; # This is redundant for user services
|
systemd.user.services.endScript = lib.mkIf scriptExists {
|
||||||
serviceConfig = {
|
description = "Run end script after Home Manager";
|
||||||
Type = "oneshot";
|
after = [
|
||||||
RemainAfterExit = yes;
|
"home-manager-activate.service"
|
||||||
ExecStart = "${scriptPath}";
|
"graphical-session.target"
|
||||||
|
];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = yes;
|
||||||
|
ExecStart = "${scriptPath}";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user