test samba configuration for nas

This commit is contained in:
2026-03-19 20:10:29 +01:00
parent abf0583f17
commit ae5f6f1fc4
4 changed files with 55 additions and 14 deletions

View File

@@ -26,10 +26,10 @@
# fsType = "ext4"; # fsType = "ext4";
# }; # };
#fileSystems."/srv/dev-disk-by-uuid-18333f38-626c-4c22-af29-314a87282809" = fileSystems."/srv/shatteredmint" =
# { device = "/dev/mapper/base--storage-ShatteredMINT"; { device = "/dev/mapper/base--storage-ShatteredMINT";
# fsType = "ext4"; fsType = "ext4";
# }; };
#fileSystems."/srv/dev-disk-by-uuid-98570615-8eda-4a45-8a20-3c58b50e3d79" = #fileSystems."/srv/dev-disk-by-uuid-98570615-8eda-4a45-8a20-3c58b50e3d79" =
# { device = "/dev/mapper/base--storage-NAS"; # { device = "/dev/mapper/base--storage-NAS";

View File

@@ -67,6 +67,7 @@
./configuration.nix ./configuration.nix
./users/shatteredmint.nix ./users/shatteredmint.nix
./software/samba.nix
]; ];
}; };
}; };

View File

@@ -1,17 +1,28 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
# mount network shares environment.systemPackages = [ pkgs.cifs-utils ];
fileSystems."/mnt/nas/private" = { fileSystems."/mnt/share" = {
device = "dashboard.omv:/ShatteredMINT"; device = "//192.168.178.108/srv/private-shatteredmint";
fsType = "nfs"; fsType = "cifs";
options = [ "x-systemd.automount" "noauto" ]; options = let
# this line prevents hanging on network split
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
in ["${automount_opts},credentials=/etc/nixos/smb-secrets"];
}; };
fileSystems."/mnt/nas/shared" = {
device = "dashboard.omv:/default-nas";
fsType = "nfs";
options = [ "x-systemd.automount" "noauto" ];
}; # # mount network shares
# fileSystems."/mnt/nas/private" = {
# device = "dashboard.omv:/ShatteredMINT";
# fsType = "nfs";
# options = [ "x-systemd.automount" "noauto" ];
#
# };
# fileSystems."/mnt/nas/shared" = {
# device = "dashboard.omv:/default-nas";
# fsType = "nfs";
# options = [ "x-systemd.automount" "noauto" ];
#
# };
} }

29
software/samba.nix Normal file
View File

@@ -0,0 +1,29 @@
{config, pkgs, ...} : {
services = {
samba = {
enable = true;
package = pkgs.samba4Full;
openFirewall = true;
settings = {
global = {
"server smb encrypt" = "required";
"server min protocol" = "SMB3_00";
"workgroup" = "WORKGROUP";
"security" = "user";
};
"private-shatteredmint" = {
"path" = "/srv/shatteredmint";
"writable" = "yes";
"comment" = "private share for shatteredmint";
"browseable" = "yes";
};
};
};
samba-wsdd = {
enable = true;
openFirewall = true;
};
};
}