system: extract shared configuration from host configs
All checks were successful
Run nix flake check / flake-check (push) Successful in 2m15s
Run nix flake check / flake-check (pull_request) Successful in 2m9s

Extract duplicated configuration from gunter and magicman into shared
system modules. This eliminates ~116 lines of duplication and fixes a
malformed gdm.wayland config in magicman.

New shared modules:
- boot.nix: systemd-boot, EFI, common kernel params
- networking.nix: NetworkManager, nftables, firewall base
- hyprland.nix: System-level Hyprland and display manager
- xdg.nix: XDG session variables and portal setup
- nix-config.nix: Nix daemon settings, binary caches, trusted users
- nixpkgs-config.nix: allowUnfree and kernel packages default

Updated modules:
- locale.nix: Added timezone configuration

Benefits:
- Reduces duplication: net reduction of 53 lines
- Magicman gains custom cache substituters for faster builds
- Fixes malformed gdm.wayland config in magicman
- Both hosts use identical base configuration
- Host-specific config clearly stands out

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 09:37:12 +01:00
parent 61ce98ea7a
commit 8c9cc157d1
9 changed files with 103 additions and 150 deletions

View File

@@ -31,14 +31,8 @@
"mt76"
];
# Kernel stuff
kernelPackages = pkgs.linuxPackages_latest;
# kernelPackages = lib.warn "Pinned to kernel 6.12 due to issues" pkgs.linuxPackages_6_12;
kernelParams = [
"quiet"
"splash"
"rd.systemd.show_status=false"
"module_blacklist=amdgpu"
];
kernelParams = [ "module_blacklist=amdgpu" ];
kernel.sysctl = {
"vm.max_map_count" = 262144;
@@ -50,30 +44,34 @@
# Bootloader stuff
loader.systemd-boot = {
enable = true;
configurationLimit = 10;
memtest86.enable = true;
};
loader.efi = {
canTouchEfiVariables = true;
};
supportedFilesystems = [ "nfs" ];
};
# Networking stuff
networking.hostName = "gunter"; # Define your hostname.
networking.networkmanager.enable = true;
networking.nftables.enable = true;
networking.firewall = {
enable = true;
allowedTCPPorts = [
8989
networking.firewall.allowedTCPPorts = [ 8989 ];
# Additional nix caches for homelab and CUDA
nix.settings = {
substituters = [
"https://nix-cache.home.2rjus.net"
"https://cuda-maintainers.cachix.org"
];
trusted-substituters = [
"https://nix-cache.home.2rjus.net"
"https://cuda-maintainers.cachix.org"
];
trusted-public-keys = [
"nix-cache.home.2rjus.net-1:2kowZOG6pvhoK4AHVO3alBlvcghH20wchzoR0V86UWI="
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
];
};
# Set time stuff
time.timeZone = "Europe/Oslo";
# Enable graphics
hardware.graphics = {
enable = true;
@@ -105,7 +103,7 @@
# };
};
# Setup hyprland
# Setup nvidia video drivers
# nixpkgs.overlays = [
# (self: super: {
# hyprland = super.hyprland.override {
@@ -113,68 +111,8 @@
# };
# })
# ];
services.displayManager.gdm.wayland = true;
services.xserver.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];
programs.hyprland = {
enable = true;
withUWSM = true;
xwayland.enable = true;
portalPackage = pkgs.xdg-desktop-portal-hyprland;
};
# Setup common XDG env vars
environment.sessionVariables = rec {
XDG_CACHE_HOME = "$HOME/.cache";
XDG_CONFIG_HOME = "$HOME/.config";
XDG_DATA_HOME = "$HOME/.local/share";
XDG_STATE_HOME = "$HOME/.local/state";
XDG_BIN_HOME = "$HOME/.local/bin";
PATH = [ "${XDG_BIN_HOME}" ];
};
# Setup xdg portal
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
extraPortals = (
with pkgs;
[
# unstable.xdg-desktop-portal-hyprland
xdg-desktop-portal-gtk
]
);
};
# Enable flakes
nix.settings = {
experimental-features = [
"nix-command"
"flakes"
];
trusted-users = [
"root"
"torjus"
];
trusted-substituters = [
"https://nix-cache.home.2rjus.net"
"https://cache.nixos.org"
"https://cuda-maintainers.cachix.org"
];
substituters = [
"https://nix-cache.home.2rjus.net"
"https://cache.nixos.org"
"https://cuda-maintainers.cachix.org"
];
trusted-public-keys = [
"nix-cache.home.2rjus.net-1:2kowZOG6pvhoK4AHVO3alBlvcghH20wchzoR0V86UWI="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
];
};
nixpkgs.config.allowUnfree = true;
# Install system-wide packages
environment.systemPackages = with pkgs; [
curl