Add barrier (test), disable compton

This commit is contained in:
Dmitriy 2019-09-18 21:48:14 +04:00
parent e4d33ff8b4
commit 759ec7b031
4 changed files with 121 additions and 2 deletions

91
modules/barrier-conf.nix Normal file
View File

@ -0,0 +1,91 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfgC = config.services.barrier.client;
cfgS = config.services.barrier.server;
in
{
options = {
services.barrier = {
client = {
enable = mkOption {
default = false;
description = "
Whether to enable the Barrier client (receive keyboard and mouse events from a Barrier server).
";
};
screenName = mkOption {
default = "";
description = ''
Use the given name instead of the hostname to identify
ourselves to the server.
'';
};
serverAddress = mkOption {
description = ''
The server address is of the form: [hostname][:port]. The
hostname must be the address or hostname of the server. The
port overrides the default port, 24800.
'';
};
autoStart = mkOption {
default = true;
type = types.bool;
description = "Whether the Barrier client should be started automatically.";
};
};
server = {
enable = mkOption {
default = false;
description = ''
Whether to enable the Barrier server (send keyboard and mouse events).
'';
};
configFile = mkOption {
default = "/etc/barrier-server.conf";
description = "The Barrier server configuration file.";
};
screenName = mkOption {
default = "";
description = ''
Use the given name instead of the hostname to identify
this screen in the configuration.
'';
};
address = mkOption {
default = "";
description = "Address on which to listen for clients.";
};
autoStart = mkOption {
default = true;
type = types.bool;
description = "Whether the Barrier server should be started automatically.";
};
};
};
};
config = mkMerge [
(mkIf cfgC.enable {
systemd.user.services."barrier-client" = {
after = [ "network.target" "graphical-session.target" ];
description = "Barrier client";
wantedBy = optional cfgC.autoStart "graphical-session.target";
path = [ pkgs.barrier ];
serviceConfig.ExecStart = ''${pkgs.barrier}/bin/barrierc -f ${optionalString (cfgC.screenName != "") "-n ${cfgC.screenName}"} ${cfgC.serverAddress}'';
serviceConfig.Restart = "on-failure";
};
})
(mkIf cfgS.enable {
systemd.user.services."barrier-server" = {
after = [ "network.target" "graphical-session.target" ];
description = "Barrier server";
wantedBy = optional cfgS.autoStart "graphical-session.target";
path = [ pkgs.barrier ];
serviceConfig.ExecStart = ''${pkgs.barrier}/bin/barriers -c ${cfgS.configFile} -f ${optionalString (cfgS.address != "") "-a ${cfgS.address}"} ${optionalString (cfgS.screenName != "") "-n ${cfgS.screenName}" }'';
serviceConfig.Restart = "on-failure";
};
})
];
}

View File

@ -7,7 +7,7 @@
./workspace/i3
./workspace/zsh.nix
./workspace/gtk.nix
./workspace/compton.nix
# ./workspace/compton.nix
./workspace/misc.nix
./workspace/dunst.nix
./workspace/cursor.nix
@ -21,6 +21,8 @@
# ./workspace/gcalcli.nix
# ./workspace/rclone.nix
./workspace/xresources.nix
./workspace/barrier.nix
./barrier-conf.nix
./themes.nix
./applications.nix
./secrets.nix

View File

@ -21,7 +21,6 @@ with deviceSpecific; {
"dmode=0755"
"fmode=0644"
"uid=${toString config.users.users.alukard.uid}"
# "gid=${toString config.users.groups.users.gid}"
"gid=${toString config.users.groups.smbgrp.gid}"
];
};

View File

@ -0,0 +1,27 @@
{ config, lib, pkgs, ... }: {
services.barrier = if config.device == "NixOS-VM" then {
server.enable = true;
server.autoStart = true;
server.configFile = pkgs.writeTextFile {
name = "barrier.conf";
text = ''
section: screens
NixOS-VM:
Dell-Laptop:
end
section: links
Dell-Laptop:
right = NixOS-VM
end
section: options
keystroke(super+alt+left) = switchInDirection(left)
keystroke(super+alt+right) = switchInDirection(right)
end
'';
};
} else {
client.enable = true;
client.autoStart = true;
client.serverAddress = "NixOS-VM";
};
}