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,5 +1,7 @@
{ config, pkgs, ... }: {
{ config, pkgs, lib, ... }:
{
imports = [ ./bash_complition.nix ];
home.file.".bash_local".source = files/bash/bash_local;
home.file.".bash_aliases".source = files/bash/bash_aliases;
home.file.".bash_functions".source = files/bash/bash_functions;

View file

@ -1,10 +1,5 @@
{ config, pkgs, lib, inputs, osConfig ? null, ... }:
{
pkgs,
inputs,
osConfig,
config,
...
}: {
imports = [
./aerc.nix
./bash.nix
@ -29,6 +24,7 @@
# ./tui.nix
./vifm.nix
];
home.packages = with pkgs; [
inputs.naviterm.packages.${pkgs.stdenv.hostPlatform.system}.default
bc
@ -111,7 +107,7 @@
syncthing = {
enable = true;
guiAddress =
if osConfig.variables ? address
if osConfig != null && osConfig.variables ? address
then "${osConfig.variables.address}:8384"
else "127.0.0.1:8384";
overrideDevices = false;
@ -133,7 +129,7 @@
# enableBashIntegration = true;
# keys = "id_aur id_dsa id_ed25519 git C7E41C9F79C846984163693FCCD8E76F07EA701B";
# };
home.file.".links/links.cfg".source = files/links.cfg;
home.file.".links/links.cfg".source = ./files/links.cfg;
xdg.configFile."nix/nix.conf".text = ''
extra-experimental-features = flakes nix-command
'';

View file

@ -1,4 +1,7 @@
{ config, pkgs, ... }: {
{ config, pkgs, lib, ... }:
{
imports = [ ./bufferline.nix ];
programs.neovim = {
enable = true;
defaultEditor = false;
@ -59,5 +62,4 @@
vimux
];
};
imports = [ ./bufferline.nix ];
}

View file

@ -1,9 +1,12 @@
{
pkgs,
config,
lib,
inputs,
osConfig,
osConfig ? null,
...
}: {
}:
{
imports = [
./bash.nix
./btop.nix
@ -13,6 +16,7 @@
./ssh.nix
./topgrade.nix
];
home.packages = with pkgs; [
figlet
file
@ -49,7 +53,7 @@
enableSshSupport = true;
};
};
home.file.".links/links.cfg".source = files/links.cfg;
home.file.".links/links.cfg".source = ./files/links.cfg;
xdg.configFile."nix/nix.conf".text = ''
extra-experimental-features = flakes nix-command
'';

View file

@ -23,6 +23,8 @@
# inputs.nvf.homeManagerModules.default
inputs.nixvim.homeModules.nixvim
./common
./gui
./work
];
home = {
username = "don";

View file

@ -1,37 +1,30 @@
{ pkgs, inputs, config, lib, osConfig ? null, ... }:
with lib;
{
pkgs,
inputs,
config,
lib,
...
}:
with lib; let
cfg = config.roles.gui;
in {
options.roles.gui = {enable = mkEnableOption "roles gui";};
config = mkIf cfg.enable {
home-manager.users.don = {
imports = [
./alacritty.nix
./autostart.nix
# ./kde.nix
./librewolf.nix
./mpv.nix
./qutebrowser.nix
./services.nix
./sway.nix
./terminals.nix
];
fonts = {fontconfig = {enable = true;};};
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [
(final: prev: {
qutebrowser = prev.qutebrowser.override {
enableWideVine = true;
};
})
];
home.packages = with pkgs; [
imports = [
./alacritty.nix
./autostart.nix
# ./kde.nix
./librewolf.nix
./mpv.nix
./qutebrowser.nix
./services.nix
./sway.nix
./terminals.nix
./gnome-calendar.nix
];
config = mkIf (osConfig != null && osConfig ? roles && osConfig.roles ? gui && osConfig.roles.gui.enable) {
fonts = { fontconfig = { enable = true; }; };
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [
(final: prev: {
qutebrowser = prev.qutebrowser.override {
enableWideVine = true;
};
})
];
home.packages = with pkgs; [
# cura
# poweralertd
# prusa-slicer
@ -159,6 +152,5 @@ in {
};
configFile = {"shikane/config.toml".source = files/shikane.toml;};
};
};
};
}

View file

@ -1,21 +0,0 @@
{ lib, config, pkgs, inputs, outputs, home-manager, ... }:
with lib;
let cfg = config.roles.gnome-calendar;
in {
options.roles.gnome-calendar = {
enable = lib.mkEnableOption "gnome calendar";
};
config = mkIf cfg.enable {
home-manager.users.don.home.packages = with pkgs; [
gnome-calendar
gnome-control-center
];
services = {
gnome = {
evolution-data-server = { enable = true; };
gnome-online-accounts = { enable = true; };
gnome-keyring = { enable = true; };
};
};
};
}

View file

@ -0,0 +1,17 @@
{ lib, config, pkgs, inputs, outputs, home-manager, osConfig ? null, ... }:
with lib;
let
osConfigValue = if osConfig != null then osConfig else {};
cfg = if osConfigValue ? roles && builtins.hasAttr "gnome-calendar" osConfigValue.roles then osConfigValue.roles."gnome-calendar" else { enable = false; };
in {
# options.roles.gnome-calendar = { enable = lib.mkEnableOption "gnome calendar"; };
config = mkIf cfg.enable {
home.packages = with pkgs; [
gnome-calendar
gnome-control-center
evolution
evolution-data-server
gnome-keyring
];
};
}

View file

@ -4,11 +4,10 @@
hostname,
outputs,
config,
osConfig,
...
}: {
} @args: {
xdg.configFile."sway/config".text = ''
# For ${osConfig.networking.hostName}
# For ${(if args ? osConfig then args.osConfig else args.config).networking.hostName}
set $mod Mod1
set $terminal_path /home/don/bin/mynewterm
set $snd_sink alsa_output.usb-Corsair_CORSAIR_VOID_ELITE_Wireless_Gaming_Dongle-00.iec958-stereo
@ -30,7 +29,7 @@
workspace_auto_back_and_forth yes
set $laptop eDP-1
output $laptop scale ${osConfig.variables.swayScale}
output $laptop scale ${(if args ? osConfig then args.osConfig else args.config).variables.swayScale}
output * bg /home/don/nixos/hosts/fan-table-device-box-wallpaper.jpg fill
bindswitch --reload --locked lid:on output $laptop disable
bindswitch --reload --locked lid:off output $laptop enable

View file

@ -1,6 +1,7 @@
{ lib, config, pkgs, inputs, outputs, home-manager, ... }:
{ lib, config, pkgs, inputs, outputs, home-manager, ... }@args:
with lib; let
cfg = config.roles.citrix;
osConfig = if args ? osConfig then args.osConfig else args.config;
cfg = if osConfig ? roles && osConfig.roles ? citrix then osConfig.roles.citrix else {enable = false;};
citrixPkgs = import inputs.nixpkgs {
system = pkgs.system;
config = pkgs.config // {
@ -9,14 +10,13 @@ with lib; let
};
};
in {
options.roles.citrix = {enable = lib.mkEnableOption "citrix tools";};
config = mkIf cfg.enable {
home-manager.users.don.home.packages = with citrixPkgs; [ citrix_workspace ];
home.packages = with citrixPkgs; [ citrix_workspace ];
nixpkgs.config = {
allowUnfree = true;
allowInsecure = true;
};
home-manager.users.don.home.file."ICAClient" = {
home.file."ICAClient" = {
recursive = true;
source = ./files/citrix;
target = ".ICAClient";

View file

@ -31,7 +31,7 @@ with lib; let
citrix_workspace_overlay = pkgs.citrix_workspace; # DELME
in {
options.roles.citrix = {enable = lib.mkEnableOption "citrix tools";};
# options.roles.citrix = {enable = lib.mkEnableOption "citrix tools";};
config = mkIf cfg.enable {
# FIXME : remove when new version of Citrix is released
# home-manager.users.don.home.packages = with pkgs; [citrix_workspace];

View file

@ -1,3 +1,4 @@
{ pkgs, inputs, lib, config, home-manager, outputs, ... }: {
{ pkgs, inputs, lib, config, home-manager, outputs, ... }:
{
imports = [ ./citrix.nix ./zoom.nix ];
}

View file

@ -1,9 +1,10 @@
{ lib, config, pkgs, pkgs-stable, inputs, outputs, home-manager, ... }:
{ lib, config, pkgs, pkgs-stable, inputs, outputs, home-manager, ... }@args:
with lib;
let cfg = config.roles.zoom;
let
osConfig = if args ? osConfig then args.osConfig else args.config;
cfg = if osConfig ? roles && osConfig.roles ? zoom then osConfig.roles.zoom else { enable = false; };
in {
options.roles.zoom = { enable = lib.mkEnableOption "citrix tools"; };
config = mkIf cfg.enable {
home-manager.users.don.home.packages = [ pkgs.zoom-us ];
home.packages = [ pkgs.zoom-us ];
};
}

View file

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

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