1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

hyprsunset: Add tests for hyprsunset.conf file

Adds tests to verify that the configuration files and services were created sucessfully, even in a no configuration case

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
kerfuzzle 2025-07-28 22:39:10 +01:00 committed by Austin Horstman
parent 6ff07a01a8
commit 7c01358ff6
4 changed files with 38 additions and 33 deletions

View file

@ -3,45 +3,28 @@
enable = true;
extraArgs = [ "--identity" ];
transitions = {
sunrise = {
calendar = "*-*-* 06:30:00";
requests = [
[ "temperature 6500" ]
[ "identity" ]
];
};
settings = {
max-gamma = 150;
sunset = {
calendar = "*-*-* 19:30:00";
requests = [ [ "temperature 3500" ] ];
};
profile = [
{
time = "7:30";
identity = true;
}
{
time = "21:00";
temperature = 5000;
gamma = 0.8;
}
];
};
};
nmt.script = ''
# Check that the main service exists
config=home-files/.config/hypr/hyprsunset.conf
mainService=home-files/.config/systemd/user/hyprsunset.service
assertFileExists $config
assertFileExists $mainService
# Check that the transition services exist
sunriseService=home-files/.config/systemd/user/hyprsunset-sunrise.service
sunsetService=home-files/.config/systemd/user/hyprsunset-sunset.service
assertFileExists $sunriseService
assertFileExists $sunsetService
# Check that the timers exist
sunriseTimer=home-files/.config/systemd/user/hyprsunset-sunrise.timer
sunsetTimer=home-files/.config/systemd/user/hyprsunset-sunset.timer
assertFileExists $sunriseTimer
assertFileExists $sunsetTimer
# Verify timer configurations
assertFileContains $sunriseTimer "OnCalendar=*-*-* 06:30:00"
assertFileContains $sunsetTimer "OnCalendar=*-*-* 19:30:00"
# Verify service configurations
assertFileContains $sunriseService "ExecStart=@hyprland@/bin/hyprctl hyprsunset 'temperature 6500' && @hyprland@/bin/hyprctl hyprsunset identity"
assertFileContains $sunsetService "ExecStart=@hyprland@/bin/hyprctl hyprsunset 'temperature 3500'"
assertFileContent $config ${./hyprsunset.conf}
'';
}

View file

@ -2,4 +2,5 @@
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
hyprsunset-basic-configuration = ./basic-configuration.nix;
hyprsunset-no-configuration = ./no-configuration.nix;
}

View file

@ -0,0 +1,11 @@
profile {
identity=true
time=7:30
}
profile {
gamma=0.800000
temperature=5000
time=21:00
}
max-gamma=150

View file

@ -0,0 +1,10 @@
{
services.hyprsunset.enable = true;
nmt.script = ''
config=home-files/.config/hypr/hyprsunset.conf
clientServiceFile=home-files/.config/systemd/user/hyprsunset.service
assertPathNotExists $config
assertFileExists $clientServiceFile
'';
}