about summary refs log tree commit diff
path: root/nixos/modules/services/misc/spice-autorandr.nix
blob: 8437441c752a40b156a3ae156b14219638766661 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{ config, pkgs, lib, ... }:

let
  cfg = config.services.spice-autorandr;
in
{
  options = {
    services.spice-autorandr = {
      enable = lib.mkEnableOption (lib.mdDoc "spice-autorandr service that will automatically resize display to match SPICE client window size.");
      package = lib.mkPackageOptionMD pkgs "spice-autorandr" { };
    };
  };

  config = lib.mkIf cfg.enable {
    environment.systemPackages = [ cfg.package ];

    systemd.user.services.spice-autorandr = {
      wantedBy = [ "default.target" ];
      after = [ "spice-vdagentd.service" ];
      serviceConfig = {
        ExecStart = "${cfg.package}/bin/spice-autorandr";
        Restart = "on-failure";
      };
    };
  };
}