1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-15 05:21:06 +01:00
home-manager/modules/services/autorandr.nix
Austin Horstman 82ee14ff60
treewide: remove with lib (#6871)
Remove from services.
2025-04-21 11:00:59 -05:00

51 lines
1.2 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.autorandr;
in
{
meta.maintainers = [ lib.maintainers.GaetanLepage ];
options = {
services.autorandr = {
enable = lib.mkEnableOption "" // {
description = ''
Whether to enable the Autorandr systemd service.
This module is complementary to {option}`programs.autorandr`
which handles the configuration (profiles).
'';
};
ignoreLid = lib.mkOption {
default = false;
type = lib.types.bool;
description = "Treat outputs as connected even if their lids are closed.";
};
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.autorandr" pkgs lib.platforms.linux)
];
systemd.user.services.autorandr = {
Unit = {
Description = "autorandr";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.autorandr}/bin/autorandr --change ${lib.optionalString cfg.ignoreLid "--ignore-lid"}";
};
Install.WantedBy = [ "graphical-session.target" ];
};
};
}