Update configuration.nix
This commit is contained in:
@@ -4,40 +4,16 @@ let
|
|||||||
gitLocalPath = "/var/lib/nixos-config";
|
gitLocalPath = "/var/lib/nixos-config";
|
||||||
in
|
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.systemd-boot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
boot.supportedFilesystems = [ "vfat" "ext4" "crypto_LUKS" ];
|
|
||||||
|
# Fixed: hostname commented out to avoid collisions when cloned to multiple USB sticks
|
||||||
# Generic kernel modules for most hardware
|
# networking.hostName = "nixos-usb"; # ← removed
|
||||||
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";
|
|
||||||
networking.networkmanager.enable = true;
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
time.timeZone = "Europe/Berlin";
|
time.timeZone = "Europe/Berlin";
|
||||||
i18n.defaultLocale = "de_DE.UTF-8";
|
i18n.defaultLocale = "de_DE.UTF-8";
|
||||||
i18n.extraLocaleSettings = {
|
i18n.extraLocaleSettings = {
|
||||||
@@ -51,14 +27,15 @@ in
|
|||||||
LC_TELEPHONE = "de_DE.UTF-8";
|
LC_TELEPHONE = "de_DE.UTF-8";
|
||||||
LC_TIME = "de_DE.UTF-8";
|
LC_TIME = "de_DE.UTF-8";
|
||||||
};
|
};
|
||||||
|
|
||||||
services.xserver.enable = true;
|
services.xserver.enable = true;
|
||||||
services.xserver.displayManager.gdm.enable = true;
|
services.xserver.displayManager.gdm.enable = true;
|
||||||
services.xserver.desktopManager.gnome.enable = true;
|
services.xserver.desktopManager.gnome.enable = true;
|
||||||
services.xserver.xkb.layout = "de";
|
services.xserver.xkb.layout = "de";
|
||||||
services.xserver.libinput.enable = true;
|
services.xserver.libinput.enable = true;
|
||||||
|
|
||||||
console.keyMap = "de";
|
console.keyMap = "de";
|
||||||
|
|
||||||
services.pulseaudio.enable = false;
|
services.pulseaudio.enable = false;
|
||||||
security.rtkit.enable = true;
|
security.rtkit.enable = true;
|
||||||
services.pipewire = {
|
services.pipewire = {
|
||||||
@@ -67,18 +44,20 @@ in
|
|||||||
alsa.support32Bit = true;
|
alsa.support32Bit = true;
|
||||||
pulse.enable = true;
|
pulse.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
services.printing.enable = true;
|
services.printing.enable = true;
|
||||||
|
|
||||||
users.users.user = {
|
users.users.user = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = "user";
|
description = "user";
|
||||||
extraGroups = [ "networkmanager" "wheel" ];
|
extraGroups = [ "networkmanager" "wheel" ];
|
||||||
shell = pkgs.bash;
|
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;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
git
|
git
|
||||||
vim
|
vim
|
||||||
@@ -97,14 +76,13 @@ in
|
|||||||
gnomeExtensions.gsconnect
|
gnomeExtensions.gsconnect
|
||||||
gnomeExtensions.dash-to-dock
|
gnomeExtensions.dash-to-dock
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.firefox.enable = true;
|
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 = ''
|
environment.etc."update-nixos-config.sh".text = ''
|
||||||
#!/run/current-system/sw/bin/bash
|
#!/run/current-system/sw/bin/bash
|
||||||
set -e
|
set -e
|
||||||
# Ensure all system tools are available
|
|
||||||
export PATH="/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin"
|
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"
|
export NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
|
||||||
LOCAL_PATH="/var/lib/nixos-config"
|
LOCAL_PATH="/var/lib/nixos-config"
|
||||||
@@ -130,9 +108,10 @@ in
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
environment.etc."update-nixos-config.sh".mode = "0700";
|
environment.etc."update-nixos-config.sh".mode = "0700";
|
||||||
|
|
||||||
|
# === Systemd service ===
|
||||||
systemd.services.nixos-git-update = {
|
systemd.services.nixos-git-update = {
|
||||||
description = "Update NixOS from public Git config";
|
description = "Update NixOS from public Git config";
|
||||||
script = "/etc/update-nixos-config.sh";
|
script = "/etc/update-nixos-config.sh";
|
||||||
@@ -142,7 +121,7 @@ in
|
|||||||
Group = "root";
|
Group = "root";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.timers.nixos-git-update = {
|
systemd.timers.nixos-git-update = {
|
||||||
description = "Check for config updates hourly";
|
description = "Check for config updates hourly";
|
||||||
wantedBy = [ "timers.target" ];
|
wantedBy = [ "timers.target" ];
|
||||||
@@ -151,6 +130,13 @@ in
|
|||||||
OnUnitActiveSec = "1h";
|
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";
|
system.stateVersion = "25.11";
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user