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

13
system/boot.nix Normal file
View File

@@ -0,0 +1,13 @@
{ pkgs, lib, ... }:
{
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
boot.kernelParams = lib.mkBefore [
"quiet"
"splash"
"rd.systemd.show_status=false"
];
}

View File

@@ -1,16 +1,21 @@
{
imports = [
./boot.nix
./fonts.nix
./root-ca.nix
./fwupd.nix
./git.nix
./greetd.nix
./hyprland.nix
./label.nix
./libvirt.nix
./locale.nix
./networking.nix
./nix-config.nix
./podman.nix
./root-ca.nix
./security.nix
./services.nix
./users.nix
./label.nix
./xdg.nix
];
}

12
system/hyprland.nix Normal file
View File

@@ -0,0 +1,12 @@
{ pkgs, ... }:
{
services.xserver.enable = true;
services.displayManager.gdm.wayland = true;
programs.hyprland = {
enable = true;
withUWSM = true;
xwayland.enable = true;
portalPackage = pkgs.xdg-desktop-portal-hyprland;
};
}

View File

@@ -1,5 +1,7 @@
{ ... }:
{
time.timeZone = "Europe/Oslo";
i18n = {
supportedLocales = [
"en_US.UTF-8/UTF-8"

8
system/networking.nix Normal file
View File

@@ -0,0 +1,8 @@
{ lib, ... }:
{
networking.networkmanager.enable = true;
networking.nftables.enable = true;
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = lib.mkDefault [ ];
networking.firewall.allowedUDPPorts = lib.mkDefault [ ];
}

24
system/nix-config.nix Normal file
View File

@@ -0,0 +1,24 @@
{ ... }:
{
nixpkgs.config.allowUnfree = true;
nix.settings = {
experimental-features = [
"nix-command"
"flakes"
];
trusted-users = [
"root"
"torjus"
];
substituters = [ "https://cache.nixos.org" ];
trusted-substituters = [ "https://cache.nixos.org" ];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
};
}

17
system/xdg.nix Normal file
View File

@@ -0,0 +1,17 @@
{ pkgs, ... }:
{
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}" ];
};
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
};
}