diff --git a/configuration.nix b/configuration.nix index b1305ff..4b1bb67 100644 --- a/configuration.nix +++ b/configuration.nix @@ -4,40 +4,16 @@ let gitLocalPath = "/var/lib/nixos-config"; in { - # NO hardware configuration import - we handle boot and filesystems directly - - # Generic boot settings for any UEFI system + imports = [ ./hardware-configuration.nix ]; + 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" - ]; - - # 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"; + + # Fixed: hostname commented out to avoid collisions when cloned to multiple USB sticks + # networking.hostName = "nixos-usb"; # ← removed + networking.networkmanager.enable = true; + time.timeZone = "Europe/Berlin"; i18n.defaultLocale = "de_DE.UTF-8"; i18n.extraLocaleSettings = { @@ -51,14 +27,15 @@ in LC_TELEPHONE = "de_DE.UTF-8"; LC_TIME = "de_DE.UTF-8"; }; - + 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; + console.keyMap = "de"; - + services.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { @@ -67,18 +44,20 @@ in alsa.support32Bit = true; pulse.enable = true; }; - + services.printing.enable = true; - + users.users.user = { isNormalUser = true; 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; - + environment.systemPackages = with pkgs; [ git vim @@ -97,14 +76,13 @@ in gnomeExtensions.gsconnect gnomeExtensions.dash-to-dock ]; - + 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" @@ -130,9 +108,10 @@ in fi fi ''; - + 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"; @@ -142,7 +121,7 @@ in Group = "root"; }; }; - + systemd.timers.nixos-git-update = { description = "Check for config updates hourly"; wantedBy = [ "timers.target" ]; @@ -151,6 +130,13 @@ in OnUnitActiveSec = "1h"; }; }; - + + # 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"; } \ No newline at end of file