Add samba server
This commit is contained in:
parent
937d877a66
commit
d423af1b0a
@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
{ config, lib, ... }: {
|
||||
imports = [
|
||||
./applications/packages.nix
|
||||
./applications/rofi.nix
|
||||
@ -41,5 +41,6 @@
|
||||
./network.nix
|
||||
./wireguard.nix
|
||||
./filesystems.nix
|
||||
./samba.nix
|
||||
];
|
||||
}
|
||||
|
@ -6,10 +6,20 @@
|
||||
else
|
||||
[ "noatime" "compress=zstd" ];
|
||||
};
|
||||
"/shared" = lib.mkIf config.deviceSpecific.isVM {
|
||||
"/shared/nixos" = lib.mkIf config.deviceSpecific.isVM {
|
||||
fsType = "vboxsf";
|
||||
device = "shared";
|
||||
options = [ "rw" "nodev" "relatime" "iocharset=utf8" "uid=1000" "gid=100" "dmode=0770" "fmode=0770" "nofail" ];
|
||||
options = [
|
||||
"rw"
|
||||
"nodev"
|
||||
"relatime"
|
||||
"nofail"
|
||||
"dmode=0755"
|
||||
"fmode=0644"
|
||||
"uid=${toString config.users.users.alukard.uid}"
|
||||
# "gid=${toString config.users.groups.users.gid}"
|
||||
"gid=${toString config.users.groups.smbgrp.gid}"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
|
54
modules/samba.nix
Normal file
54
modules/samba.nix
Normal file
@ -0,0 +1,54 @@
|
||||
{ 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
|
||||
[ ];
|
||||
}
|
@ -18,6 +18,7 @@
|
||||
# "adbusers"
|
||||
"input"
|
||||
"vboxusers"
|
||||
"smbgrp"
|
||||
];
|
||||
description = "Дмитрий Холкин";
|
||||
uid = 1000;
|
||||
|
Loading…
x
Reference in New Issue
Block a user