fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let cfg = config . services . autorandr ; 6 7in { 8 9meta . maintainers = [ maintainers . GaetanLepage ]; 10 11options = { 12services . autorandr = { 13enable = mkEnableOption "" // { 14description = '' 15Whether to enable the Autorandr systemd service. 16This module is complementary to {option}`programs.autorandr` 17which handles the configuration (profiles). 18'' ; 19}; 20 21ignoreLid = mkOption { 22default = false ; 23type = types . bool ; 24description = 25"Treat outputs as connected even if their lids are closed." ; 26}; 27}; 28}; 29 30config = mkIf cfg . enable { 31assertions = [ 32( lib . hm . assertions . assertPlatform "services.autorandr" pkgs 33lib . platforms . linux ) 34]; 35 36systemd . user . services . autorandr = { 37Unit = { 38Description = "autorandr" ; 39After = [ "graphical-session-pre.target" ]; 40PartOf = [ "graphical-session.target" ]; 41}; 42 43Service = { 44Type = "oneshot" ; 45ExecStart = " ${ pkgs . autorandr } /bin/autorandr --change ${ 46optionalString cfg . ignoreLid "--ignore-lid" 47} " ; 48}; 49 50Install . WantedBy = [ "graphical-session.target" ]; 51}; 52}; 53}