l syncs: use permown, use attrs

This commit is contained in:
lassulus 2019-04-18 10:16:02 +02:00
parent 3adcf3a74c
commit 2a89d6587d
6 changed files with 49 additions and 41 deletions

View File

@ -49,12 +49,15 @@ with import <stockholm/lib>;
]; ];
} }
{ {
krebs.syncthing.folders = [ krebs.syncthing.folders."the_playlist" = {
{ id = "the_playlist"; path = "/home/lass/tmp/the_playlist"; peers = [ "mors" "phone" "prism" ]; } path = "/home/lass/tmp/the_playlist";
]; peers = [ "mors" "phone" "prism" ];
lass.ensure-permissions = [ };
{ folder = "/home/lass/tmp/the_playlist"; owner = "lass"; group = "syncthing"; } krebs.permown."/home/lass/tmp/the_playlist" = {
]; owner = "lass";
group = "syncthing";
umask = "0007";
};
} }
{ {
lass.umts = { lass.umts = {

View File

@ -20,13 +20,12 @@ with import <stockholm/lib>;
} }
]; ];
lass.ensure-permissions = [ krebs.syncthing.folders."/var/lib/sync-containers".peers = [ "icarus" "skynet" "littleT" "shodan" ];
{ folder = "/var/lib/sync-containers"; owner = "root"; group = "syncthing"; } krebs.permown."/var/lib/sync-containers" = {
]; owner = "root";
group = "syncthing";
krebs.syncthing.folders = [ umask = "0007";
{ path = "/var/lib/sync-containers"; peers = [ "icarus" "skynet" "littleT" "shodan" ]; } };
];
system.activationScripts.containerPermissions = '' system.activationScripts.containerPermissions = ''
mkdir -p /var/lib/containers mkdir -p /var/lib/containers

View File

@ -248,10 +248,13 @@ in {
alias ${html}; alias ${html};
''; '';
}; };
krebs.syncthing.folders = [ krebs.syncthing.folders."the_playlist" = {
{ id = "the_playlist"; path = "/home/radio/music/the_playlist"; peers = [ "mors" "phone" "prism" ]; } path = "/home/radio/music/the_playlist";
]; peers = [ "mors" "phone" "prism" ];
lass.ensure-permissions = [ };
{ folder = "/home/radio/music/the_playlist"; owner = "radio"; group = "syncthing"; } krebs.permown."/home/radio/music/the_playlist" = {
]; owner = "radio";
group = "syncthing";
umask = "0007";
};
} }

View File

@ -1,8 +1,11 @@
{ {
krebs.syncthing.folders = [ krebs.syncthing.folders.decsync = {
{ id = "decsync"; path = "/home/lass/decsync"; peers = [ "mors" "blue" "green" "phone" ]; } path = "/home/lass/decsync";
]; peers = [ "mors" "blue" "green" "phone" ];
lass.ensure-permissions = [ };
{ folder = "/home/lass/decsync"; owner = "lass"; group = "syncthing"; } krebs.permown."/home/lass/decsync" = {
]; owner = "lass";
group = "syncthing";
umask = "0007";
};
} }

View File

@ -1,8 +1,8 @@
{ {
krebs.syncthing.folders = [ krebs.syncthing.folders."/home/lass/.weechat".peers = [ "blue" "green" "mors" ];
{ path = "/home/lass/.weechat"; peers = [ "blue" "green" "mors" ]; } krebs.permown."/home/lass/.weechat" = {
]; owner = "lass";
lass.ensure-permissions = [ group = "syncthing";
{ folder = "/home/lass/.weechat"; owner = "lass"; group = "syncthing"; } umask = "0007";
]; };
} }

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }: { config, pkgs, ... }: with import <stockholm/lib>; let
with import <stockholm/lib>; peers = mapAttrs (n: v: { id = v.syncthing.id; }) (filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts);
{ in {
services.syncthing = { services.syncthing = {
enable = true; enable = true;
group = "syncthing"; group = "syncthing";
@ -14,17 +14,17 @@ with import <stockholm/lib>;
enable = true; enable = true;
cert = toString <secrets/syncthing.cert>; cert = toString <secrets/syncthing.cert>;
key = toString <secrets/syncthing.key>; key = toString <secrets/syncthing.key>;
peers = mapAttrs (n: v: { id = v.syncthing.id; }) (filterAttrs (n: v: v.syncthing.id != null) config.krebs.hosts); peers = peers;
folders = [ folders."/home/lass/sync".peers = attrNames peers;
{ path = "/home/lass/sync"; peers = [ "icarus" "mors" "skynet" "blue" "green" "littleT" "prism" "shodan" ]; }
];
}; };
system.activationScripts.syncthing-home = '' system.activationScripts.syncthing-home = ''
${pkgs.coreutils}/bin/chmod a+x /home/lass ${pkgs.coreutils}/bin/chmod a+x /home/lass
''; '';
lass.ensure-permissions = [ krebs.permown."/home/lass/sync" = {
{ folder = "/home/lass/sync"; owner = "lass"; group = "syncthing"; } owner = "lass";
]; group = "syncthing";
umask = "0007";
};
} }