fix(samba): config format update

This commit is contained in:
Patrick 2024-10-23 14:41:27 +02:00
parent fb9143ea5f
commit da39d21a3a
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F

View file

@ -69,10 +69,9 @@ in
services.samba = { services.samba = {
enable = true; enable = true;
securityType = "user";
openFirewall = true; openFirewall = true;
enableWinbindd = false; winbindd.enable = false;
enableNmbd = false; nmbd.enable = false;
settings = settings =
let let
mkShare = mkShare =
@ -129,6 +128,7 @@ in
{ {
global = { global = {
logging = "systemd"; logging = "systemd";
security = "user";
"log level" = "0 auth:2 passdb:2"; "log level" = "0 auth:2 passdb:2";
"passdb backend" = "tdbsam:${config.age.secrets.smbpassdb.path}"; "passdb backend" = "tdbsam:${config.age.secrets.smbpassdb.path}";
"server role" = "standalone"; "server role" = "standalone";
@ -267,27 +267,27 @@ in
fileSystems = lib.mkMerge ( fileSystems = lib.mkMerge (
lib.flip lib.mapAttrsToList shares ( lib.flip lib.mapAttrsToList shares (
_: v: _: v:
lib.optionalAttrs ((v ? "#paperless") && lib.head v."#paperless") { lib.optionalAttrs ((v ? "#paperless") && v."#paperless") {
"${lib.head v.path}/consume" = { "${v.path}/consume" = {
fsType = "none"; fsType = "none";
options = [ "bind" ]; options = [ "bind" ];
device = "/paperless/consume/${lib.head v."#user"}"; device = "/paperless/consume/${v."#user"}";
}; };
"${lib.head v.path}/media/archive" = { "${v.path}/media/archive" = {
fsType = "none "; fsType = "none ";
options = [ options = [
"bind" "bind"
"ro" "ro"
]; ];
device = "/paperless/media/documents/archive/${lib.head v."#user"}"; device = "/paperless/media/documents/archive/${v."#user"}";
}; };
"${lib.head v.path}/media/originals" = { "${v.path}/media/originals" = {
fsType = "none "; fsType = "none ";
options = [ options = [
"bind" "bind"
"ro" "ro"
]; ];
device = "/paperless/media/documents/originals/${lib.head v."#user"}"; device = "/paperless/media/documents/originals/${v."#user"}";
}; };
} }
) )
@ -296,13 +296,13 @@ in
systemd.tmpfiles.settings = lib.mkMerge ( systemd.tmpfiles.settings = lib.mkMerge (
lib.flip lib.mapAttrsToList shares ( lib.flip lib.mapAttrsToList shares (
_: v: _: v:
lib.optionalAttrs ((v ? "#paperless") && lib.head v."#paperless") { lib.optionalAttrs ((v ? "#paperless") && v."#paperless") {
"10-smb-paperless"."/paperless/consume/".d = { "10-smb-paperless"."/paperless/consume/".d = {
user = "paperless"; user = "paperless";
group = "paperless"; group = "paperless";
mode = "0770"; mode = "0770";
}; };
"10-smb-paperless"."/paperless/consume/${lib.head v."#user"}".d = { "10-smb-paperless"."/paperless/consume/${v."#user"}".d = {
user = "paperless"; user = "paperless";
group = "paperless"; group = "paperless";
mode = "0770"; mode = "0770";
@ -323,12 +323,12 @@ in
group = "paperless"; group = "paperless";
mode = "0770"; mode = "0770";
}; };
"10-smb-paperless"."/paperless/media/documents/archive/${lib.head v."#user"}".d = { "10-smb-paperless"."/paperless/media/documents/archive/${v."#user"}".d = {
user = "paperless"; user = "paperless";
group = "paperless"; group = "paperless";
mode = "0770"; mode = "0770";
}; };
"10-smb-paperless"."/paperless/media/documents/archive/${lib.head v."#user"}/.keep".f = { "10-smb-paperless"."/paperless/media/documents/archive/${v."#user"}/.keep".f = {
user = "paperless"; user = "paperless";
group = "paperless"; group = "paperless";
mode = "0660"; mode = "0660";
@ -338,12 +338,12 @@ in
group = "paperless"; group = "paperless";
mode = "0770"; mode = "0770";
}; };
"10-smb-paperless"."/paperless/media/documents/originals/${lib.head v."#user"}".d = { "10-smb-paperless"."/paperless/media/documents/originals/${v."#user"}".d = {
user = "paperless"; user = "paperless";
group = "paperless"; group = "paperless";
mode = "0770"; mode = "0770";
}; };
"10-smb-paperless"."/paperless/media/documents/originals/${lib.head v."#user"}/.keep".f = { "10-smb-paperless"."/paperless/media/documents/originals/${v."#user"}/.keep".f = {
user = "paperless"; user = "paperless";
group = "paperless"; group = "paperless";
mode = "0660"; mode = "0660";
@ -355,12 +355,12 @@ in
lib.flatten [ lib.flatten [
(lib.flip lib.mapAttrsToList shares ( (lib.flip lib.mapAttrsToList shares (
_: v: _: v:
lib.optionalAttrs ((v ? "#persistRoot") && (lib.head v."#persistRoot" != "")) { lib.optionalAttrs ((v ? "#persistRoot") && (v."#persistRoot" != "")) {
${lib.head v."#persistRoot"}.directories = [ ${v."#persistRoot"}.directories = [
{ {
directory = "${lib.head v.path}"; directory = "${v.path}";
user = "${lib.head v."force user"}"; user = "${v."force user"}";
group = "${lib.head v."force group"}"; group = "${v."force group"}";
mode = "0770"; mode = "0770";
} }
]; ];