From fb4c7e7ed26a8326c91bdc0adb4b4fd214579ebf Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Fri, 9 Jan 2026 19:44:53 +0100 Subject: [PATCH] ghostty: use the systemd X-Base option --- modules/programs/ghostty.nix | 26 ++++++++----------- .../programs/ghostty/systemd-service.nix | 3 ++- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/modules/programs/ghostty.nix b/modules/programs/ghostty.nix index 152df981f..516e91591 100644 --- a/modules/programs/ghostty.nix +++ b/modules/programs/ghostty.nix @@ -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 ]; }) diff --git a/tests/modules/programs/ghostty/systemd-service.nix b/tests/modules/programs/ghostty/systemd-service.nix index ba6e1ff0b..c7100b265 100644 --- a/tests/modules/programs/ghostty/systemd-service.nix +++ b/tests/modules/programs/ghostty/systemd-service.nix @@ -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 \