fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4let cfg = config . services . barrier ; 5in { 6 7meta . maintainers = with maintainers ; [ kritnich ]; 8 9imports = [ 10( mkRemovedOptionModule [ "services" "barrier" "client" "tray" ] '' 11The tray option is non-functional and has been removed. 12'' ) 13]; 14 15options . services . barrier = { 16 17client = { 18 19enable = mkEnableOption "Barrier Client daemon" ; 20 21name = mkOption { 22type = types . nullOr types . str ; 23default = null ; 24description = '' 25Screen name of client. Defaults to hostname. 26'' ; 27}; 28 29server = mkOption { 30type = types . str ; 31description = '' 32Server to connect to formatted as 33`<host>[:<port>]`. 34Port defaults to `24800`. 35'' ; 36}; 37 38enableCrypto = mkEnableOption "crypto (SSL) plugin" // { 39default = true ; 40}; 41 42enableDragDrop = mkEnableOption "file drag & drop" ; 43 44extraFlags = mkOption { 45type = types . listOf types . str ; 46default = [ "-f" ]; 47defaultText = literalExpression ''[ "-f" ]'' ; 48description = '' 49Additional flags to pass to {command}`barrierc`. 50See {command}`barrierc --help`. 51'' ; 52}; 53 54}; 55}; 56 57config = mkIf cfg . client . enable { 58assertions = [ 59( lib . hm . assertions . assertPlatform "services.barrier" pkgs 60lib . platforms . linux ) 61]; 62 63systemd . user . services . barrierc = { 64Unit = { 65Description = "Barrier Client daemon" ; 66After = [ "graphical-session-pre.target" ]; 67PartOf = [ "graphical-session.target" ]; 68}; 69Install . WantedBy = [ "graphical-session.target" ]; 70Service . ExecStart = with cfg . client ; 71toString ([ " ${ pkgs . barrier } /bin/barrierc" ] 72++ optional ( name != null ) "--name ${ name } " 73++ optional ( ! enableCrypto ) "--disable-crypto" 74++ optional enableDragDrop "--enable-drag-drop" ++ extraFlags 75++ [ server ]); 76}; 77}; 78 79}