From 142dd3b56862c3d58346abd1305491fba261d6cc Mon Sep 17 00:00:00 2001 From: blake Date: Sat, 4 Oct 2025 11:26:25 -0500 Subject: [PATCH] restructured & first test of toggleable config --- hosts/snowbelle/configuration.nix | 18 +++++++++++------- modules/docker.nix | 10 ---------- modules/homelab/nfs.nix | 16 +++++++++++----- modules/homelab/smb.nix | 13 +++++++++---- modules/homelab/zfs.nix | 30 ++++++++++++++++++------------ modules/nvidia.nix | 20 -------------------- modules/ssh.nix | 15 --------------- modules/syncthing.nix | 16 ---------------- modules/tailscale.nix | 10 ---------- 9 files changed, 49 insertions(+), 99 deletions(-) delete mode 100644 modules/docker.nix delete mode 100644 modules/nvidia.nix delete mode 100644 modules/ssh.nix delete mode 100644 modules/syncthing.nix delete mode 100644 modules/tailscale.nix diff --git a/hosts/snowbelle/configuration.nix b/hosts/snowbelle/configuration.nix index 94a7261..a5ec775 100644 --- a/hosts/snowbelle/configuration.nix +++ b/hosts/snowbelle/configuration.nix @@ -5,15 +5,19 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix ../../users/blake/blake.nix - ../../modules/ssh.nix - ../../modules/docker.nix - ../../modules/syncthing.nix - ../../modules/tailscale.nix - ../../modules/homelab/zfs.nix - ../../modules/homelab/smb.nix - ../../modules/homelab/nfs.nix + ../../modules/system/ssh.nix + ../../modules/system/docker.nix + ../../modules/system/syncthing.nix + ../../modules/system/tailscale.nix + ../../modules/homelab/homelab.nix +# ../../modules/homelab/zfs.nix +# ../../modules/homelab/smb.nix +# ../../modules/homelab/nfs.nix ]; + + + # use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; diff --git a/modules/docker.nix b/modules/docker.nix deleted file mode 100644 index d0698bc..0000000 --- a/modules/docker.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ config, pkgs, ... }: - -{ - virtualisation.docker = { - enable = true; - daemon.settings = { - experimental = true; - }; - }; -} diff --git a/modules/homelab/nfs.nix b/modules/homelab/nfs.nix index 275abf9..0fe9d17 100644 --- a/modules/homelab/nfs.nix +++ b/modules/homelab/nfs.nix @@ -8,11 +8,17 @@ let ''; in { - # enable nfs with all exports - services.nfs = { - server = { - enable = true; - exports = nfsExports; + options = { + homelab.nfs.enable = lib.mkEnableOption "enables nfs"; + }; + + config = lib.mkIf config.homelab.nfs.enable { + # enable nfs with all exports + services.nfs = { + server = { + enable = true; + exports = nfsExports; + }; }; }; } diff --git a/modules/homelab/smb.nix b/modules/homelab/smb.nix index 6d4c696..b23b72f 100644 --- a/modules/homelab/smb.nix +++ b/modules/homelab/smb.nix @@ -18,10 +18,15 @@ let }; in { - # enable smb with all shares - services.samba = { - enable = true; - settings = smbShares; + options = { + homelab.smb.enable = lib.mkEnableOption "enables smb"; }; + config = lib.mkIf config.homelab.smb.enable { + # enable smb with all shares + services.samba = { + enable = true; + settings = smbShares; + }; + }; } diff --git a/modules/homelab/zfs.nix b/modules/homelab/zfs.nix index d8268b0..3548ba2 100644 --- a/modules/homelab/zfs.nix +++ b/modules/homelab/zfs.nix @@ -1,22 +1,28 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: { - # set network host id - networking.hostId = "3e6e7055"; + options = { + homelab.zfs.enable = lib.mkEnableOption "enables zfs"; + }; - # enable zfs support - boot.kernelModules = [ "zfs" ]; - boot.supportedFilesystems = [ "zfs" ]; + config = lib.mkIf config.homelab.zfs.enable { + # set network host id + networking.hostId = "3e6e7055"; - # enable smart monitoring - services.smartd.enable = true; + # enable zfs support + boot.kernelModules = [ "zfs" ]; + boot.supportedFilesystems = [ "zfs" ]; - # enable zfs - services.zfs = { - autoScrub.enable = true; - autoScrub.interval = "weekly"; + # enable smart monitoring + services.smartd.enable = true; + # enable zfs + services.zfs = { + autoScrub.enable = true; + autoScrub.interval = "weekly"; + + }; }; } diff --git a/modules/nvidia.nix b/modules/nvidia.nix deleted file mode 100644 index 6a6dd65..0000000 --- a/modules/nvidia.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - # enable nvidia proprietary driver - hardware.nvidia = { - modesetting.enable = true; # required - open = false; # use proprietary driver - nvidiaSettings = true; # no shit - powerManagement.enable = false; # can cause sleep issues - package = config.boot.kernelPackages.nvidiaPackages.stable; - }; - - # install nvidia-smi - environment.systemPackages = with pkgs; [ - nvidia-smi - ]; - - # enable docker gpu passthrough - virtualisation.docker.enableNvidia = true; -} diff --git a/modules/ssh.nix b/modules/ssh.nix deleted file mode 100644 index c3327fa..0000000 --- a/modules/ssh.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - # enable and configure openssh - services.openssh = { - enable = true; - settings = { - PasswordAuthentication = true; - PermitRootLogin = "no"; - X11Forwarding = false; - }; - }; - - -} diff --git a/modules/syncthing.nix b/modules/syncthing.nix deleted file mode 100644 index 4db4f65..0000000 --- a/modules/syncthing.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, pkgs, ... }: - -{ - services.syncthing = { - enable = true; - user = "blake"; - group = "blake"; - - dataDir = "/home/blake/.local/state/syncthing"; - configDir = "/home/blake/.config/syncthing"; - - # webui - guiAddress = "0.0.0.0:2222"; - openDefaultPorts = true; - }; -} diff --git a/modules/tailscale.nix b/modules/tailscale.nix deleted file mode 100644 index f0d85da..0000000 --- a/modules/tailscale.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ config, pkgs, ... }: - -{ - services.tailscale = { - enable = true; - - useRoutingFeatures = "both"; - authKeyFile = "/home/blake/.nix/.keyring/tailscale/authkey"; - }; -}