general improvements

1. Security: Navidrome no longer exposed to network (localhost only)
2. Maintainability: Single username definition in flake.nix:45
3. Organization: Kernel params now in configuration.nix, session vars in
desktop.nix
4. Automation: Flathub repository added automatically on activation
5. Cleanup: Removed duplicate programs.dconf.enable
This commit is contained in:
Melvin Ragusa
2026-02-02 23:39:09 +01:00
parent bf2933d4d6
commit 1a7e86e99e
11 changed files with 43 additions and 43 deletions

View File

@@ -5,6 +5,7 @@
pkgs, pkgs,
inputs, inputs,
lib, lib,
username,
... ...
}: }:
@@ -35,6 +36,12 @@
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest-x86_64-v3; boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest-x86_64-v3;
# Kernel parameters (consolidated from modules)
boot.kernelParams = [
"amd_pstate=active" # Modern Ryzen power management (from power.nix)
"amdgpu.ppfeaturemask=0xffffffff" # Full AMD GPU power features (from gpu-amd.nix)
];
# sched-ext scheduler for gaming performance # sched-ext scheduler for gaming performance
services.scx.enable = true; services.scx.enable = true;
services.scx.scheduler = "scx_lavd"; # Low-latency scheduler, good for gaming services.scx.scheduler = "scx_lavd"; # Low-latency scheduler, good for gaming
@@ -116,7 +123,7 @@
# ═══════════════════════════════════════════════════════════════ # ═══════════════════════════════════════════════════════════════
# USER # USER
# ═══════════════════════════════════════════════════════════════ # ═══════════════════════════════════════════════════════════════
users.users.pinj = { users.users.${username} = {
isNormalUser = true; isNormalUser = true;
description = "Melvin Ragusa"; description = "Melvin Ragusa";
extraGroups = [ extraGroups = [

View File

@@ -42,11 +42,14 @@
inputs@{ self, nixpkgs, ... }: inputs@{ self, nixpkgs, ... }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
username = "pinj"; # Single source of truth for username
in in
{ {
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = { inherit inputs; }; specialArgs = {
inherit inputs username;
};
modules = [ modules = [
./configuration.nix ./configuration.nix
{ nixpkgs.overlays = [ inputs.nix-cachyos-kernel.overlays.pinned ]; } { nixpkgs.overlays = [ inputs.nix-cachyos-kernel.overlays.pinned ]; }

View File

@@ -40,7 +40,8 @@
# Enable Flatpak for additional apps (Feishin, etc.) # Enable Flatpak for additional apps (Feishin, etc.)
services.flatpak.enable = true; services.flatpak.enable = true;
# Add Flathub repository automatically on activation # Automatically add Flathub repository on system activation
# Run manually after first boot: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo system.activationScripts.flatpak-flathub.text = ''
# Then install Feishin: flatpak install flathub io.github.feishin.feishin ${pkgs.flatpak}/bin/flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo || true
'';
} }

View File

@@ -73,10 +73,13 @@
# XDG # XDG
XDG_SESSION_TYPE = "wayland"; XDG_SESSION_TYPE = "wayland";
XDG_CURRENT_DESKTOP = "niri"; XDG_CURRENT_DESKTOP = "niri";
};
# Enable dconf for GTK settings # Theming (consolidated from theming.nix)
programs.dconf.enable = true; QT_QPA_PLATFORMTHEME = "qt6ct";
GTK_THEME = "adw-gtk3-dark";
XCURSOR_THEME = "Adwaita";
XCURSOR_SIZE = "24";
};
# GNOME services for better desktop integration # GNOME services for better desktop integration
services.gvfs.enable = true; # Virtual filesystem (trash, MTP, SMB) services.gvfs.enable = true; # Virtual filesystem (trash, MTP, SMB)

View File

@@ -4,6 +4,7 @@
config, config,
pkgs, pkgs,
lib, lib,
username,
... ...
}: }:
@@ -21,7 +22,7 @@
}; };
# Add user to docker group # Add user to docker group
users.users.pinj.extraGroups = [ "docker" ]; users.users.${username}.extraGroups = [ "docker" ];
# Direnv for per-project environments # Direnv for per-project environments
programs.direnv = { programs.direnv = {

View File

@@ -4,6 +4,7 @@
config, config,
pkgs, pkgs,
lib, lib,
username,
... ...
}: }:
@@ -71,5 +72,5 @@
]; ];
# Add user to gamemode group # Add user to gamemode group
users.users.pinj.extraGroups = [ "gamemode" ]; users.users.${username}.extraGroups = [ "gamemode" ];
} }

