diff --git a/configuration.nix b/configuration.nix index ba1a3ef..9b38200 100644 --- a/configuration.nix +++ b/configuration.nix @@ -11,6 +11,8 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ./modules/mounts.nix + ./modules/samba.nix ]; boot.loader.systemd-boot.enable = true; @@ -35,62 +37,6 @@ nixpkgs.config.allowUnfree = true; - fileSystems = { - "/mnt/games" = { - device = "/dev/disk/by-uuid/969eb1a0-fb99-46d1-96cf-57a8644ee2d1"; - fsType = "btrfs"; - options = [ - "users" - "compress=zstd" - "subvol=@games" - "nofail" - ]; - }; - "/mnt/photo" = { - device = "/dev/disk/by-uuid/969eb1a0-fb99-46d1-96cf-57a8644ee2d1"; - fsType = "btrfs"; - options = [ - "users" - "compress=zstd" - "subvol=@Pictures" - "nofail" - ]; - }; - - "/mnt/media" = { - device = "/dev/disk/by-uuid/969eb1a0-fb99-46d1-96cf-57a8644ee2d1"; - fsType = "btrfs"; - options = [ - "users" - "compress=zstd" - "subvol=@media" - "nofail" - ]; - }; - - "/mnt/winbackup" = { - device = "/dev/disk/by-uuid/969eb1a0-fb99-46d1-96cf-57a8644ee2d1"; - fsType = "btrfs"; - options = [ - "users" - "compress=zstd" - "subvol=@winbackup" - "nofail" - ]; - }; - - "/mnt/winhdd" = { - device = "/dev/sdb1"; - fsType = "ntfs"; - options = [ - "users" - "windows_names" - "noatime" - "nofail" - ]; - }; - }; - virtualisation.libvirtd = { "enable" = true; allowedBridges = ["br0"]; @@ -273,7 +219,6 @@ git kitty python3 - samba deno qbittorrent-nox sonarr @@ -349,73 +294,6 @@ services.flaresolverr = { enable = true; }; - services.samba = { - enable = true; - openFirewall = true; - settings = { - global = { - "security" = "user"; - "workgroup" = "WORKGROUP"; - "server string" = "smbnix"; - "netbios name" = "smbnix"; - #"use sendfile" = "yes"; - #"max protocol" = "smb2"; - # note: localhost is the ipv6 localhost ::1 - "hosts allow" = "192.168.1.1/24 127.0.0.1 localhost"; - "guest account" = "nobody"; - "map to guest" = "bad user"; - }; - - "games" = { - "path" = "/mnt/games"; - "browseable" = "yes"; - "read only" = "no"; - "guest ok" = "no"; - "create mask" = "0644"; - "directory mask" = "0755"; - }; - - "media" = { - "path" = "/mnt/media"; - "browseable" = "yes"; - "read only" = "no"; - "guest ok" = "no"; - "create mask" = "0644"; - "directory mask" = "0755"; - }; - - "photos" = { - "path" = "/mnt/photo"; - "browseable" = "yes"; - "read only" = "no"; - "guest ok" = "no"; - "create mask" = "0644"; - "directory mask" = "0755"; - }; - - "winhdd" = { - "path" = "/mnt/winhdd"; - "browseable" = "yes"; - "read only" = "no"; - "guest ok" = "no"; - "create mask" = "0644"; - "directory mask" = "0755"; - }; - - "winback" = { - "path" = "/mnt/winbackup"; - "browseable" = "yes"; - "read only" = "no"; - "guest ok" = "no"; - "create mask" = "0644"; - "directory mask" = "0755"; - }; - }; - }; - services.samba-wsdd = { - enable = true; - openFirewall = true; - }; services.mongodb = { enable = true; diff --git a/modules/mounts.nix b/modules/mounts.nix new file mode 100644 index 0000000..04c753e --- /dev/null +++ b/modules/mounts.nix @@ -0,0 +1,57 @@ +{ + fileSystems = { + "/mnt/games" = { + device = "/dev/disk/by-uuid/969eb1a0-fb99-46d1-96cf-57a8644ee2d1"; + fsType = "btrfs"; + options = [ + "users" + "compress=zstd" + "subvol=@games" + "nofail" + ]; + }; + "/mnt/photo" = { + device = "/dev/disk/by-uuid/969eb1a0-fb99-46d1-96cf-57a8644ee2d1"; + fsType = "btrfs"; + options = [ + "users" + "compress=zstd" + "subvol=@Pictures" + "nofail" + ]; + }; + + "/mnt/media" = { + device = "/dev/disk/by-uuid/969eb1a0-fb99-46d1-96cf-57a8644ee2d1"; + fsType = "btrfs"; + options = [ + "users" + "compress=zstd" + "subvol=@media" + "nofail" + ]; + }; + + "/mnt/winbackup" = { + device = "/dev/disk/by-uuid/969eb1a0-fb99-46d1-96cf-57a8644ee2d1"; + fsType = "btrfs"; + options = [ + "users" + "compress=zstd" + "subvol=@winbackup" + "nofail" + ]; + }; + + "/mnt/winhdd" = { + device = "/dev/sdb1"; + fsType = "ntfs"; + options = [ + "users" + "windows_names" + "noatime" + "nofail" + ]; + }; + }; +} diff --git a/modules/samba.nix b/modules/samba.nix new file mode 100644 index 0000000..0a69cb2 --- /dev/null +++ b/modules/samba.nix @@ -0,0 +1,72 @@ +{pkgs, ...}: { + services.samba = { + enable = true; + openFirewall = true; + settings = { + global = { + "security" = "user"; + "workgroup" = "WORKGROUP"; + "server string" = "smbnix"; + "netbios name" = "smbnix"; + #"use sendfile" = "yes"; + #"max protocol" = "smb2"; + # note: localhost is the ipv6 localhost ::1 + "hosts allow" = "192.168.1.1/24 127.0.0.1 localhost"; + "guest account" = "nobody"; + "map to guest" = "bad user"; + }; + + "games" = { + "path" = "/mnt/games"; + "browseable" = "yes"; + "read only" = "no"; + "guest ok" = "no"; + "create mask" = "0644"; + "directory mask" = "0755"; + }; + + "media" = { + "path" = "/mnt/media"; + "browseable" = "yes"; + "read only" = "no"; + "guest ok" = "no"; + "create mask" = "0644"; + "directory mask" = "0755"; + }; + + "photos" = { + "path" = "/mnt/photo"; + "browseable" = "yes"; + "read only" = "no"; + "guest ok" = "no"; + "create mask" = "0644"; + "directory mask" = "0755"; + }; + + "winhdd" = { + "path" = "/mnt/winhdd"; + "browseable" = "yes"; + "read only" = "no"; + "guest ok" = "no"; + "create mask" = "0644"; + "directory mask" = "0755"; + }; + + "winback" = { + "path" = "/mnt/winbackup"; + "browseable" = "yes"; + "read only" = "no"; + "guest ok" = "no"; + "create mask" = "0644"; + "directory mask" = "0755"; + }; + }; + }; + + services.samba-wsdd = { + enable = true; + openFirewall = true; + }; + + environment.systemPackages = [pkgs.samba]; +}