2021-04-29 00:48:05 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let cfg = config.services.barrier;
|
|
|
|
in {
|
|
|
|
|
|
|
|
meta.maintainers = with maintainers; [ kritnich ];
|
|
|
|
|
2021-07-26 15:16:00 +00:00
|
|
|
imports = [
|
|
|
|
(mkRemovedOptionModule [ "services" "barrier" "client" "tray" ] ''
|
|
|
|
The tray option is non-functional and has been removed.
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
2021-04-29 00:48:05 +00:00
|
|
|
options.services.barrier = {
|
|
|
|
|
|
|
|
client = {
|
|
|
|
|
2023-07-01 23:45:18 +00:00
|
|
|
enable = mkEnableOption "Barrier Client daemon";
|
2021-04-29 00:48:05 +00:00
|
|
|
|
|
|
|
name = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2023-07-01 23:45:18 +00:00
|
|
|
description = ''
|
2021-04-29 00:48:05 +00:00
|
|
|
Screen name of client. Defaults to hostname.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
server = mkOption {
|
|
|
|
type = types.str;
|
2023-07-01 23:45:18 +00:00
|
|
|
description = ''
|
2021-04-29 00:48:05 +00:00
|
|
|
Server to connect to formatted as
|
2023-06-30 23:30:13 +00:00
|
|
|
`<host>[:<port>]`.
|
|
|
|
Port defaults to `24800`.
|
2021-04-29 00:48:05 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-07-01 23:45:18 +00:00
|
|
|
enableCrypto = mkEnableOption "crypto (SSL) plugin" // {
|
2021-04-29 00:48:05 +00:00
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
|
2023-07-01 23:45:18 +00:00
|
|
|
enableDragDrop = mkEnableOption "file drag & drop";
|
2021-04-29 00:48:05 +00:00
|
|
|
|
|
|
|
extraFlags = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [ "-f" ];
|
2021-10-09 09:14:08 +00:00
|
|
|
defaultText = literalExpression ''[ "-f" ]'';
|
2023-07-01 23:45:18 +00:00
|
|
|
description = ''
|
2023-06-30 23:30:13 +00:00
|
|
|
Additional flags to pass to {command}`barrierc`.
|
|
|
|
See {command}`barrierc --help`.
|
2021-04-29 00:48:05 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.client.enable {
|
2021-07-07 21:24:27 +00:00
|
|
|
assertions = [
|
|
|
|
(lib.hm.assertions.assertPlatform "services.barrier" pkgs
|
|
|
|
lib.platforms.linux)
|
|
|
|
];
|
|
|
|
|
2021-04-29 00:48:05 +00: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 19:51:06 +00:00
|
|
|
++ optional (!enableCrypto) "--disable-crypto"
|
2021-04-29 00:48:05 +00:00
|
|
|
++ optional enableDragDrop "--enable-drag-drop" ++ extraFlags
|
|
|
|
++ [ server ]);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|