mirror of
https://github.com/nix-community/home-manager
synced 2024-11-10 07:04:17 +00:00
parent
0312d450e2
commit
d5f6e84862
6 changed files with 77 additions and 3 deletions
|
@ -27,8 +27,11 @@ import nmt {
|
|||
texlive-minimal = ./modules/programs/texlive-minimal.nix;
|
||||
xresources = ./modules/xresources.nix;
|
||||
}
|
||||
// pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||
i3-keybindings = ./modules/services/window-managers/i3-keybindings.nix;
|
||||
}
|
||||
// pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux (
|
||||
{
|
||||
i3-keybindings = ./modules/services/window-managers/i3-keybindings.nix;
|
||||
}
|
||||
// import ./modules/systemd
|
||||
)
|
||||
// import ./modules/programs/ssh;
|
||||
}
|
||||
|
|
4
tests/modules/systemd/default.nix
Normal file
4
tests/modules/systemd/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
systemd-services = ./services.nix;
|
||||
systemd-timers = ./timers.nix;
|
||||
}
|
5
tests/modules/systemd/services-expected.conf
Normal file
5
tests/modules/systemd/services-expected.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
[Service]
|
||||
ExecStart=/some/exec/start/command --with-arguments "%i"
|
||||
|
||||
[Unit]
|
||||
Description=A basic test service
|
23
tests/modules/systemd/services.nix
Normal file
23
tests/modules/systemd/services.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
systemd.user.services."test-service@" = {
|
||||
Unit = {
|
||||
Description = "A basic test service";
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = ''/some/exec/start/command --with-arguments "%i"'';
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
local serviceFile=home-files/.config/systemd/user/test-service@.service
|
||||
assertFileExists $serviceFile
|
||||
assertFileContent $serviceFile ${./services-expected.conf}
|
||||
'';
|
||||
};
|
||||
}
|
8
tests/modules/systemd/timers-expected.conf
Normal file
8
tests/modules/systemd/timers-expected.conf
Normal file
|
@ -0,0 +1,8 @@
|
|||
[Install]
|
||||
WantedBy=timers.target
|
||||
|
||||
[Timer]
|
||||
OnUnitActiveSec=1h 30m
|
||||
|
||||
[Unit]
|
||||
Description=A basic test timer
|
31
tests/modules/systemd/timers.nix
Normal file
31
tests/modules/systemd/timers.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
systemd.user.timers.test-timer = {
|
||||
Unit = {
|
||||
Description = "A basic test timer";
|
||||
};
|
||||
|
||||
Timer = {
|
||||
OnUnitActiveSec = "1h 30m";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "timers.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
local unitDir=home-files/.config/systemd/user
|
||||
local timerFile=$unitDir/test-timer.timer
|
||||
|
||||
assertFileExists $timerFile
|
||||
assertFileContent $timerFile ${./timers-expected.conf}
|
||||
|
||||
assertFileExists $unitDir/timers.target.wants/test-timer.timer
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue