nix-config/hosts/sisyphe/features/samba-shares.nix

80 lines
1.7 KiB
Nix
Raw Normal View History

2024-07-15 16:46:14 +02:00
{ config, lib, ... }:
2024-12-23 15:19:58 +01:00
with lib;
2024-07-15 16:27:23 +02:00
let
cfg = config.samba;
in
{
2024-07-15 16:55:05 +02:00
options = {
samba = {
dir = mkOption {
type = types.str;
default = "/srv/Multimedia";
};
2024-07-15 16:27:23 +02:00
};
};
2024-07-17 19:52:30 +02:00
config = {
2024-07-15 16:27:23 +02:00
services.samba = {
enable = true;
securityType = "user";
openFirewall = true;
2024-12-26 20:00:22 +01:00
settings = {
global = {
security = "user";
"hosts allow" = "192.168.1. 127.0.0.1 localhost";
"hosts deny" = "0.0.0.0/0";
"guest account" = "nobody";
"map to guest" = "bad user";
};
"music" = {
2024-08-05 10:28:33 +02:00
path = "/srv/media/Music";
2024-07-15 16:27:23 +02:00
browseable = "yes";
"read only" = "no";
"create mask" = "0644";
2024-12-26 20:00:22 +01:00
"directory mask" = "0755";
2024-07-15 16:27:23 +02:00
};
2024-12-26 20:00:22 +01:00
"ebooks" = {
2024-07-15 16:27:23 +02:00
path = "${cfg.dir}/Ebooks";
browseable = "yes";
"read only" = "no";
"create mask" = "0644";
2024-12-26 20:00:22 +01:00
"directory mask" = "0755";
2024-07-15 16:27:23 +02:00
};
2024-12-26 20:00:22 +01:00
"movies" = {
2024-07-15 16:27:23 +02:00
path = "${cfg.dir}/Films";
browseable = "yes";
"create mask" = "0644";
2024-12-26 20:00:22 +01:00
"directory mask" = "0755";
2024-07-15 16:27:23 +02:00
"read only" = "no";
};
2024-12-26 20:00:22 +01:00
"shows" = {
2024-07-15 16:27:23 +02:00
path = "${cfg.dir}/SeriesTV";
"read only" = "no";
"create mask" = "0644";
"directory mask" = "0755";
browseable = "yes";
};
2024-12-26 20:00:22 +01:00
"torrents" = {
2024-12-23 14:39:18 +01:00
path = "${cfg.dir}/Torrents";
"read only" = "yes";
"create mask" = "644";
browseable = "yes";
};
};
};
};
2024-12-26 20:00:22 +01:00
services.samba-wsdd = {
enable = true;
openFirewall = true;
};
services.avahi = {
enable = true;
publish.enable = true;
publish.userServices = true;
openFirewall = true;
};
}