ghostty: use the systemd X-Base option

This commit is contained in:
Robert Helgesson
2026-01-09 19:44:53 +01:00
parent ef0a84e496
commit fb4c7e7ed2
2 changed files with 13 additions and 16 deletions

View File

@@ -225,22 +225,18 @@ in
}
];
xdg.configFile."systemd/user/app-com.mitchellh.ghostty.service".source =
"${cfg.package}/share/systemd/user/app-com.mitchellh.ghostty.service";
xdg.configFile."systemd/user/app-com.mitchellh.ghostty.service.d/overrides.conf".text = ''
[Unit]
X-SwitchMethod=keep-old
X-Reload-Triggers=${
let
storePathOf = name: config.xdg.configFile.${name}.source;
in
toString (
systemd.user.services."app-com.mitchellh.ghostty" = {
Unit = {
X-Base = "${cfg.package}/share/systemd/user/app-com.mitchellh.ghostty.service";
X-SwitchMethod = "keep-old";
X-Reload-Triggers =
let
storePathOf = name: config.xdg.configFile.${name}.source;
in
lib.optionals (cfg.settings != { }) [ (storePathOf "ghostty/config") ]
++ lib.mapAttrsToList (name: _: storePathOf "ghostty/themes/${name}") cfg.themes
)
}
'';
++ lib.mapAttrsToList (name: _: storePathOf "ghostty/themes/${name}") cfg.themes;
};
};
dbus.packages = [ cfg.package ];
})

View File

@@ -45,8 +45,9 @@
assertFileContent $(normalizeStorePaths $serviceOverridesPath) \
${builtins.toFile "ghostty-service-overrides" ''
[Unit]
X-Reload-Triggers=/nix/store/00000000000000000000000000000000-ghostty-config
X-Reload-Triggers=/nix/store/00000000000000000000000000000000-ghostty-catppuccin-mocha-theme
X-SwitchMethod=keep-old
X-Reload-Triggers=/nix/store/00000000000000000000000000000000-ghostty-config /nix/store/00000000000000000000000000000000-ghostty-catppuccin-mocha-theme
''}
assertFileContent \