54 lines
1.3 KiB
Nix
54 lines
1.3 KiB
Nix
{ config, lib, pkgs, ... }: {
|
|
users.groups.smbgrp.gid = 2001;
|
|
# TODO: add nologin shell to this user
|
|
users.users.smbuser =
|
|
lib.mkIf (config.device == "AMD-Workstation" || config.device == "NixOS-VM") {
|
|
isNormalUser = false;
|
|
extraGroups = [
|
|
"smbgrp"
|
|
];
|
|
description = "User for samba sharing";
|
|
};
|
|
services.samba =
|
|
lib.mkIf (config.device == "AMD-Workstation" || config.device == "NixOS-VM") {
|
|
enable = true;
|
|
enableNmbd = false;
|
|
enableWinbindd = false;
|
|
invalidUsers = [ "root" ];
|
|
nsswins = false;
|
|
securityType = "user";
|
|
syncPasswordsByPam = false;
|
|
# shares = {
|
|
# };
|
|
# extraConfig = ''
|
|
configText = ''
|
|
[global]
|
|
server string = samba home server
|
|
server role = standalone server
|
|
disable netbios = yes
|
|
smb ports = 445
|
|
|
|
[private]
|
|
path = /shared/samba
|
|
browsable = yes
|
|
read only = no
|
|
force create mode = 0660
|
|
force directory mode = 2770
|
|
valid users = @smbgrp
|
|
|
|
[files]
|
|
path = /shared/files
|
|
browsable = yes
|
|
read only = no
|
|
guest only = yes
|
|
force create mode = 0660
|
|
force directory mode = 2770
|
|
force user = smbuser
|
|
'';
|
|
};
|
|
environment.systemPackages =
|
|
if (config.device == "AMD-Workstation" || config.device == "NixOS-VM") then
|
|
[ config.services.samba.package ]
|
|
else
|
|
[ ];
|
|
} |