Files
nixos-production/configuration.nix
2025-12-21 11:51:01 +00:00

172 lines
3.8 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, ... }:
{
########################################
# Core system
########################################
boot.loader.systemd-boot.enable = true;
boot.loader.efi = {
canTouchEfiVariables = false;
efiSysMountPoint = "/boot";
};
# EFI fallback loader for removable media (CRITICAL)
boot.loader.systemd-boot.extraInstallCommands = ''
mkdir -p /boot/EFI/BOOT
cp /boot/EFI/systemd/systemd-bootx64.efi \
/boot/EFI/BOOT/BOOTX64.EFI
'';
########################################
# Hardwareagnostic initrd
########################################
boot.initrd.availableKernelModules = [
"usb_storage"
"xhci_hcd"
"ehci_pci"
"ahci"
"sd_mod"
"nvme"
"sr_mod"
];
boot.kernelModules = [];
########################################
# Filesystems by LABEL (clonesafe)
########################################
fileSystems."/" = {
device = "/dev/disk/by-label/nixos-root";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/EFI";
fsType = "vfat";
};
########################################
# Networking / locale
########################################
networking.networkmanager.enable = true;
time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "de_DE.UTF-8";
########################################
# Desktop
########################################
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.xserver.xkb.layout = "de";
console.keyMap = "de";
########################################
# Audio
########################################
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
########################################
# User
########################################
users.users.user = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
shell = pkgs.bash;
# Forced password change strategy (safe)
initialPassword = "1312";
};
########################################
# Packages
########################################
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;
########################################
# Gitbased autoupdate (your logic, cleaned)
########################################
environment.etc."update-nixos-config.sh".text = ''
#!/run/current-system/sw/bin/bash
set -e
export PATH="/run/current-system/sw/bin"
LOCAL="/var/lib/nixos-config"
REPO="https://git.skarockoi.de/ska/nixos-production.git"
if [ ! -d "$LOCAL/.git" ]; then
mkdir -p "$LOCAL"
git clone "$REPO" "$LOCAL"
else
cd "$LOCAL"
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 = {
script = "/etc/update-nixos-config.sh";
serviceConfig.Type = "oneshot";
};
systemd.timers.nixos-git-update = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "1min";
OnUnitActiveSec = "1h";
};
};
########################################
# Reliability on lowRAM systems
########################################
zramSwap.enable = true;
########################################
# Required
########################################
system.stateVersion = "25.11";
}