about summary refs log tree commit diff
path: root/nixos/modules/services/misc
diff options
context:
space:
mode:
authorArtturi <Artturin@artturin.com>2023-10-22 18:52:10 +0300
committerGitHub <noreply@github.com>2023-10-22 18:52:10 +0300
commitb2426befa0083bbb1b835edba2165cb2c39ce8ce (patch)
treec780c0775c97f6780fdbaf8b906207797bc03c53 /nixos/modules/services/misc
parent187c660416b90709025402ef924d334dab140471 (diff)
parentd147d7feed63ba43e80a103d278d5ad4bb12b1fd (diff)
downloadnixlib-b2426befa0083bbb1b835edba2165cb2c39ce8ce.tar
nixlib-b2426befa0083bbb1b835edba2165cb2c39ce8ce.tar.gz
nixlib-b2426befa0083bbb1b835edba2165cb2c39ce8ce.tar.bz2
nixlib-b2426befa0083bbb1b835edba2165cb2c39ce8ce.tar.lz
nixlib-b2426befa0083bbb1b835edba2165cb2c39ce8ce.tar.xz
nixlib-b2426befa0083bbb1b835edba2165cb2c39ce8ce.tar.zst
nixlib-b2426befa0083bbb1b835edba2165cb2c39ce8ce.zip
Merge pull request #259784 from dmytrokyrychuk/init-spice-autorandr
spice-autorandr: init at 0.0.2
Diffstat (limited to 'nixos/modules/services/misc')
-rw-r--r--nixos/modules/services/misc/spice-autorandr.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/spice-autorandr.nix b/nixos/modules/services/misc/spice-autorandr.nix
new file mode 100644
index 000000000000..8437441c752a
--- /dev/null
+++ b/nixos/modules/services/misc/spice-autorandr.nix
@@ -0,0 +1,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";
+      };
+    };
+  };
+}