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:
parent
6ff07a01a8
commit
7c01358ff6
4 changed files with 38 additions and 33 deletions
|
|
@ -3,45 +3,28 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
extraArgs = [ "--identity" ];
|
extraArgs = [ "--identity" ];
|
||||||
|
|
||||||
transitions = {
|
settings = {
|
||||||
sunrise = {
|
max-gamma = 150;
|
||||||
calendar = "*-*-* 06:30:00";
|
|
||||||
requests = [
|
|
||||||
[ "temperature 6500" ]
|
|
||||||
[ "identity" ]
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
sunset = {
|
profile = [
|
||||||
calendar = "*-*-* 19:30:00";
|
{
|
||||||
requests = [ [ "temperature 3500" ] ];
|
time = "7:30";
|
||||||
};
|
identity = true;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
time = "21:00";
|
||||||
|
temperature = 5000;
|
||||||
|
gamma = 0.8;
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
# Check that the main service exists
|
config=home-files/.config/hypr/hyprsunset.conf
|
||||||
mainService=home-files/.config/systemd/user/hyprsunset.service
|
mainService=home-files/.config/systemd/user/hyprsunset.service
|
||||||
|
assertFileExists $config
|
||||||
assertFileExists $mainService
|
assertFileExists $mainService
|
||||||
|
assertFileContent $config ${./hyprsunset.conf}
|
||||||
# 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'"
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,5 @@
|
||||||
|
|
||||||
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||||
hyprsunset-basic-configuration = ./basic-configuration.nix;
|
hyprsunset-basic-configuration = ./basic-configuration.nix;
|
||||||
|
hyprsunset-no-configuration = ./no-configuration.nix;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
tests/modules/services/hyprsunset/hyprsunset.conf
Normal file
11
tests/modules/services/hyprsunset/hyprsunset.conf
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
profile {
|
||||||
|
identity=true
|
||||||
|
time=7:30
|
||||||
|
}
|
||||||
|
|
||||||
|
profile {
|
||||||
|
gamma=0.800000
|
||||||
|
temperature=5000
|
||||||
|
time=21:00
|
||||||
|
}
|
||||||
|
max-gamma=150
|
||||||
10
tests/modules/services/hyprsunset/no-configuration.nix
Normal file
10
tests/modules/services/hyprsunset/no-configuration.nix
Normal 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
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue