Merge pull request #42398 from Ma27/make-autorandr-target-configurable
nixos/autorandr: make default target in systemd service configurable
This commit is contained in:
commit
59b3ce2894
|
@ -12,6 +12,16 @@ in {
|
||||||
|
|
||||||
services.autorandr = {
|
services.autorandr = {
|
||||||
enable = mkEnableOption "handling of hotplug and sleep events by 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 ];
|
environment.systemPackages = [ pkgs.autorandr ];
|
||||||
|
|
||||||
systemd.packages = [ pkgs.autorandr ];
|
|
||||||
|
|
||||||
systemd.services.autorandr = {
|
systemd.services.autorandr = {
|
||||||
wantedBy = [ "sleep.target" ];
|
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 ];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue