restructure system to be toggable

This commit is contained in:
2025-10-04 11:46:34 -05:00
parent 464ecdc6ca
commit 8b4d73b2e3
6 changed files with 85 additions and 47 deletions

View File

@@ -5,21 +5,31 @@
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
../../users/blake/blake.nix ../../users/blake/blake.nix
../../modules/system/ssh.nix ../../modules/system/system.nix
../../modules/system/docker.nix # ../../modules/system/ssh.nix
../../modules/system/syncthing.nix # ../../modules/system/docker.nix
../../modules/system/tailscale.nix # ../../modules/system/syncthing.nix
# ../../modules/system/tailscale.nix
../../modules/homelab/homelab.nix ../../modules/homelab/homelab.nix
# ../../modules/homelab/zfs.nix # ../../modules/homelab/zfs.nix
# ../../modules/homelab/smb.nix # ../../modules/homelab/smb.nix
# ../../modules/homelab/nfs.nix # ../../modules/homelab/nfs.nix
]; ];
modules.homelab = { modules = {
system = {
ssh.enable = true;
docker.enable = true;
syncthing.enable = true;
tailscale.enable = true;
#nvidia.enable = true;
};
homelab = {
zfs.enable = true; zfs.enable = true;
smb.enable = false; smb.enable = true;
nfs.enable = true; nfs.enable = true;
}; };
};
# use the systemd-boot EFI boot loader. # use the systemd-boot EFI boot loader.

View File

@@ -1,10 +1,16 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
options = {
modules.system.docker.enable = lib.mkEnableOption "enables docker";
};
config = lib.mkIf config.modules.system.docker.enable {
virtualisation.docker = { virtualisation.docker = {
enable = true; enable = true;
daemon.settings = { daemon.settings = {
experimental = true; experimental = true;
}; };
}; };
};
} }

View File

@@ -1,6 +1,11 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
options = {
modules.system.nvidia.enable = lib.mkEnableOption "enables nvidia";
};
config = lib.mkIf config.modules.system.nvidia.enable {
# enable nvidia proprietary driver # enable nvidia proprietary driver
hardware.nvidia = { hardware.nvidia = {
modesetting.enable = true; # required modesetting.enable = true; # required
@@ -17,4 +22,5 @@
# enable docker gpu passthrough # enable docker gpu passthrough
virtualisation.docker.enableNvidia = true; virtualisation.docker.enableNvidia = true;
};
} }

View File

@@ -1,6 +1,11 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
options = {
modules.system.ssh.enable = lib.mkEnableOption "enables ssh";
};
config = lib.mkIf config.modules.system.ssh.enable {
# enable and configure openssh # enable and configure openssh
services.openssh = { services.openssh = {
enable = true; enable = true;
@@ -10,6 +15,5 @@
X11Forwarding = false; X11Forwarding = false;
}; };
}; };
};
} }

View File

@@ -1,6 +1,11 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
options = {
modules.system.syncthing.enable = lib.mkEnableOption "enables syncthing";
};
config = lib.mkIf config.modules.system.syncthing.enable {
services.syncthing = { services.syncthing = {
enable = true; enable = true;
user = "blake"; user = "blake";
@@ -13,4 +18,5 @@
guiAddress = "0.0.0.0:2222"; guiAddress = "0.0.0.0:2222";
openDefaultPorts = true; openDefaultPorts = true;
}; };
};
} }

View File

@@ -1,10 +1,16 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
options = {
modules.system.tailscale.enable = lib.mkEnableOption "enables tailscale";
};
config = lib.mkIf config.modules.system.tailscale.enable {
services.tailscale = { services.tailscale = {
enable = true; enable = true;
useRoutingFeatures = "both"; useRoutingFeatures = "both";
authKeyFile = "/home/blake/.nix/.keyring/tailscale/authkey"; authKeyFile = "/home/blake/.nix/.keyring/tailscale/authkey";
}; };
};
} }