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 = {
|
|
|
|
|
2023-07-01 01:30:13 +02:00
|
|
|
enable = mkEnableOption (lib.mdDoc "Barrier Client daemon");
|
2021-04-29 02:48:05 +02:00
|
|
|
|
|
|
|
name = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2023-07-01 01:30:13 +02:00
|
|
|
description = lib.mdDoc ''
|
2021-04-29 02:48:05 +02:00
|
|
|
Screen name of client. Defaults to hostname.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
server = mkOption {
|
|
|
|
type = types.str;
|
2023-07-01 01:30:13 +02:00
|
|
|
description = lib.mdDoc ''
|
2021-04-29 02:48:05 +02:00
|
|
|
Server to connect to formatted as
|
2023-07-01 01:30:13 +02:00
|
|
|
`<host>[:<port>]`.
|
|
|
|
Port defaults to `24800`.
|
2021-04-29 02:48:05 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-07-01 01:30:13 +02:00
|
|
|
enableCrypto = mkEnableOption (lib.mdDoc "crypto (SSL) plugin") // {
|
2021-04-29 02:48:05 +02:00
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
|
2023-07-01 01:30:13 +02:00
|
|
|
enableDragDrop = mkEnableOption (lib.mdDoc "file drag & drop");
|
2021-04-29 02:48:05 +02:00
|
|
|
|
|
|
|
extraFlags = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [ "-f" ];
|
2021-10-09 11:14:08 +02:00
|
|
|
defaultText = literalExpression ''[ "-f" ]'';
|
2023-07-01 01:30:13 +02:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
Additional flags to pass to {command}`barrierc`.
|
|
|
|
See {command}`barrierc --help`.
|
2021-04-29 02:48:05 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
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 ]);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|