fork/home-manager
git clone https://git.julia.blue/fork/home-manager
4fa1ba72
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let cfg = config . services . unclutter ; 6 7in { 8options . services . unclutter = { 9 10enable = mkEnableOption "unclutter" ; 11 12package = mkOption { 13description = "unclutter derivation to use." ; 14type = types . package ; 15default = pkgs . unclutter-xfixes ; 16defaultText = literalExpression "pkgs.unclutter-xfixes" ; 17}; 18 19timeout = mkOption { 20description = "Number of seconds before the cursor is marked inactive." ; 21type = types . int ; 22default = 1 ; 23}; 24 25threshold = mkOption { 26description = "Minimum number of pixels considered cursor movement." ; 27type = types . int ; 28default = 1 ; 29}; 30 31extraOptions = mkOption { 32description = "More arguments to pass to the unclutter command." ; 33type = types . listOf types . str ; 34default = [ ]; 35example = [ "exclude-root" "ignore-scrolling" ]; 36}; 37}; 38 39config = mkIf cfg . enable { 40assertions = [ 41( lib . hm . assertions . assertPlatform "services.unclutter" pkgs 42lib . platforms . linux ) 43]; 44 45systemd . user . services . unclutter = { 46Unit = { 47Description = "unclutter" ; 48After = [ "graphical-session-pre.target" ]; 49PartOf = [ "graphical-session.target" ]; 50}; 51 52Service = { 53ExecStart = '' 54${ cfg . package } /bin/unclutter \ 55--timeout ${ toString cfg . timeout } \ 56--jitter ${ toString ( cfg . threshold - 1 )} \ 57${ concatMapStrings ( x : " -- ${ x } " ) cfg . extraOptions } 58'' ; 59RestartSec = 3 ; 60Restart = "always" ; 61}; 62 63Install = { WantedBy = [ "graphical-session.target" ]; }; 64}; 65}; 66}