Files
nixos-production/configuration.nix
2025-12-23 12:12:06 +00:00

237 lines
6.2 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
############################################################
boot.loader.grub = {
enable = true;
device = "nodev";
efiSupport = true;
efiInstallAsRemovable = true;
useOSProber = false;
};
boot.loader.efi = {
canTouchEfiVariables = false;
efiSysMountPoint = "/boot";
};
############################################################
# INITRD HARD FAIL, NO RESCUE
############################################################
boot.initrd.systemd.enable = true;
boot.initrd.emergencyAccess = false;
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;
};
############################################################
# KERNEL FAIL DEAD ON I/O LOSS
############################################################
boot.kernelParams = [
"panic=1"
"oops=panic"
"panic_on_warn=1"
];
############################################################
# FIRMWARE WIDE HARDWARE SUPPORT
############################################################
hardware.enableAllFirmware = true;
hardware.enableRedistributableFirmware = true;
hardware.cpu.intel.updateMicrocode = true;
hardware.cpu.amd.updateMicrocode = true;
############################################################
# FILESYSTEMS USB ONLY
############################################################
fileSystems."/" = {
device = "/dev/disk/by-label/nixos-root";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/EFI";
fsType = "vfat";
};
fileSystems."/tmp" = {
fsType = "tmpfs";
options = [ "mode=1777" "nosuid" "nodev" ];
};
############################################################
# MEMORY SAFETY NO SWAP ANYWHERE
############################################################
swapDevices = [ ];
zramSwap.enable = false;
############################################################
# POWER MANAGEMENT DISABLED (CRITICAL)
############################################################
services.logind.lidSwitch = "ignore";
systemd.targets.sleep.enable = false;
systemd.targets.suspend.enable = false;
systemd.targets.hibernate.enable = false;
systemd.targets.hybrid-sleep.enable = false;
############################################################
# NETWORKING
############################################################
networking.networkmanager.enable = true;
time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "de_DE.UTF-8";
console.keyMap = "de";
############################################################
# BLUETOOTH
############################################################
hardware.bluetooth.enable = true;
services.blueman.enable = true;
############################################################
# DESKTOP GNOME
############################################################
services.displayManager.gdm.enable = true;
services.desktopManager.gnome.enable = true;
services.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
gnomeExtensions.apps
gnomeExtensions.window-list
gnomeExtensions.dock-from-dash
gnomeExtensions.places-status-indicator
obsidian
libreoffice
keepassxc
thunderbird
tor-browser
inkscape
gimp
pdfarranger
];
programs.firefox.enable = true;
############################################################
# GIT AUTOUPDATE SCRIPT
############################################################
environment.etc."update-nixos-config.sh".text = ''
#!/run/current-system/sw/bin/bash
set -e
export PATH="/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin"
export NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
LOCAL_PATH="/var/lib/nixos-config"
REPO_URL="https://git.skarockoi.de/ska/nixos-production.git "
if [ ! -d "$LOCAL_PATH/.git" ]; then
mkdir -p "$LOCAL_PATH"
chmod 700 "$LOCAL_PATH"
git clone "$REPO_URL" "$LOCAL_PATH"
else
cd "$LOCAL_PATH"
git fetch origin
LOCAL_HEAD=$(git rev-parse HEAD)
REMOTE_HEAD=$(git rev-parse origin/main)
if [ "$LOCAL_HEAD" != "$REMOTE_HEAD" ]; then
git reset --hard origin/main
nixos-rebuild switch -I nixos-config="$LOCAL_PATH/configuration.nix"
fi
fi
'';
environment.etc."update-nixos-config.sh".mode = "0700";
systemd.services.nixos-git-update = {
description = "Update NixOS from Git config";
script = "/etc/update-nixos-config.sh";
serviceConfig.Type = "oneshot";
};
systemd.timers.nixos-git-update = {
wantedBy = [ "timers.target" ];
timerConfig.OnBootSec = "60s";
};
############################################################
# NIXOS VERSION
############################################################
system.stateVersion = "25.11";
}