Tuning/refactoring/etc

This commit is contained in:
Don Harper 2026-05-16 22:36:47 -05:00
parent cdfcbf76e3
commit 73482423ee
28 changed files with 189 additions and 211 deletions

View file

@ -1,23 +1,29 @@
{ config, lib, pkgs, ... }: {
# Common boot configuration
boot = {
loader = {
systemd-boot = {
enable = true;
configurationLimit = 10;
binfmt.emulatedSystems = lib.optionals (pkgs.stdenv.hostPlatform.system != "aarch64-linux") [ "aarch64-linux" ];
loader =
if config.system != "aarch64-linux"
then {
systemd-boot = {enable = true;};
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot";
};
}
else {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
efi.canTouchEfiVariables = true;
timeout = 3;
};
# Plymouth for boot splash
plymouth.enable = true;
# Kernel parameters
kernelParams = ["quiet" "splash"];
kernel = {sysctl = {"vm.swappiness" = 10;};};
# Console settings
consoleLogLevel = 0;
initrd.verbose = false;
};
}
}

15
hosts/common/default.nix Normal file
View file

@ -0,0 +1,15 @@
{
pkgs,
inputs,
osConfig,
config,
...
}: {
imports = [
./boot.nix
./networking.nix
# ./tailscale.nix
./upgrade-diff.nix
];
}

View file

@ -5,17 +5,30 @@
enableIPv6 = true;
useDHCP = false;
dhcpcd.enable = false;
};
# Firewall
networking.firewall = {
enable = true;
allowPing = true;
firewall = {
enable = true;
trustedInterfaces = ["tailscale0"];
checkReversePath = "loose";
allowedUDPPorts = [config.services.tailscale.port];
allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
}
];
allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
}
];
allowedTCPPorts = [22 80 443];
};
nameservers = [
"1.1.1.1"
"8.8.8.8"
];
};
# DNS
networking.nameservers = [
"1.1.1.1"
"8.8.8.8"
];
}
}

View file

@ -1,6 +1,17 @@
{ lib, ... }: {
options.roles = {
# Window manager selection
citrix = { enable = lib.mkEnableOption "Citrix Workspace client"; };
zoom = { enable = lib.mkEnableOption "Zoom client"; };
gui = { enable = lib.mkEnableOption "GUI environment"; };
games = { enable = lib.mkEnableOption "Gaming packages and Steam"; };
kvm = { enable = lib.mkEnableOption "Virtualization support (libvirtd, waydroid)"; };
kmscon = { enable = lib.mkEnableOption "Console improvements"; };
auto-cpufreq = { enable = lib.mkEnableOption "CPU power management"; };
gnome-calendar = { enable = lib.mkEnableOption "GNOME Calendar integration"; };
tlp = { enable = lib.mkEnableOption "TLP power management"; };
wine = { enable = lib.mkEnableOption "Wine for Windows compatibility"; };
wm = lib.mkOption {
type = lib.types.enum ["sway" "gnome" "none"];
default = "none";
@ -12,4 +23,4 @@
lmstudio = { enable = lib.mkEnableOption "LM Studio AI tools"; };
ollama = { enable = lib.mkEnableOption "Ollama AI server"; };
};
}
}

View file

@ -33,20 +33,14 @@ in {
};
};
imports = [
../../home
../vars.nix
../../home
./systemd.nix
../systemd-primary.nix
# ../comon/tailscale.nix
../common/upgrade-diff.nix
../common
../../modules/beszel-agent.nix
];
# Enable networking
networking.networkmanager.enable = true;
networking.enableIPv6 = true;
networking.useDHCP = false;
# Set your time zone.
time = {
timeZone = "America/Chicago";
@ -65,20 +59,8 @@ in {
# Bootloader.
boot = {
binfmt.emulatedSystems = lib.optionals (pkgs.stdenv.hostPlatform.system != "aarch64-linux") [ "aarch64-linux" ];
kernelPackages = pkgs.linuxPackages_latest;
kernelParams = ["consoleblank=60"];
#loader = {
#systemd-boot = {
#enable = true;
#};
#efi = {
#canTouchEfiVariables = true;
#efiSysMountPoint = "/boot";
#};
#};
plymouth = {enable = true;};
kernel = {sysctl = {"vm.swappiness" = 10;};};
kernelParams = ["consoleblank=60" "quiet" "splash"];
};
security = {
@ -254,25 +236,25 @@ in {
];
# Open ports in the firewall.
networking.firewall = {
enable = true;
trustedInterfaces = ["tailscale0"];
checkReversePath = "loose";
allowedUDPPorts = [config.services.tailscale.port];
allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
}
];
allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
}
];
allowedTCPPorts = [22 80 443];
};
# networking.firewall = {
# enable = true;
# trustedInterfaces = ["tailscale0"];
# checkReversePath = "loose";
# allowedUDPPorts = [config.services.tailscale.port];
# allowedTCPPortRanges = [
# {
# from = 1714;
# to = 1764;
# }
# ];
# allowedUDPPortRanges = [
# {
# from = 1714;
# to = 1764;
# }
# ];
# allowedTCPPorts = [22 80 443];
# };
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions

