From 1f219cbb81e9b56c818adf59c37d5fa5fe3a38cc Mon Sep 17 00:00:00 2001 From: Kopatz <7265381+Kropatz@users.noreply.github.com> Date: Thu, 23 Oct 2025 10:59:01 +0200 Subject: [PATCH] add samba --- home-manager/nixvim/lsp.nix | 2 +- modules/services/samba.nix | 60 ++++++++++++++----------- systems/amd-server-vm/configuration.nix | 7 +++ 3 files changed, 41 insertions(+), 28 deletions(-) diff --git a/home-manager/nixvim/lsp.nix b/home-manager/nixvim/lsp.nix index f86d994..6614310 100644 --- a/home-manager/nixvim/lsp.nix +++ b/home-manager/nixvim/lsp.nix @@ -23,7 +23,7 @@ }; }; html.enable = true; - dartls.enable = true; + dartls.enable = true; # handled by flutter-tools ts_ls.enable = true; pylsp.enable = true; lua_ls.enable = true; diff --git a/modules/services/samba.nix b/modules/services/samba.nix index 26fe396..7f9fea4 100644 --- a/modules/services/samba.nix +++ b/modules/services/samba.nix @@ -1,36 +1,42 @@ { - #services.samba-wsdd.enable = true; # make shares visible for windows 10 clients - #networking.firewall.allowedTCPPorts = [ - #5357 # wsdd - #]; - #networking.firewall.allowedUDPPorts = [ - #3702 # wsdd - #]; - services.samba.openFirewall = true; + services.samba-wsdd = { + enable = true; + openFirewall = true; + }; + + users.users.franz = { + isNormalUser = true; + home = "/home/franz"; + hashedPassword = "$y$j9T$opts2crrOHbRzHsFzOh/S1$LU3zmC4tKOw43THlOSw6qDXPse.l1ZvcxolN3EP7/ED"; + }; + + # add user to samba with smbpasswd -a services.samba = { enable = true; - securityType = "user"; + openFirewall = true; invalidUsers = [ "root" ]; - extraConfig = '' - disable netbios = yes - smb ports = 445 - workgroup = WORKGROUP - server string = smbnix - security = user - #use sendfile = yes - #max protocol = smb2 - # note: localhost is the ipv6 localhost ::1 - hosts allow = 192.168.0. 192.168.174.1 127.0.0.1 localhost - hosts deny = 0.0.0.0/0 - guest account = nobody - map to guest = bad user - ''; - shares = { - homes = { - browseable = "no"; - writable = "yes"; + settings = { + global = { + "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" = "192.168.0. 127.0.0.1 localhost"; + "hosts deny" = "0.0.0.0/0"; + "guest account" = "nobody"; + "map to guest" = "bad user"; + }; + "franz" = { + "path" = "/hdd/shares/franz"; + "valid users" = "franz"; + "public" = "no"; + "writable" = "yes"; + "printable" = "no"; }; }; }; diff --git a/systems/amd-server-vm/configuration.nix b/systems/amd-server-vm/configuration.nix index 7aa1613..23abc5d 100644 --- a/systems/amd-server-vm/configuration.nix +++ b/systems/amd-server-vm/configuration.nix @@ -10,6 +10,7 @@ ../../modules/misc/motd.nix ../../modules/misc/kernel.nix ../../modules/services/duckdns.nix + ../../modules/services/samba.nix ../../modules/services/ddclient-cloudflare.nix ./disk-config.nix ./mail.nix @@ -152,6 +153,12 @@ options = [ "defaults" "nofail" "noatime" ]; }; + fileSystems."/hdd" = { + device = "/dev/disk/by-uuid/99954059-3801-4abb-a536-0e7802a3e6b4"; + fsType = "ext4"; + options = [ "defaults" "nofail" "noatime" ]; + }; + # Configure console keymap console.keyMap = "us";