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