~abyxcos/nas.nix

0771aa3aa684366db8d3c031ee6ec7b2b82e7967 — System administrator 1 year, 3 months ago 2e552a2
Enable samba.
2 files changed, 48 insertions(+), 11 deletions(-)

M configuration.nix
M hardware-configuration.nix
M configuration.nix => configuration.nix +43 -11
@@ 11,6 11,11 @@
			./hardware-configuration.nix
			# Prometheus/grafana snippet.
			./prometheus.nix
			# simple-nixos-mailserver
			(builtins.fetchTarball {
				url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/-/archive/master/nixos-mailserver-master.tar.gz";
				sha256 = "0h35al73p15z9v8zb6hi5nq987sfl5wp4rm5c8947nlzlnsjl61x";
			})
		];

	boot = {


@@ 43,9 48,8 @@
	# nixos-rebuild switch --option substitute false
	networking = {
		hostName = "nas"; # Define your hostname.
		domain = "bouncingkiwi.net";
		hostId = "e058e4cd";
		networkmanager.enable = true;
		enableIPv6 = true;

		interfaces = {
			enp0s20f0.useDHCP = true;


@@ 54,17 58,9 @@
			enp0s20f3.useDHCP = true;

			bond0.useDHCP = true;
			# br0.useDHCP = false;
			# br0.ipv4.addresses = [
			# 	{
			# 		address = "10.11.11.2";
			# 		prefixLength = 24;
			# 	}
			# ];
		};

		bonds.bond0.interfaces = ["enp0s20f0" "enp0s20f1" "enp0s20f2" "enp0s20f3"];
		# bridges.br0.interfaces = ["bond0"];

		# Open ports in the firewall.
		firewall = {


@@ 100,7 96,7 @@
		nixos-option
		lm_sensors
		wget curl vim tmux htop lsof tree
		unzip
		unzip unar
		git ripgrep
		clang llvm gcc binutils file
		go


@@ 149,9 145,14 @@
			enable = true;
		};

		# Add users with: `smbpasswd -a <user>`
		samba = {
			enable = true;
			openFirewall = true;
			extraConfig = ''
				# Force directories to have at least user and group write.
				force directory mask = 0775
			'';
			shares.guava = {
				path = "/mnt/guava";
				writeable = "yes";


@@ 182,6 183,37 @@
				proxyWebsockets = true;
			};
		};

		avahi = {
			enable = true;
			#interfaces = [ "bond0" "lo" ];
			reflector = true;
			publish = {
				enable = true;
				addresses = true;
			};
		};
	};

	mailserver = {
		enable = true;
		fqdn = "mail.bouncingkiwi.net";
		domains = [ "bouncingkiwi.net" ];
		loginAccounts = {
			"aaron@bouncingkiwi.net" = {
				hashedPasswordFile = "/mnt/guava/mail/aaron@bouncingkiwi.net/password";
			};
		};
	};

	services.roundcube = {
		enable = true;
		hostName = "mail.bouncingkiwi.net";
		extraConfig = ''
			$config['smtp_server'] = "tls://${config.mailserver.fqdn}";
			$config['smtp_user'] = "%u";
			$config['smtp_pass'] = "%p";
		'';
	};

	# Optimise the disk storage usage

M hardware-configuration.nix => hardware-configuration.nix +5 -0
@@ 73,6 73,11 @@
      fsType = "zfs";
    };

  fileSystems."/mnt/guava/Downloads/music" =
    { device = "guava/Downloads/music";
      fsType = "zfs";
    };

  fileSystems."/mnt/guava/vm" =
    { device = "guava/vm";
      fsType = "zfs";