View file

@ -3,16 +3,19 @@
inputs.sops-nix.nixosModules.sops
../roles/default.nix
../workstation
../common/boot.nix
../common/networking.nix
../common/tailscale.nix
../../home
../../home/gui
../common
../wm/sway
];
config = {
# Common workstation setup
nix.settings.trusted-users = ["root" "don"];
# Server-specific Nix settings
nix.gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 7d";
};
};
}
}

View file

@ -1 +1 @@
{ pkgs, ... }: { imports = [ ./sway ]; }
{ pkgs, ... }: { imports = [ ./sway ./greetd ]; }

View file

@ -2,9 +2,7 @@
with lib;
let cfg = config.roles.auto-cpufreq;
in {
options.roles.auto-cpufreq = {
enable = mkEnableOption "roles auto-cpufreq";
};
# options.roles.auto-cpufreq = { enable = mkEnableOption "roles auto-cpufreq"; };
config = mkIf cfg.enable {
services.auto-cpufreq = {
enable = true;

View file

@ -34,16 +34,12 @@ in {
};
imports = [
inputs.catppuccin.nixosModules.catppuccin
# ../comon/tailscale.nix
../../home
../../home/gui
../../home/gui/gnome-calenar.nix
../../home/work
../vars.nix
../common
../../home
../wm
../wm/greetd
../workstation/games
../workstation/kvm.nix
./games
./kvm.nix
../themes.nix
./detect-reboot-needed.nix
./kmscon.nix
@ -53,7 +49,6 @@ in {
../systemd-primary.nix
./auto-cpufreq.nix
./tlp.nix
../common/upgrade-diff.nix
./wine.nix
];
@ -104,9 +99,7 @@ in {
};
networking = {
enableIPv6 = true;
networkmanager = {
enable = true;
wifi = {powersave = true;};
dispatcherScripts = [
{
@ -124,26 +117,6 @@ in {
}
];
};
useDHCP = false;
firewall = {
enable = true;
trustedInterfaces = ["tailscale0"]; # always allow traffic from your Tailscale network
checkReversePath = "loose";
allowedUDPPorts = [config.services.tailscale.port];
allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
}
];
allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
}
];
allowedTCPPorts = [22];
};
};
# Set your time zone.
@ -165,26 +138,8 @@ in {
# Bootloader.
boot = {
binfmt.emulatedSystems = lib.optionals (pkgs.stdenv.hostPlatform.system != "aarch64-linux") [ "aarch64-linux" ];
# kernelPackages = pkgs.linuxPackages_latest;
kernelPackages = pkgs.linuxPackages_zen;
kernelParams = ["consoleblank=60" "mem_sleep_default=deep"];
# extraModulePackages = [config.boot.kernelPackages.ddcci-driver];
# kernelModules = ["i2c-dev" "ddcci_backlight"];
loader =
if config.system != "aarch64-linux"
then {
systemd-boot = {enable = true;};
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot";
};
}
else {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
plymouth = {enable = true;};
kernel = {sysctl = {"vm.swappiness" = 10;};};
kernelParams = ["consoleblank=60" "mem_sleep_default=deep" "quiet" "splash"];
};
security = {

View file

@ -2,7 +2,7 @@
with lib;
let cfg = config.roles.games;
in {
options.roles.games = { enable = mkEnableOption "roles games"; };
# options.roles.games = { enable = mkEnableOption "roles games"; };
config = mkIf cfg.enable {
programs = {
steam = {

View file

@ -2,7 +2,7 @@
with lib;
let cfg = config.roles.kmscon;
in {
options.roles.kmscon = { enable = mkEnableOption "roles kmscon"; };
# options.roles.kmscon = { enable = mkEnableOption "roles kmscon"; };
config = mkIf cfg.enable {
services = {
kmscon = {

View file

@ -8,7 +8,7 @@
with lib; let
cfg = config.roles.kvm;
in {
options.roles.kvm = {enable = mkEnableOption "roles kvm";};
# options.roles.kvm = {enable = mkEnableOption "roles kvm";};
config = mkIf cfg.enable {
virtualisation = {
libvirtd = {

View file

@ -2,7 +2,7 @@
with lib;
let cfg = config.roles.tlp;
in {
options.roles.tlp = { enable = mkEnableOption "roles tlp"; };
# options.roles.tlp = { enable = mkEnableOption "roles tlp"; };
config = mkIf cfg.enable {
services.tlp = {
enable = true;

View file

@ -2,7 +2,7 @@
with lib;
let cfg = config.roles.wine;
in {
options.roles.wine = { enable = mkEnableOption "roles wine"; };
# options.roles.wine = { enable = mkEnableOption "roles wine"; };
config = mkIf cfg.enable {
home-manager.users.don.home.packages = with pkgs; [
# wineWowPackages.stable