diff options
author | Silvan Mosberger <infinisil@icloud.com> | 2018-07-05 15:10:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-05 15:10:22 +0200 |
commit | 59b3ce28947b7841759b8ba9f36e61d142cf23b3 (patch) | |
tree | ef473cad19c8cd9d228607a133e8e4af509faea8 /nixos | |
parent | e07ea4f38365c8c6a5b74f2069a5a7abf89082c2 (diff) | |
parent | 8325996621a21daf681438f45da35cbc6768bf71 (diff) |
Merge pull request #42398 from Ma27/make-autorandr-target-configurable
nixos/autorandr: make default target in systemd service configurable
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/misc/autorandr.nix | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/nixos/modules/services/misc/autorandr.nix b/nixos/modules/services/misc/autorandr.nix index 3020130ad1f69..4708e16e2a6c6 100644 --- a/nixos/modules/services/misc/autorandr.nix +++ b/nixos/modules/services/misc/autorandr.nix @@ -12,6 +12,16 @@ in { services.autorandr = { enable = mkEnableOption "handling of hotplug and sleep events by autorandr"; + + defaultTarget = mkOption { + default = "default"; + type = types.str; + description = '' + Fallback if no monitor layout can be detected. See the docs + (https://github.com/phillipberndt/autorandr/blob/v1.0/README.md#how-to-use) + for further reference. + ''; + }; }; }; @@ -22,13 +32,21 @@ in { environment.systemPackages = [ pkgs.autorandr ]; - systemd.packages = [ pkgs.autorandr ]; - systemd.services.autorandr = { wantedBy = [ "sleep.target" ]; + description = "Autorandr execution hook"; + after = [ "sleep.target" ]; + + serviceConfig = { + StartLimitInterval = 5; + StartLimitBurst = 1; + ExecStart = "${pkgs.autorandr}/bin/autorandr --batch --change --default ${cfg.defaultTarget}"; + Type = "oneshot"; + RemainAfterExit = false; + }; }; }; - meta.maintainers = with maintainers; [ gnidorah ]; + meta.maintainers = with maintainers; [ gnidorah ma27 ]; } |