multi-user toggle init
This commit is contained in:
@@ -16,26 +16,32 @@ in
|
||||
{
|
||||
options.my.services.syncthing.enable = lib.mkEnableOption "Syncthing file synchronization";
|
||||
config = lib.mkIf (config.my.services.syncthing.enable && config.my.secureHost) {
|
||||
sops.secrets = {
|
||||
sops.secrets = let
|
||||
# Syncthing runs as a single user service, so use the first user if a list is provided
|
||||
user = if lib.isString config.my.toggleUsers.services then config.my.toggleUsers.services else (lib.head config.my.toggleUsers.services);
|
||||
in {
|
||||
"syncthing_keys/${hostName}" = {
|
||||
sopsFile = ../../secrets/keys.yaml;
|
||||
owner = config.users.users.jawz.name;
|
||||
inherit (config.users.users.jawz) group;
|
||||
path = "/home/jawz/.config/syncthing/key.pem";
|
||||
owner = config.users.users.${user}.name;
|
||||
inherit (config.users.users.${user}) group;
|
||||
path = "/home/${user}/.config/syncthing/key.pem";
|
||||
};
|
||||
"syncthing_certs/${hostName}" = {
|
||||
sopsFile = ../../secrets/keys.yaml;
|
||||
owner = config.users.users.jawz.name;
|
||||
inherit (config.users.users.jawz) group;
|
||||
path = "/home/jawz/.config/syncthing/cert.pem";
|
||||
owner = config.users.users.${user}.name;
|
||||
inherit (config.users.users.${user}) group;
|
||||
path = "/home/${user}/.config/syncthing/cert.pem";
|
||||
};
|
||||
"syncthing_password" = {
|
||||
sopsFile = ../../secrets/keys.yaml;
|
||||
};
|
||||
};
|
||||
services.syncthing = {
|
||||
services.syncthing = let
|
||||
# Syncthing runs as a single user service, so use the first user if a list is provided
|
||||
user = if lib.isString config.my.toggleUsers.services then config.my.toggleUsers.services else (lib.head config.my.toggleUsers.services);
|
||||
in {
|
||||
enable = true;
|
||||
user = "jawz";
|
||||
user = user;
|
||||
group = "users";
|
||||
overrideDevices = true;
|
||||
overrideFolders = true;
|
||||
@@ -50,7 +56,7 @@ in
|
||||
globalAnnounceEnabled = false;
|
||||
};
|
||||
gui = {
|
||||
user = "jawz";
|
||||
user = if lib.isString config.my.toggleUsers.services then config.my.toggleUsers.services else (lib.head config.my.toggleUsers.services);
|
||||
password = config.sops.secrets.syncthing_password.path;
|
||||
};
|
||||
devices = {
|
||||
|
||||
Reference in New Issue
Block a user