Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/spice-vdagent: init #266080

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,7 @@
./services/misc/sonarr.nix
./services/misc/sourcehut
./services/misc/spice-autorandr.nix
./services/misc/spice-vdagent.nix
./services/misc/spice-vdagentd.nix
./services/misc/spice-webdavd.nix
./services/misc/ssm-agent.nix
Expand Down
27 changes: 27 additions & 0 deletions nixos/modules/services/misc/spice-vdagent.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ config, pkgs, lib, ... }:

with lib;
let
cfg = config.services.spice-vdagent;
in
{
options = {
services.spice-vdagent = {
enable = mkEnableOption (lib.mdDoc "Spice guest vdagent user daemon");
};
};

config = mkIf cfg.enable {

environment.systemPackages = [ pkgs.spice-vdagent ];

systemd.user.services.spice-vdagent = {
description = "spice-vdagent user daemon";
wantedBy = [ "spice-vdagentd.target" ];
after = [ "spice-vdagentd.service" ];
serviceConfig = {
ExecStart = "${pkgs.spice-vdagent}/bin/spice-vdagent --foreground";
};
};
};
}
4 changes: 2 additions & 2 deletions nixos/modules/services/misc/spice-vdagentd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ in
{
options = {
services.spice-vdagentd = {
enable = mkEnableOption (lib.mdDoc "Spice guest vdagent daemon");
enable = mkEnableOption (lib.mdDoc "Spice guest vdagent system daemon");
};
};

Expand All @@ -16,7 +16,7 @@ in
environment.systemPackages = [ pkgs.spice-vdagent ];

systemd.services.spice-vdagentd = {
description = "spice-vdagent daemon";
description = "spice-vdagent system daemon";
wantedBy = [ "graphical.target" ];
preStart = ''
mkdir -p "/run/spice-vdagentd/"
Expand Down
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ in {
sourcehut = handleTest ./sourcehut.nix {};
spacecookie = handleTest ./spacecookie.nix {};
spark = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./spark {};
spice-vdagent = handleTest ./spice-vdagent.nix {};
sqlite3-to-mysql = handleTest ./sqlite3-to-mysql.nix {};
sslh = handleTest ./sslh.nix {};
sssd = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./sssd.nix {};
Expand Down
39 changes: 39 additions & 0 deletions nixos/tests/spice-vdagent.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import ./make-test-python.nix ({ lib, pkgs, ... }:
{
name = "spice-vdagent";
meta.maintainers = with lib.maintainers; [ dmytrokyrychuk ];

nodes = {
machine =
{ pkgs, ... }:
{
imports = [
./common/user-account.nix
];


services.xserver.enable = true;
services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
services.xserver.displayManager.autoLogin = {
enable = true;
user = "alice";
};

services.spice-vdagentd.enable = true;
services.spice-vdagent.enable = true;
};
};

testScript = { nodes }:
let
user = nodes.machine.users.users.alice;
in
''
machine.wait_for_unit("spice-vdagentd")

# Expecting the service to fail on startup because the test VM is missing
# the required virtio channel.
machine.wait_until_succeeds("su -c journalctl ${user.name} | grep 'vdagent virtio channel /dev/virtio-ports/com.redhat.spice.0 does not exist, exiting'")
'';
})
Loading