1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 06:59:45 +01:00
home-manager/tests/modules/systemd/services.nix

36 lines
870 B
Nix
Raw Normal View History

{ pkgs, ... }:
2019-03-24 15:52:30 +01:00
let
drvScript = pkgs.writeShellScript "drv-script.sh" ''
echo "Just a test"
'';
in {
2023-05-13 00:08:12 +02:00
systemd.user.services."test-service@" = {
Unit = { Description = "A basic test service"; };
2019-03-24 15:52:30 +01:00
2023-05-13 00:08:12 +02:00
Service = {
Environment = [ "VAR1=1" "VAR2=2" ];
ExecStartPre = drvScript;
ExecStart = ''/some/exec/start/command --with-arguments "%i"'';
2019-03-24 15:52:30 +01:00
};
2023-05-13 00:08:12 +02:00
};
2019-03-24 15:52:30 +01:00
2023-05-13 00:08:12 +02:00
nmt.script = ''
serviceFile=home-files/.config/systemd/user/test-service@.service
assertFileExists $serviceFile
assertFileContent $serviceFile \
${
pkgs.writeText "services-expected.conf" ''
[Service]
Environment=VAR1=1
Environment=VAR2=2
ExecStart=/some/exec/start/command --with-arguments "%i"
ExecStartPre=${drvScript}
2023-05-13 00:08:12 +02:00
[Unit]
Description=A basic test service
''
}
'';
2019-03-24 15:52:30 +01:00
}