mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-03 15:41:02 +01:00
aerospace: add assertion to ensure launchd.enable and after-startup-command are used instead of start-at-login and after-login-command
This commit is contained in:
parent
f302550865
commit
29b672194d
1 changed files with 41 additions and 1 deletions
|
|
@ -135,6 +135,46 @@ in
|
|||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "programs.aerospace" pkgs lib.platforms.darwin)
|
||||
|
||||
# 1. Fail if user sets start-at-login = true BUT launchd is disabled.
|
||||
{
|
||||
assertion =
|
||||
!((lib.hasAttr "start-at-login" cfg.settings) && (cfg.settings."start-at-login" == true))
|
||||
|| (cfg.launchd.enable == true);
|
||||
message = ''
|
||||
You have set `programs.aerospace.settings."start-at-login" = true;`
|
||||
but `programs.aerospace.launchd.enable` is false.
|
||||
|
||||
This tells AeroSpace to manage its own startup, which can conflict
|
||||
with Home Manager.
|
||||
|
||||
To manage startup with Home Manager, please set
|
||||
`programs.aerospace.launchd.enable = true;`
|
||||
(You can leave `start-at-login = true` in your settings, it will be
|
||||
correctly overridden).
|
||||
'';
|
||||
}
|
||||
|
||||
# 2. Fail if user sets after-login-command (in any case).
|
||||
{
|
||||
assertion =
|
||||
!(
|
||||
(lib.hasAttr "after-login-command" cfg.settings)
|
||||
&& (lib.isList cfg.settings."after-login-command")
|
||||
&& (cfg.settings."after-login-command" != [ ])
|
||||
);
|
||||
message = ''
|
||||
You have set `programs.aerospace.settings."after-login-command"`.
|
||||
|
||||
This setting is not supported when using this Home Manager module,
|
||||
as it either conflicts with the launchd service (if enabled)
|
||||
or bypasses it (if disabled).
|
||||
|
||||
The correct way to run commands after AeroSpace starts is to use:
|
||||
1. `programs.aerospace.launchd.enable = true;`
|
||||
2. `programs.aerospace.settings."after-startup-command" = [ ... ];`
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
home = {
|
||||
|
|
@ -145,7 +185,7 @@ in
|
|||
generatedConfig = tomlFormat.generate "aerospace" (
|
||||
filterNulls (
|
||||
cfg.settings
|
||||
// lib.optionalAttrs cfg.launchd.enable {
|
||||
// {
|
||||
# Override these to avoid launchd conflicts
|
||||
start-at-login = false;
|
||||
after-login-command = [ ];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue