mirror of
https://github.com/nix-community/home-manager
synced 2025-01-11 03:29:50 +01:00
barrier: add module
Co-authored-by: Sumner Evans <me@sumnerevans.com>
This commit is contained in:
parent
5e6f09795c
commit
2eed138026
7 changed files with 104 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -164,6 +164,9 @@
|
||||||
|
|
||||||
/modules/programs/zsh/prezto.nix @NickHu
|
/modules/programs/zsh/prezto.nix @NickHu
|
||||||
|
|
||||||
|
/modules/services/barrier.nix @Kritnich
|
||||||
|
/tests/modules/services/barrier @Kritnich
|
||||||
|
|
||||||
/modules/services/caffeine.nix @uvNikita
|
/modules/services/caffeine.nix @uvNikita
|
||||||
|
|
||||||
/modules/services/cbatticon.nix @pmiddend
|
/modules/services/cbatticon.nix @pmiddend
|
||||||
|
|
|
@ -1929,6 +1929,13 @@ in
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2021-04-30T22:05:01+00:00";
|
||||||
|
condition = hostPlatform.isLinux;
|
||||||
|
message = ''
|
||||||
|
A new service is available: 'services.barrier'.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,7 @@ let
|
||||||
(loadModule ./programs/zplug.nix { })
|
(loadModule ./programs/zplug.nix { })
|
||||||
(loadModule ./programs/zsh.nix { })
|
(loadModule ./programs/zsh.nix { })
|
||||||
(loadModule ./programs/zsh/prezto.nix { })
|
(loadModule ./programs/zsh/prezto.nix { })
|
||||||
|
(loadModule ./services/barrier.nix { condition = hostPlatform.isLinux; })
|
||||||
(loadModule ./services/blueman-applet.nix { })
|
(loadModule ./services/blueman-applet.nix { })
|
||||||
(loadModule ./services/caffeine.nix { condition = hostPlatform.isLinux; })
|
(loadModule ./services/caffeine.nix { condition = hostPlatform.isLinux; })
|
||||||
(loadModule ./services/cbatticon.nix { condition = hostPlatform.isLinux; })
|
(loadModule ./services/cbatticon.nix { condition = hostPlatform.isLinux; })
|
||||||
|
|
71
modules/services/barrier.nix
Normal file
71
modules/services/barrier.nix
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let cfg = config.services.barrier;
|
||||||
|
in {
|
||||||
|
|
||||||
|
meta.maintainers = with maintainers; [ kritnich ];
|
||||||
|
|
||||||
|
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>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
tray = mkEnableOption "the system tray icon" // { default = true; };
|
||||||
|
|
||||||
|
enableCrypto = mkEnableOption "crypto (SSL) plugin" // {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
enableDragDrop = mkEnableOption "file drag & drop";
|
||||||
|
|
||||||
|
extraFlags = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ "-f" ];
|
||||||
|
defaultText = literalExample ''[ "-f" ]'';
|
||||||
|
description = ''
|
||||||
|
Additional flags to pass to <command>barrierc</command>.
|
||||||
|
See <command>barrierc --help</command>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.client.enable {
|
||||||
|
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}"
|
||||||
|
++ optional (!tray) "--no-tray"
|
||||||
|
++ optional enableCrypto "--enable-crypto"
|
||||||
|
++ optional enableDragDrop "--enable-drag-drop" ++ extraFlags
|
||||||
|
++ [ server ]);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -102,6 +102,7 @@ import nmt {
|
||||||
./modules/programs/rofi
|
./modules/programs/rofi
|
||||||
./modules/programs/rofi-pass
|
./modules/programs/rofi-pass
|
||||||
./modules/programs/waybar
|
./modules/programs/waybar
|
||||||
|
./modules/services/barrier
|
||||||
./modules/services/dropbox
|
./modules/services/dropbox
|
||||||
./modules/services/emacs
|
./modules/services/emacs
|
||||||
./modules/services/fluidsynth
|
./modules/services/fluidsynth
|
||||||
|
|
20
tests/modules/services/barrier/basic-configuration.nix
Normal file
20
tests/modules/services/barrier/basic-configuration.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
services.barrier.client = {
|
||||||
|
enable = true;
|
||||||
|
server = "testServer";
|
||||||
|
};
|
||||||
|
|
||||||
|
nixpkgs.overlays =
|
||||||
|
[ (self: super: { barrier = pkgs.writeScriptBin "dummy-barrier" ""; }) ];
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
clientServiceFile=home-files/.config/systemd/user/barrierc.service
|
||||||
|
|
||||||
|
assertFileExists $clientServiceFile
|
||||||
|
assertFileRegex $clientServiceFile 'ExecStart=.*/bin/barrierc --enable-crypto -f testServer'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
1
tests/modules/services/barrier/default.nix
Normal file
1
tests/modules/services/barrier/default.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ barrier-basic-configuration = ./basic-configuration.nix; }
|
Loading…
Reference in a new issue