udpate 24.11
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
{ lib, config, ... }:
|
||||
with lib;
|
||||
let cfg = config.nas-samba;
|
||||
in {
|
||||
let
|
||||
cfg = config.nas-samba;
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
@@ -22,42 +24,50 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.enable = true;
|
||||
networking.firewall.allowPing = true;
|
||||
|
||||
services.samba = {
|
||||
enable = true;
|
||||
securityType = "user";
|
||||
openFirewall = true;
|
||||
extraConfig = ''
|
||||
workgroup = WORKGROUP
|
||||
server string = smbnix
|
||||
netbios name = smbnix
|
||||
security = user
|
||||
#use sendfile = yes
|
||||
#max protocol = smb2
|
||||
# note: localhost is the ipv6 localhost ::1
|
||||
hosts allow = ${cfg.hostsAllow} 127.0.0.1 localhost
|
||||
hosts deny = 0.0.0.0/0
|
||||
guest account = nobody
|
||||
map to guest = bad user
|
||||
force user = nix-apps
|
||||
'';
|
||||
shares = let
|
||||
make = name: share:
|
||||
nameValuePair "${name}" {
|
||||
path = share.sharePath;
|
||||
public = if share.enableTimeMachine then "no" else "yes";
|
||||
browseable = if share.browseable then "yes" else "no";
|
||||
writable = "yes";
|
||||
"read only" = if share.readOnly then "yes" else "no";
|
||||
"guest ok" = if share.guestOk then "yes" else "no";
|
||||
"create mask" = share.createMask;
|
||||
"directory mask" = share.directoryMask;
|
||||
"fruit:aapl" = if share.enableTimeMachine then "yes" else "no";
|
||||
"fruit:time machine" = if share.enableTimeMachine then "yes" else "no";
|
||||
"vfs objects" = "catia fruit streams_xattr";
|
||||
"fruit:time machine max size" = share.timeMachineMaxSize;
|
||||
};
|
||||
in mapAttrs' make cfg.shares;
|
||||
# settings = {
|
||||
# create-mode = 664;
|
||||
# force directory mode = 2770
|
||||
# workgroup = WORKGROUP
|
||||
# server string = jallen-nas
|
||||
# netbios name = jallen-nas
|
||||
# security = user
|
||||
# #use sendfile = yes
|
||||
# #max protocol = smb2
|
||||
# # note: localhost is the ipv6 localhost ::1
|
||||
# hosts allow = ${cfg.hostsAllow} 127.0.0.1 localhost
|
||||
# hosts deny = 0.0.0.0/0
|
||||
# guest account = nobody
|
||||
# map to guest = bad user
|
||||
# usershare allow guests = yes
|
||||
# };
|
||||
settings =
|
||||
let
|
||||
make =
|
||||
name: share:
|
||||
nameValuePair "${name}" {
|
||||
path = share.sharePath;
|
||||
public = if share.enableTimeMachine then "no" else "yes";
|
||||
private = if !share.public || share.enableTimeMachine then "yes" else "no";
|
||||
browseable = if share.browseable then "yes" else "no";
|
||||
writable = "yes";
|
||||
"force group" = "jallen-nas";
|
||||
"read only" = if share.readOnly then "yes" else "no";
|
||||
"guest ok" = if share.guestOk then "yes" else "no";
|
||||
"create mask" = share.createMask;
|
||||
"directory mask" = share.directoryMask;
|
||||
"fruit:aapl" = if share.enableTimeMachine then "yes" else "no";
|
||||
"fruit:time machine" = if share.enableTimeMachine then "yes" else "no";
|
||||
"vfs objects" = "catia fruit streams_xattr";
|
||||
"fruit:time machine max size" = share.timeMachineMaxSize;
|
||||
};
|
||||
in
|
||||
mapAttrs' make cfg.shares;
|
||||
};
|
||||
};
|
||||
}
|
||||
# private = if !share.public || share.enableTimeMachine then "yes" else "no";
|
||||
Reference in New Issue
Block a user