58 lines
1.3 KiB
Nix
Raw Normal View History

2019-09-18 02:23:45 +04:00
{ config, lib, pkgs, ... }:
2021-02-07 02:38:11 +03:00
with config.deviceSpecific; {
2021-09-28 01:39:21 +03:00
users.groups.smbuser.gid = 2001;
2019-09-16 15:01:09 +04:00
# TODO: add nologin shell to this user
users.users.smbuser =
2020-02-05 04:30:49 +04:00
lib.mkIf isHost {
2021-06-29 22:28:37 +03:00
# isNormalUser = false;
isSystemUser = true;
2021-09-28 01:39:21 +03:00
group = "smbuser";
# extraGroups = [
# "smbuser"
# ];
2019-09-16 15:01:09 +04:00
description = "User for samba sharing";
};
services.samba =
2020-02-05 04:30:49 +04:00
lib.mkIf isHost {
2019-09-16 15:01:09 +04:00
enable = true;
enableNmbd = false;
enableWinbindd = false;
invalidUsers = [ "root" ];
nsswins = false;
securityType = "user";
2021-06-29 22:28:37 +03:00
# syncPasswordsByPam = false;
2019-09-16 15:01:09 +04:00
configText = ''
[global]
2022-08-23 16:13:51 +03:00
client min protocol = SMB3_11
server min protocol = SMB3_11
smb encrypt = required
2019-09-16 15:01:09 +04:00
server string = samba home server
server role = standalone server
disable netbios = yes
smb ports = 445
2019-09-28 02:24:58 +04:00
[data]
2019-09-29 14:59:51 +04:00
path = /media/data
2019-09-16 15:01:09 +04:00
browsable = yes
2019-09-29 14:59:51 +04:00
read only = no
2019-09-16 15:01:09 +04:00
force create mode = 0660
force directory mode = 2770
2021-09-28 01:39:21 +03:00
valid users = @smbuser
2019-09-16 15:01:09 +04:00
2019-09-28 02:24:58 +04:00
[files]
2019-09-29 14:59:51 +04:00
path = /media/files
2019-09-16 15:01:09 +04:00
browsable = yes
read only = no
force create mode = 0660
force directory mode = 2770
2021-09-28 01:39:21 +03:00
valid users = @smbuser
2019-09-16 15:01:09 +04:00
'';
};
2020-08-11 02:38:02 +04:00
environment.systemPackages = [
pkgs.cifs-utils
] ++ lib.optionals isHost [
config.services.samba.package
];
2021-06-29 22:28:37 +03:00
}