mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 22:36:23 +01:00
ae02415ee8
due to github account removal/deletion and not other mean of contact.
52 lines
1.1 KiB
Nix
52 lines
1.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.autorandr;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
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.
|
|
'';
|
|
};
|
|
};
|
|
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
services.udev.packages = [ pkgs.autorandr ];
|
|
|
|
environment.systemPackages = [ pkgs.autorandr ];
|
|
|
|
systemd.services.autorandr = {
|
|
wantedBy = [ "sleep.target" ];
|
|
description = "Autorandr execution hook";
|
|
after = [ "sleep.target" ];
|
|
|
|
startLimitIntervalSec = 5;
|
|
startLimitBurst = 1;
|
|
serviceConfig = {
|
|
ExecStart = "${pkgs.autorandr}/bin/autorandr --batch --change --default ${cfg.defaultTarget}";
|
|
Type = "oneshot";
|
|
RemainAfterExit = false;
|
|
};
|
|
};
|
|
|
|
};
|
|
|
|
meta.maintainers = with maintainers; [ ];
|
|
}
|