View File

@@ -4,6 +4,7 @@
config, config,
pkgs, pkgs,
lib, lib,
username,
... ...
}: }:
@@ -39,13 +40,9 @@
hardware.amdgpu.overdrive.enable = true; hardware.amdgpu.overdrive.enable = true;
# Add user to corectrl group for full access without password # Add user to corectrl group for full access without password
users.users.pinj.extraGroups = [ "corectrl" ]; users.users.${username}.extraGroups = [ "corectrl" ];
# Kernel parameters for AMD GPU # NOTE: Kernel params (amdgpu.ppfeaturemask) are in configuration.nix
boot.kernelParams = [
# Enable all power management features
"amdgpu.ppfeaturemask=0xffffffff"
];
# GPU monitoring tools # GPU monitoring tools
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View File

@@ -4,6 +4,7 @@
config, config,
pkgs, pkgs,
lib, lib,
username,
... ...
}: }:
@@ -16,10 +17,11 @@
settings = { settings = {
# Music library location # Music library location
MusicFolder = "/home/pinj/Music"; MusicFolder = "/home/${username}/Music";
# Server settings # Server settings
Address = "0.0.0.0"; # Bind to localhost only - access via Tailscale if needed remotely
Address = "127.0.0.1";
Port = 4533; Port = 4533;
# UI settings # UI settings
@@ -48,12 +50,12 @@
}; };
}; };
# Open firewall for Navidrome # Firewall not needed - Navidrome binds to localhost only
# Remove or comment out if you only access locally # Uncomment if you need network access:
networking.firewall.allowedTCPPorts = [ 4533 ]; # networking.firewall.allowedTCPPorts = [ 4533 ];
# Ensure music directory exists and has correct permissions # Ensure music directory exists and has correct permissions
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d /home/pinj/Music 0755 pinj users -" "d /home/${username}/Music 0755 ${username} users -"
]; ];
} }

View File

@@ -28,12 +28,5 @@
power-profiles-daemon # Already enabled as service, CLI tool for control power-profiles-daemon # Already enabled as service, CLI tool for control
]; ];
# ═══════════════════════════════════════════════════════════════ # NOTE: Kernel params (amd_pstate) are in configuration.nix
# KERNEL PARAMETERS FOR POWER EFFICIENCY
# ═══════════════════════════════════════════════════════════════
# These help reduce power draw on idle desktop systems
boot.kernelParams = [
# Enable AMD P-State driver for modern Ryzen CPUs
"amd_pstate=active"
];
} }

View File

@@ -80,19 +80,10 @@
]; ];
# ───────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────
# Environment Variables for Theming # Cursor and Icon Paths
# ───────────────────────────────────────────────────────────── # ─────────────────────────────────────────────────────────────
environment.sessionVariables = { # NOTE: Session variables (GTK_THEME, XCURSOR_*, QT_QPA_PLATFORMTHEME)
# Qt platform integration # are consolidated in desktop.nix
QT_QPA_PLATFORMTHEME = "qt6ct";
# GTK theme (for apps that don't read dconf)
GTK_THEME = "adw-gtk3-dark";
# Cursor theme
XCURSOR_THEME = "Adwaita";
XCURSOR_SIZE = "24";
};
# Ensure cursor themes are found # Ensure cursor themes are found
environment.pathsToLink = [ "/share/icons" ]; environment.pathsToLink = [ "/share/icons" ];

View File

@@ -4,6 +4,7 @@
config, config,
pkgs, pkgs,
lib, lib,
username,
... ...
}: }:
@@ -51,7 +52,7 @@
# ═══════════════════════════════════════════════════════════════ # ═══════════════════════════════════════════════════════════════
# USER PERMISSIONS # USER PERMISSIONS
# ═══════════════════════════════════════════════════════════════ # ═══════════════════════════════════════════════════════════════
users.users.pinj.extraGroups = [ "libvirtd" ]; users.users.${username}.extraGroups = [ "libvirtd" ];
# ═══════════════════════════════════════════════════════════════ # ═══════════════════════════════════════════════════════════════
# DCONF SETTINGS FOR VIRT-MANAGER # DCONF SETTINGS FOR VIRT-MANAGER