2021-04-29 02:48:05 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let cfg = config.services.barrier;
|
|
|
|
in {
|
|
|
|
|
|
|
|
meta.maintainers = with maintainers; [ kritnich ];
|
|
|
|
|
2021-07-26 17:16:00 +02:00
|
|
|
imports = [
|
|
|
|
(mkRemovedOptionModule [ "services" "barrier" "client" "tray" ] ''
|
|
|
|
The tray option is non-functional and has been removed.
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
2021-04-29 02:48:05 +02:00
|
|
|
options.services.barrier = {
|
|
|
|
|
|
|
|
client = {
|
|
|
|
|
|
|
|
enable = mkEnableOption "Barrier Client daemon";
|
|
|
|
|
|
|
|
name = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
description = ''
|
|
|
|
Screen name of client. Defaults to hostname.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
server = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
description = ''
|
|
|
|
Server to connect to formatted as
|
|
|
|
<literal><host>[:<port>]</literal>.
|
|
|
|
Port defaults to <literal>24800</literal>.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
enableCrypto = mkEnableOption "crypto (SSL) plugin" // {
|
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
enableDragDrop = mkEnableOption "file drag & drop";
|
|
|
|
|
|
|
|
extraFlags = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [ "-f" ];
|
2021-10-09 11:14:08 +02:00
|
|
|
defaultText = literalExpression ''[ "-f" ]'';
|
2021-04-29 02:48:05 +02:00
|
|
|
description = ''
|
|
|
|
Additional flags to pass to <command>barrierc</command>.
|
|
|
|
See <command>barrierc --help</command>.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.client.enable {
|
2021-07-07 23:24:27 +02:00
|
|
|
assertions = [
|
|
|
|
(lib.hm.assertions.assertPlatform "services.barrier" pkgs
|
|
|
|
lib.platforms.linux)
|
|
|
|
];
|
|
|
|
|
2021-04-29 02:48:05 +02:00
|
|
|
systemd.user.services.barrierc = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Barrier Client daemon";
|
|
|
|
After = [ "graphical-session-pre.target" ];
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
Install.WantedBy = [ "graphical-session.target" ];
|
|
|
|
Service.ExecStart = with cfg.client;
|
|
|
|
toString ([ "${pkgs.barrier}/bin/barrierc" ]
|
|
|
|
++ optional (name != null) "--name ${name}"
|
2022-06-07 21:51:06 +02:00
|
|
|
++ optional (!enableCrypto) "--disable-crypto"
|
2021-04-29 02:48:05 +02:00
|
|
|
++ optional enableDragDrop "--enable-drag-drop" ++ extraFlags
|
|
|
|
++ [ server ]);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|