system: extract shared configuration from host configs #3

Merged
torjus merged 1 commits from refactor/reduce-host-duplication into master 2026-01-31 08:56:20 +00:00
9 changed files with 103 additions and 150 deletions

View File

@@ -31,14 +31,8 @@
"mt76" "mt76"
]; ];
# Kernel stuff # Kernel stuff
kernelPackages = pkgs.linuxPackages_latest;
# kernelPackages = lib.warn "Pinned to kernel 6.12 due to issues" pkgs.linuxPackages_6_12; # kernelPackages = lib.warn "Pinned to kernel 6.12 due to issues" pkgs.linuxPackages_6_12;
kernelParams = [ kernelParams = [ "module_blacklist=amdgpu" ];
"quiet"
"splash"
"rd.systemd.show_status=false"
"module_blacklist=amdgpu"
];
kernel.sysctl = { kernel.sysctl = {
"vm.max_map_count" = 262144; "vm.max_map_count" = 262144;
@@ -50,30 +44,34 @@
# Bootloader stuff # Bootloader stuff
loader.systemd-boot = { loader.systemd-boot = {
enable = true;
configurationLimit = 10; configurationLimit = 10;
memtest86.enable = true; memtest86.enable = true;
}; };
loader.efi = {
canTouchEfiVariables = true;
};
supportedFilesystems = [ "nfs" ]; supportedFilesystems = [ "nfs" ];
}; };
# Networking stuff # Networking stuff
networking.hostName = "gunter"; # Define your hostname. networking.hostName = "gunter"; # Define your hostname.
networking.networkmanager.enable = true; networking.firewall.allowedTCPPorts = [ 8989 ];
networking.nftables.enable = true;
networking.firewall = { # Additional nix caches for homelab and CUDA
enable = true; nix.settings = {
allowedTCPPorts = [ substituters = [
8989 "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 # Enable graphics
hardware.graphics = { hardware.graphics = {
enable = true; enable = true;
@@ -105,7 +103,7 @@
# }; # };
}; };
# Setup hyprland # Setup nvidia video drivers
# nixpkgs.overlays = [ # nixpkgs.overlays = [
# (self: super: { # (self: super: {
# hyprland = super.hyprland.override { # hyprland = super.hyprland.override {
@@ -113,68 +111,8 @@
# }; # };
# }) # })
# ]; # ];
services.displayManager.gdm.wayland = true;
services.xserver.enable = true;
services.xserver.videoDrivers = [ "nvidia" ]; 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 # Install system-wide packages
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
curl curl

View File

@@ -8,24 +8,13 @@
# Bootloader stuff # Bootloader stuff
boot.kernelParams = [ boot.kernelParams = [
"quiet"
"splash"
"rd.systemd.show_status=false"
"acpi_backlight=native" "acpi_backlight=native"
"video=efifb:nobgrt" "video=efifb:nobgrt"
"loglevel=3" "loglevel=3"
"rd.udev.log_level=3" "rd.udev.log_level=3"
]; ];
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.loader.systemd-boot = { boot.loader.systemd-boot.configurationLimit = 3;
enable = true;
configurationLimit = 3;
};
boot.loader.efi = {
canTouchEfiVariables = true;
};
boot.initrd.systemd.enable = true; boot.initrd.systemd.enable = true;
boot.plymouth = { boot.plymouth = {
@@ -39,14 +28,6 @@
# Networking stuff # Networking stuff
networking.hostName = "magicman"; # Define your hostname. networking.hostName = "magicman"; # Define your hostname.
networking.networkmanager.enable = true;
networking.nftables.enable = true;
networking.firewall = {
enable = true;
};
# Set time stuff
time.timeZone = "Europe/Oslo";
hardware = { hardware = {
enableRedistributableFirmware = true; enableRedistributableFirmware = true;
@@ -80,58 +61,11 @@
}; };
}; };
# Setup hyprland
services.xserver.enable = true;
services.displayManager.gdm.wayland = {
gdm.wayland = true;
lightdm.enable = false;
};
programs.hyprland = {
enable = true;
withUWSM = true;
xwayland.enable = true;
portalPackage = pkgs.xdg-desktop-portal-hyprland;
};
# TRIM # TRIM
services.fstrim.enable = true; services.fstrim.enable = true;
# 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;
[
# xdg-desktop-portal-hyprland
xdg-desktop-portal-gtk
]
);
};
programs.steam.enable = true; programs.steam.enable = true;
# Enable flakes
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nix.settings.trusted-users = [
"root"
"torjus"
];
nixpkgs.config.allowUnfree = true;
# Install system-wide packages # Install system-wide packages
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim vim

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 = [ imports = [
./boot.nix
./fonts.nix ./fonts.nix
./root-ca.nix
./fwupd.nix ./fwupd.nix
./git.nix ./git.nix
./greetd.nix ./greetd.nix
./hyprland.nix
./label.nix
./libvirt.nix ./libvirt.nix
./locale.nix ./locale.nix
./networking.nix
./nix-config.nix
./podman.nix ./podman.nix
./root-ca.nix
./security.nix ./security.nix
./services.nix ./services.nix
./users.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 = { i18n = {
supportedLocales = [ supportedLocales = [
"en_US.UTF-8/UTF-8" "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 ];
};
}