diff --git a/hosts/test/configuration.nix b/hosts/test/configuration.nix new file mode 100644 index 0000000..a9c0db7 --- /dev/null +++ b/hosts/test/configuration.nix @@ -0,0 +1,10 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + imports = [ ./hardware-configuration.nix ]; +} diff --git a/modules/core/config.nix b/modules/core/config.nix index 5e19535..702464d 100644 --- a/modules/core/config.nix +++ b/modules/core/config.nix @@ -7,12 +7,12 @@ let cfg = config.homelab.core; - allowRootSSH = if cfg.ssh.PermitRootLogin then "yes" else "no"; + allowRootSSH = if cfg.ssh.permitRootLogin then "yes" else "no"; in { config = { - boot.kernelPackages = shared.kernelMap.${cfg.kernel}; + boot.kernelPackages = shared.kernelOptions.${cfg.kernel}; time.timeZone = "America/Chicago"; @@ -91,21 +91,18 @@ in }; boot.loader = - if cfg.bootloader == "grub" then + if cfg.bootloader.type == "grub" then { grub = { - enable = cfg.grub.enable; - device = cfg.grub.device; + enable = cfg.bootloader.grub.enable; + device = cfg.bootloader.grub.device; }; systemd-boot.enable = false; } else { - systemd-boot = { - enable = cfg.systemd.enable; - efiSupport = cfg.systemd.efiSupport; - }; + systemd-boot.enable = cfg.bootloader.systemd.enable; grub.enable = false; }; diff --git a/modules/core/options.nix b/modules/core/options.nix index afdc92d..f9f9019 100644 --- a/modules/core/options.nix +++ b/modules/core/options.nix @@ -73,22 +73,18 @@ }; shell = lib.mkOption { - type = with lib.types; listOf str; + type = lib.types.str; default = "fish"; description = "The shell the primary user uses"; }; }; - allowUnfree = lib.mkEnableOption { - enable = true; + allowUnfree = lib.mkEnableOption "unfree packages" // { default = true; }; ssh = { - permitRootLogin = lib.mkEnableOption { - enable = true; - default = false; - }; + permitRootLogin = lib.mkEnableOption "root SSH login"; }; }; } diff --git a/modules/core/shared.nix b/modules/core/shared.nix index 9c56ac4..8ffbc14 100644 --- a/modules/core/shared.nix +++ b/modules/core/shared.nix @@ -3,7 +3,7 @@ { kernelOptions = { stable = pkgs.linuxPackages; - lts = pkgs.linuxPackages_lts; + lts = pkgs.linuxPackages_6_12; latest = pkgs.linuxPackages_latest; }; } diff --git a/modules/networking/core/default.nix b/modules/networking/core/default.nix index 9f9fac0..357b6b8 100644 --- a/modules/networking/core/default.nix +++ b/modules/networking/core/default.nix @@ -3,24 +3,24 @@ let cfg = config.homelab.networking.core; in { - config = { - imports = [ - ./firewall.nix - ]; + imports = [ + ./firewall.nix + ]; + config = { networking = { networkmanager = { enable = true; dns = "systemd-resolved"; }; - networking.extraHosts = lib.concatMapStringsSep "\n" ( + extraHosts = lib.concatMapStringsSep "\n" ( host: "${host.ip_address} ${host.hostname}" ) cfg.extraHosts; nftables.enable = true; - nameservers = config.core.nameservers; + nameservers = cfg.nameservers; }; services.resolved = { diff --git a/modules/networking/default.nix b/modules/networking/default.nix index 9326373..1301d07 100644 --- a/modules/networking/default.nix +++ b/modules/networking/default.nix @@ -1,8 +1,8 @@ -{ ... }: - { imports = [ + ./options.nix ./core + ./wireguard.nix ./tailscale.nix ]; } diff --git a/modules/networking/options.nix b/modules/networking/options.nix index 2835c86..6433ede 100644 --- a/modules/networking/options.nix +++ b/modules/networking/options.nix @@ -13,8 +13,7 @@ # core core = { firewall = { - allowPing = lib.mkEnableOption "Enable ICMP Pinging" { - enable = true; + allowPing = lib.mkEnableOption "ICMP pinging" // { default = true; }; @@ -117,10 +116,7 @@ # tailscale tailscale = { - enable = lib.mkEnableOption "Enable Tailscale Mesh VPN" { - enable = true; - default = false; - }; + enable = lib.mkEnableOption "Tailscale mesh VPN"; }; }; } diff --git a/modules/networking/tailscale.nix b/modules/networking/tailscale.nix index f216587..c213bc8 100644 --- a/modules/networking/tailscale.nix +++ b/modules/networking/tailscale.nix @@ -1,13 +1,14 @@ { config, lib, ... }: let cfg = config.homelab.networking.tailscale; + user = config.homelab.networking.user; in { config = lib.mkIf cfg.enable { services.tailscale = { enable = true; openFirewall = true; - extraSetFlags = [ "--operator=${cfg.user}" ]; + extraSetFlags = [ "--operator=${user}" ]; }; networking.firewall = { @@ -22,7 +23,7 @@ in systemd.network.wait-online.enable = false; boot.initrd.systemd.network.wait-online.enable = false; - users.users.${cfg.user}.extraGroups = [ + users.users.${user}.extraGroups = [ "tailscale" ]; }; diff --git a/modules/virtualization/options.nix b/modules/virtualization/options.nix index 8b436e1..9e88707 100644 --- a/modules/virtualization/options.nix +++ b/modules/virtualization/options.nix @@ -19,9 +19,8 @@ in podman = { enable = lib.mkEnableOption "Podman support"; - packages = lib.mkEnableOption "Install Relevant Podman packages" { - enable = true; - default = false; + packages = { + enable = lib.mkEnableOption "relevant Podman packages"; }; }; @@ -29,20 +28,11 @@ in qemu = { enable = lib.mkEnableOption "QEMU support"; - containers = lib.mkEnableOption "Enable container support for QEMU" { - enable = true; - default = false; - }; + containers = lib.mkEnableOption "container support for QEMU"; - spiceUSBRedirection = lib.mkEnableOption "Enable spice USB redirection support for QEMU" { - enable = true; - default = false; - }; + spiceUSBRedirection = lib.mkEnableOption "spice USB redirection support for QEMU"; - virtManager = lib.mkEnableOption "Enable virt-manager support for QEMU" { - enable = true; - default = false; - }; + virtManager = lib.mkEnableOption "virt-manager support for QEMU"; bootModules = lib.mkOption { type = lib.types.listOf lib.types.str; diff --git a/modules/virtualization/qemu.nix b/modules/virtualization/qemu.nix index 17b755d..20feb5f 100644 --- a/modules/virtualization/qemu.nix +++ b/modules/virtualization/qemu.nix @@ -11,7 +11,7 @@ in config = lib.mkMerge [ (lib.mkIf cfg.qemu.enable { virtualisation = { - containers.enable = true; + containers.enable = cfg.qemu.containers; libvirtd = { enable = true; qemu = { @@ -34,7 +34,7 @@ in programs.virt-manager.enable = true; }) - (lib.mkIf cfg.qemu.bootModules { + (lib.mkIf cfg.qemu.enable { boot.kernelModules = cfg.qemu.bootModules; }) ];