Compare commits
No commits in common. "907f2cabcadb6223c28fc6960b542f60bbadc860" and "bc3269a814934ccd8dfa95462735125cdc5d5762" have entirely different histories.
907f2cabca
...
bc3269a814
3 changed files with 81 additions and 88 deletions
|
|
@ -4,8 +4,6 @@ let
|
||||||
me.binds."/home/${user}/.config/syncthing" = "${user}/syncthing/config";
|
me.binds."/home/${user}/.config/syncthing" = "${user}/syncthing/config";
|
||||||
me.binds."/home/${user}/.local/state/syncthing" = "${user}/syncthing/state";
|
me.binds."/home/${user}/.local/state/syncthing" = "${user}/syncthing/state";
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [ "d /flower/syncthing/${user} 700 ${user} users" ];
|
|
||||||
|
|
||||||
users.users.${user} = {
|
users.users.${user} = {
|
||||||
hashedPasswordFile = config.age.secrets.passwd.path;
|
hashedPasswordFile = config.age.secrets.passwd.path;
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
|
|
@ -20,12 +18,6 @@ let
|
||||||
services.syncthing = {
|
services.syncthing = {
|
||||||
enable = true;
|
enable = true;
|
||||||
guiAddress = "[::]:${toString port}";
|
guiAddress = "[::]:${toString port}";
|
||||||
options.listenAddresses = [
|
|
||||||
"tcp://0.0.0.0:2${toString port}"
|
|
||||||
"quic://0.0.0.0:2${toString port}"
|
|
||||||
"dynamic+https://relays.syncthing.net/endpoint"
|
|
||||||
];
|
|
||||||
settings.defaults.folder.path = "/flower/syncthing/${user}";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,26 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, pkgs, ... }: {
|
||||||
let
|
networking.firewall.allowPing = true;
|
||||||
configOn = user: let
|
|
||||||
passwd_fname = "passwd_smb${user}";
|
|
||||||
in {
|
|
||||||
age.secrets.${passwd_fname}.file = ../../secrets/${passwd_fname}.age;
|
|
||||||
me.binds."/flower/smb/${user}/syncthing" = "/flower/syncthing/${user}";
|
|
||||||
|
|
||||||
users.users.${user} = {
|
age.secrets.passwd_smbcilly.file = ../../secrets/passwd_smbcilly.age;
|
||||||
|
age.secrets.passwd_smbkujira.file = ../../secrets/passwd_smbkujira.age;
|
||||||
|
|
||||||
|
users.users.cilly = {
|
||||||
|
hashedPasswordFile = config.age.secrets.passwd.path;
|
||||||
|
isNormalUser = true;
|
||||||
|
};
|
||||||
|
users.users.kujira = {
|
||||||
hashedPasswordFile = config.age.secrets.passwd.path;
|
hashedPasswordFile = config.age.secrets.passwd.path;
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
system.activationScripts = {
|
system.activationScripts = {
|
||||||
init_smbpasswd.text = let
|
init_smbpasswd.text = let
|
||||||
smbpasswd = "${config.services.samba.package}/bin/smbpasswd";
|
smbpasswd = "${config.services.samba.package}/bin/smbpasswd";
|
||||||
in ''
|
in ''
|
||||||
printf "$(cat ${config.age.secrets.${passwd_fname}.path})\n$(cat ${config.age.secrets.${passwd_fname}.path})\n" | ${smbpasswd} -sa ${user}
|
printf "$(cat ${config.age.secrets.passwd_smbcilly.path})\n$(cat ${config.age.secrets.passwd_smbcilly.path})\n" | ${smbpasswd} -sa cilly
|
||||||
|
|
||||||
|
printf "$(cat ${config.age.secrets.passwd_smbkujira.path})\n$(cat ${config.age.secrets.passwd_smbkujira.path})\n" | ${smbpasswd} -sa kujira
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
services.samba.settings."${user}" = {
|
|
||||||
"path" = "/flower/smb/${user}";
|
|
||||||
"browseable" = "yes";
|
|
||||||
"read only" = "no";
|
|
||||||
"guest ok" = "no";
|
|
||||||
"create mask" = "0644";
|
|
||||||
"directory mask" = "0755";
|
|
||||||
"force user" = user;
|
|
||||||
"force group" = "users";
|
|
||||||
"valid users" = user;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in lib.mkMerge [
|
|
||||||
(configOn "cilly")
|
|
||||||
(configOn "kujira")
|
|
||||||
{
|
|
||||||
me.binds."/flower/smb/kujira/opencloud" = "/flower/opencloud/data/storage/users/users/a8e29fc0-673c-4c67-be00-2442904acb43";
|
|
||||||
|
|
||||||
networking.firewall.allowPing = true;
|
|
||||||
|
|
||||||
services.samba = {
|
services.samba = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -64,6 +48,28 @@ in lib.mkMerge [
|
||||||
"force user" = "hana";
|
"force user" = "hana";
|
||||||
"force group" = "users";
|
"force group" = "users";
|
||||||
};
|
};
|
||||||
|
"cilly" = {
|
||||||
|
"path" = "/flower/smb/cilly";
|
||||||
|
"browseable" = "yes";
|
||||||
|
"read only" = "no";
|
||||||
|
"guest ok" = "no";
|
||||||
|
"create mask" = "0644";
|
||||||
|
"directory mask" = "0755";
|
||||||
|
"force user" = "cilly";
|
||||||
|
"force group" = "users";
|
||||||
|
"valid users" = "cilly";
|
||||||
|
};
|
||||||
|
"kujira" = {
|
||||||
|
"path" = "/flower/smb/kujira";
|
||||||
|
"browseable" = "yes";
|
||||||
|
"read only" = "no";
|
||||||
|
"guest ok" = "no";
|
||||||
|
"create mask" = "0644";
|
||||||
|
"directory mask" = "0755";
|
||||||
|
"force user" = "kujira";
|
||||||
|
"force group" = "users";
|
||||||
|
"valid users" = "kujira";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -80,4 +86,3 @@ in lib.mkMerge [
|
||||||
publish.userServices = true;
|
publish.userServices = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,8 @@
|
||||||
{ config, lib, ...}: {
|
{ config, lib, ...}: {
|
||||||
imports = [ ./options.nix ];
|
imports = [ ./options.nix ];
|
||||||
fileSystems = lib.mapAttrs (dest: key: let
|
fileSystems = lib.mapAttrs (dest: key: {
|
||||||
target = if (lib.strings.hasPrefix "/" key)
|
|
||||||
then key
|
|
||||||
else "/persist/binds/${key}";
|
|
||||||
in {
|
|
||||||
depends = [ "/persist" ];
|
depends = [ "/persist" ];
|
||||||
device = target;
|
device = "/persist/binds/${key}";
|
||||||
fsType = "none";
|
fsType = "none";
|
||||||
options = [ "bind" ];
|
options = [ "bind" ];
|
||||||
}) config.me.binds;
|
}) config.me.binds;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue