Files
nixos-production/configuration.nix
2025-12-21 13:56:04 +00:00

178 lines
4.5 KiB
Nix

{ config, pkgs, ... }:
{
############################################################
# BOOTLOADER — GRUB (ROBUST FÜR USB + ECHTE HARDWARE)
############################################################
boot.loader.grub.enable = true;
boot.loader.grub.efiSupport = true;
boot.loader.grub.device = "nodev";
boot.loader.efi = {
canTouchEfiVariables = false;
efiSysMountPoint = "/boot";
};
############################################################
# INITRD — HARDWARE-AGNOSTISCH (USB / SATA / NVMe)
############################################################
boot.initrd.availableKernelModules = [
"usb_storage"
"xhci_hcd"
"ehci_pci"
"ahci"
"sd_mod"
"nvme"
"sr_mod"
];
boot.kernelModules = [];
############################################################
# DATEISYSTEME — LABEL-BASIERT (CLONE-SAFE)
############################################################
fileSystems."/" = {
device = "/dev/disk/by-label/nixos-root";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/EFI";
fsType = "vfat";
};
############################################################
# NETZWERK / ZEIT / LOCALE
############################################################
networking.networkmanager.enable = true;
time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "de_DE.UTF-8";
console.keyMap = "de";
############################################################
# DESKTOP — GNOME
############################################################
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.xserver.xkb.layout = "de";
services.xserver.libinput.enable = true;
############################################################
# AUDIO
############################################################
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
############################################################
# DRUCKER
############################################################
services.printing.enable = true;
############################################################
# USER
############################################################
users.users.user = {
isNormalUser = true;
description = "user";
extraGroups = [ "wheel" "networkmanager" ];
shell = pkgs.bash;
# Passwort MUSS beim ersten Login gesetzt werden
initialHashedPassword = "!";
};
############################################################
# SOFTWARE
############################################################
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
git
vim
curl
wget
openssh
obsidian
libreoffice
keepassxc
thunderbird
tor-browser
inkscape
gimp
pdfarranger
];
programs.firefox.enable = true;
############################################################
# AUTO-UPDATE AUS GIT (OPTIONAL)
############################################################
environment.etc."update-nixos-config.sh".text = ''
#!/run/current-system/sw/bin/bash
set -e
PATH="/run/current-system/sw/bin"
DIR="/var/lib/nixos-config"
REPO="https://git.skarockoi.de/ska/nixos-production.git"
if [ ! -d "$DIR/.git" ]; then
mkdir -p "$DIR"
git clone "$REPO" "$DIR"
else
cd "$DIR"
git fetch origin
if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/main)" ]; then
git reset --hard origin/main
nixos-rebuild switch || true
fi
fi
'';
environment.etc."update-nixos-config.sh".mode = "0700";
systemd.services.nixos-git-update = {
description = "Update NixOS config from git";
script = "/etc/update-nixos-config.sh";
serviceConfig.Type = "oneshot";
};
systemd.timers.nixos-git-update = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "1min";
OnUnitActiveSec = "1h";
};
};
############################################################
# STABILITÄT
############################################################
zramSwap.enable = true;
############################################################
# REQUIRED
############################################################
system.stateVersion = "25.11";
}