about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorAristid Breitkreuz <aristidb@gmail.com>2017-04-08 12:17:57 +0200
committerGitHub <noreply@github.com>2017-04-08 12:17:57 +0200
commit4ca22140d9e4054752b0609ab82ca26578fe55e9 (patch)
tree15ade07a6932303e509e616cb8020cd877226e18 /nixos
parent43626b6a88a51cf78f2530f112be42ea4bc2950f (diff)
parentca733de96448d15d6da6fcdf9130ebc5d7333bbf (diff)
downloadnixlib-4ca22140d9e4054752b0609ab82ca26578fe55e9.tar
nixlib-4ca22140d9e4054752b0609ab82ca26578fe55e9.tar.gz
nixlib-4ca22140d9e4054752b0609ab82ca26578fe55e9.tar.bz2
nixlib-4ca22140d9e4054752b0609ab82ca26578fe55e9.tar.lz
nixlib-4ca22140d9e4054752b0609ab82ca26578fe55e9.tar.xz
nixlib-4ca22140d9e4054752b0609ab82ca26578fe55e9.tar.zst
nixlib-4ca22140d9e4054752b0609ab82ca26578fe55e9.zip
Merge pull request #24669 from gnidorah/master2
autorandr: 53d29f9 -> 855c18b and module
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/misc/autorandr.nix43
2 files changed, 44 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 23a1878ba302..e33941037f9c 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -247,6 +247,7 @@
   ./services/mail/rmilter.nix
   ./services/misc/apache-kafka.nix
   ./services/misc/autofs.nix
+  ./services/misc/autorandr.nix
   ./services/misc/bepasty.nix
   ./services/misc/canto-daemon.nix
   ./services/misc/calibre-server.nix
diff --git a/nixos/modules/services/misc/autorandr.nix b/nixos/modules/services/misc/autorandr.nix
new file mode 100644
index 000000000000..6746f3fec698
--- /dev/null
+++ b/nixos/modules/services/misc/autorandr.nix
@@ -0,0 +1,43 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+  cfg = config.services.autorandr;
+
+in {
+
+  options = {
+
+    services.autorandr = {
+      enable = mkEnableOption "handling of hotplug and sleep events by autorandr";
+    };
+
+  };
+
+  config = mkIf cfg.enable {
+
+    services.udev.packages = [ pkgs.autorandr ];
+
+    environment.systemPackages = [ pkgs.autorandr ];
+
+    # systemd.unitPackages = [ pkgs.autorandr ];
+    systemd.services.autorandr = {
+      unitConfig = {
+        Description = "autorandr execution hook";
+        After = [ "sleep.target" ];
+        StartLimitInterval = "5";
+        StartLimitBurst = "1";
+      };
+      serviceConfig = {
+        ExecStart = "${pkgs.autorandr}/bin/autorandr --batch --change --default default";
+        Type = "oneshot";
+        RemainAfterExit = false;
+      };
+      wantedBy = [ "sleep.target" ];
+    };
+
+  };
+
+}