Files
nixos-production/configuration.nix
2025-12-22 10:34:20 +00:00

206 lines
5.3 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{ config, pkgs, ... }:
{
############################################################
# BOOTLOADER GRUB (HYBRID BIOS + UEFI, REMOVABLE) test
############################################################
boot.loader.grub = {
enable = true;
device = "nodev";
efiSupport = true;
efiInstallAsRemovable = true;
useOSProber = false;
};
boot.loader.efi = {
canTouchEfiVariables = false;
efiSysMountPoint = "/boot";
};
############################################################
# INITRD HARDWAREAGNOSTIC + LUKS
############################################################
boot.initrd.availableKernelModules = [
"usb_storage"
"xhci_hcd"
"ehci_pci"
"ahci"
"sd_mod"
"nvme"
"sr_mod"
];
boot.kernelModules = [];
boot.initrd.luks.devices.root = {
device = "/dev/disk/by-partlabel/nixos-crypt";
preLVM = true;
allowDiscards = true;
};
############################################################
# FIRMWARE EQUIVALENT TO DEBIAN firmware-*
############################################################
# This replaces ALL of:
# firmware-linux, firmware-iwlwifi, firmware-realtek,
# firmware-amd-graphics, firmware-intel-sound, etc.
hardware.enableAllFirmware = true;
hardware.enableRedistributableFirmware = true;
# CPU microcode (safe for USB systems)
hardware.cpu.intel.updateMicrocode = true;
hardware.cpu.amd.updateMicrocode = true;
############################################################
# FILESYSTEMS LABELBASED
############################################################
fileSystems."/" = {
device = "/dev/disk/by-label/nixos-root";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/EFI";
fsType = "vfat";
};
############################################################
# NETWORKING / WIFI (DEBIAN NetworkManager EQUIVALENT)
############################################################
networking.networkmanager.enable = true;
time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "de_DE.UTF-8";
console.keyMap = "de";
############################################################
# BLUETOOTH (OPTIONAL BUT COMMON)
############################################################
hardware.bluetooth.enable = true;
services.blueman.enable = true;
############################################################
# 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 PIPEWIRE
############################################################
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
############################################################
# PRINTING
############################################################
services.printing.enable = true;
############################################################
# USER
############################################################
users.users.user = {
isNormalUser = true;
description = "user";
extraGroups = [ "wheel" "networkmanager" ];
shell = pkgs.bash;
initialPassword = "1312";
};
############################################################
# 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;
############################################################
# AUTOUPDATE FROM GIT
############################################################
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";
};
};
############################################################
# STABILITY
############################################################
zramSwap.enable = true;
############################################################
# REQUIRED
############################################################
system.stateVersion = "25.11";
}