Compare commits

...

4 Commits

Author SHA1 Message Date
Robert Helgesson
4fee4bd14b ghostty: reload service on configuration change 2026-01-07 17:22:44 -05:00
Austin Horstman
c068188a8e tests: output store path even for success
Useful when trying to double check the contents of a test directory even
when the tests are passing. ie: stub a test and see the stuff you want
to assert/validate.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-01-07 13:50:01 -05:00
Austin Horstman
bdaa374383 tests/hyprpaper: update basic configuration
Show the newer format and test the proper generation of config.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-01-07 11:07:21 -05:00
Austin Horstman
d28cc9f4a6 hyprpaper: add monitor importantPrefix
New config requires monitor at top of generated block.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-01-07 10:56:09 -05:00
6 changed files with 99 additions and 20 deletions

View File

@@ -231,6 +231,15 @@ in
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 (
lib.optionals (cfg.settings != { }) [ (storePathOf "ghostty/config") ]
++ lib.mapAttrsToList (name: _: storePathOf "ghostty/themes/${name}") cfg.themes
)
}
'';
dbus.packages = [ cfg.package ];

View File

@@ -64,7 +64,10 @@ in
importantPrefixes = lib.mkOption {
type = with lib.types; listOf str;
default = [ "$" ];
default = [
"$"
"monitor"
];
example = [ "$" ];
description = ''
List of prefix of attributes to source at the top of the config.

View File

@@ -8,6 +8,33 @@
theme = "catppuccin-mocha";
font-size = 10;
};
themes = {
catppuccin-mocha = {
palette = [
"0=#45475a"
"1=#f38ba8"
"2=#a6e3a1"
"3=#f9e2af"
"4=#89b4fa"
"5=#f5c2e7"
"6=#94e2d5"
"7=#bac2de"
"8=#585b70"
"9=#f38ba8"
"10=#a6e3a1"
"11=#f9e2af"
"12=#89b4fa"
"13=#f5c2e7"
"14=#94e2d5"
"15=#a6adc8"
];
background = "1e1e2e";
foreground = "cdd6f4";
cursor-color = "f5e0dc";
selection-background = "353749";
selection-foreground = "cdd6f4";
};
};
};
nmt.script = ''
@@ -15,10 +42,11 @@
serviceOverridesPath=$servicePath.d/overrides.conf
assertFileExists $serviceOverridesPath
assertFileContent $serviceOverridesPath \
assertFileContent $(normalizeStorePaths $serviceOverridesPath) \
${builtins.toFile "ghostty-service-overrides" ''
[Unit]
X-SwitchMethod=keep-old
X-Reload-Triggers=/nix/store/00000000000000000000000000000000-ghostty-config /nix/store/00000000000000000000000000000000-ghostty-catppuccin-mocha-theme
''}
assertFileContent \

View File

@@ -12,8 +12,21 @@
];
wallpaper = [
"DP-3,/share/wallpapers/buttons.png"
"DP-1,/share/wallpapers/cat_pacman.png"
{
monitor = "DP-3";
path = "/share/wallpapers/buttons.png";
fit_mode = "cover";
}
{
monitor = "DP-2";
path = "/share/wallpapers/cat_pacman.png";
fit_mode = "cover";
}
{
monitor = "";
path = "~/fallback.jxl";
fit_mode = "cover";
}
];
};
};

View File

@@ -1,8 +1,23 @@
preload=/share/wallpapers/buttons.png
preload=/share/wallpapers/cat_pacman.png
wallpaper=DP-3,/share/wallpapers/buttons.png
wallpaper=DP-1,/share/wallpapers/cat_pacman.png
wallpaper {
monitor=DP-3
fit_mode=cover
path=/share/wallpapers/buttons.png
}
wallpaper {
monitor=DP-2
fit_mode=cover
path=/share/wallpapers/cat_pacman.png
}
wallpaper {
monitor=
fit_mode=cover
path=~/fallback.jxl
}
ipc=on
splash=false
splash_offset=2.000000

View File

@@ -92,6 +92,23 @@ class TestRunner:
# Can happen if fzf is not found or the user cancels (non-zero exit)
return []
def _get_store_path(self, test: str, nix_args: list[str]) -> str | None:
"""Retrieve the store path of a test."""
try:
store_cmd = [
"nix", "build", "--no-link", "--json", "--reference-lock-file", "flake.lock",
f"./tests#{test}", *nix_args
]
result = _run_command(store_cmd, cwd=self.repo_root, check=False)
if result.returncode == 0:
import json
build_info = json.loads(result.stdout)
if build_info:
return build_info[0]["outputs"]["out"]
except Exception:
pass
return None
def run_tests(self, tests_to_run: list[str], nix_args: list[str]) -> bool:
"""Run the selected tests and report the outcome."""
if not tests_to_run:
@@ -112,6 +129,11 @@ class TestRunner:
# For this command, we want output to go directly to the terminal
result = subprocess.run(cmd, check=True, cwd=self.repo_root, capture_output=True, text=True)
print(f"{SUCCESS_EMOJI} Test passed: {test}")
store_path = self._get_store_path(test, nix_args)
if store_path:
print(f"{INFO_EMOJI} Test directory available at: {store_path}/tested/", file=sys.stderr)
except subprocess.CalledProcessError as e:
failed_tests.append(test)
print(f"{FAILURE_EMOJI} Test failed: {test}", file=sys.stderr)
@@ -138,20 +160,9 @@ class TestRunner:
except Exception:
print(f"{INFO_EMOJI} Build directory available at: {build_dir}", file=sys.stderr)
try:
store_cmd = [
"nix", "build", "--no-link", "--json", "--reference-lock-file", "flake.lock",
f"./tests#{test}", *nix_args
]
result = _run_command(store_cmd, cwd=self.repo_root, check=False)
if result.returncode == 0:
import json
build_info = json.loads(result.stdout)
if build_info:
store_path = build_info[0]["outputs"]["out"]
print(f"{INFO_EMOJI} Test directory available at: {store_path}/tested/", file=sys.stderr)
except Exception:
pass
store_path = self._get_store_path(test, nix_args)
if store_path:
print(f"{INFO_EMOJI} Test directory available at: {store_path}/tested/", file=sys.stderr)
print("\n--- Summary ---")
if not failed_tests: