Update configuration.nix
This commit is contained in:
@@ -4,40 +4,16 @@ let
|
||||
gitLocalPath = "/var/lib/nixos-config";
|
||||
in
|
||||
{
|
||||
# NO hardware configuration import - we handle boot and filesystems directly
|
||||
imports = [ ./hardware-configuration.nix ];
|
||||
|
||||
# Generic boot settings for any UEFI system
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
boot.supportedFilesystems = [ "vfat" "ext4" "crypto_LUKS" ];
|
||||
|
||||
# Generic kernel modules for most hardware
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "sr_mod"
|
||||
"usbhid" "hid_generic" "nvme"
|
||||
];
|
||||
# Fixed: hostname commented out to avoid collisions when cloned to multiple USB sticks
|
||||
# networking.hostName = "nixos-usb"; # ← removed
|
||||
|
||||
# Filesystem setup using device paths that work for most USB installations
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-label/boot";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0077" "dmask=0077" ];
|
||||
};
|
||||
|
||||
# LUKS encryption setup (will be set up during installation)
|
||||
boot.initrd.luks.devices."root" = {
|
||||
device = "/dev/disk/by-label/luks";
|
||||
preLVM = true;
|
||||
};
|
||||
|
||||
# Your existing configuration below (unchanged)
|
||||
networking.hostName = "nixos-usb";
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
time.timeZone = "Europe/Berlin";
|
||||
i18n.defaultLocale = "de_DE.UTF-8";
|
||||
i18n.extraLocaleSettings = {
|
||||
@@ -57,6 +33,7 @@ in
|
||||
services.xserver.desktopManager.gnome.enable = true;
|
||||
services.xserver.xkb.layout = "de";
|
||||
services.xserver.libinput.enable = true;
|
||||
|
||||
console.keyMap = "de";
|
||||
|
||||
services.pulseaudio.enable = false;
|
||||
@@ -75,6 +52,8 @@ in
|
||||
description = "user";
|
||||
extraGroups = [ "networkmanager" "wheel" ];
|
||||
shell = pkgs.bash;
|
||||
# Fixed: added initial password so you can log in after first boot
|
||||
initialPassword = "change-me-on-first-boot";
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
@@ -100,11 +79,10 @@ in
|
||||
|
||||
programs.firefox.enable = true;
|
||||
|
||||
# Keep your auto-update script unchanged
|
||||
# === Auto-update script with full PATH and NIX_PATH ===
|
||||
environment.etc."update-nixos-config.sh".text = ''
|
||||
#!/run/current-system/sw/bin/bash
|
||||
set -e
|
||||
# Ensure all system tools are available
|
||||
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"
|
||||
@@ -133,6 +111,7 @@ in
|
||||
|
||||
environment.etc."update-nixos-config.sh".mode = "0700";
|
||||
|
||||
# === Systemd service ===
|
||||
systemd.services.nixos-git-update = {
|
||||
description = "Update NixOS from public Git config";
|
||||
script = "/etc/update-nixos-config.sh";
|
||||
@@ -152,5 +131,12 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
# Fixed: added USB and storage modules for reliable boot from USB stick
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "usb_storage" "sd_mod" "sr_mod" ];
|
||||
|
||||
# Fixed: added ZRAM to avoid crashes due to low RAM on portable systems
|
||||
zramSwap.enable = true;
|
||||
|
||||
# Left unchanged per your request
|
||||
system.stateVersion = "25.11";
|
||||
}
|
||||
Reference in New Issue
Block a user