1{ config, pkgs, lib, ... }:
2
3let
4 cfg = config.services.spice-autorandr;
5in
6{
7 options = {
8 services.spice-autorandr = {
9 enable = lib.mkEnableOption "spice-autorandr service that will automatically resize display to match SPICE client window size.";
10 package = lib.mkPackageOption pkgs "spice-autorandr" { };
11 };
12 };
13
14 config = lib.mkIf cfg.enable {
15 environment.systemPackages = [ cfg.package ];
16
17 systemd.user.services.spice-autorandr = {
18 wantedBy = [ "default.target" ];
19 after = [ "spice-vdagentd.service" ];
20 serviceConfig = {
21 ExecStart = "${cfg.package}/bin/spice-autorandr";
22 Restart = "on-failure";
23 };
24 };
25 };
26}