-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting
Common issues and solutions for NullOS.
Problem: Missing or misspelled variable in configuration.
Solution:
- Check spelling in
variables.nix - Ensure all required variables are set
- Compare with
variables.nix.example
diff variables.nix variables.nix.exampleProblem: Circular dependency in configuration.
Solution:
- Check for self-referencing variables
- Look for imports that create loops
- Use
nix-instantiateto debug:
nix-instantiate --eval --strict --show-traceProblem: Incorrect package reference or syntax error.
Solution:
Check syntax in package lists:
# Wrong
environment.systemPackages = with pkgs;
vim
git
];
# Correct
environment.systemPackages = with pkgs; [
vim
git
];Problem: Package hash doesn't match expected value.
Solution:
- Update flake:
nix flake update- Clear nix store:
nix-collect-garbage -d- Rebuild:
sudo nixos-rebuild switch --flake .#hostnamePossible Causes:
- NVIDIA driver issues
- Display manager not starting
- Incorrect monitor configuration
Solutions:
**1. Boot to console:
- At GRUB, press 'e' on the boot entry
- Find the line starting with
linuxorlinuxefi - Remove 'quiet' and 'splash' if present
- Add
nomodesetto the end of the line - Boot with Ctrl+X or F10
- Check logs:
sudo journalctl -xb- Disable NVIDIA temporarily:
# In variables.nix
useNvidiaPrime = false;-
Try previous generation:
- Select older generation from GRUB menu
Problem: System boots directly without menu.
Solution:
# In modules/system/boot.nix
boot.loader.timeout = 10; # Show menu for 10 secondsProblem: Old generations not in menu.
Solution:
# List generations
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
# Set specific generation
sudo nix-env --switch-generation 42 --profile /nix/var/nix/profiles/systemSolutions:
- Check monitor connection:
hyprctl monitors- Manual monitor config:
# In variables.nix
extraMonitorSettings = "
monitor = eDP-1, 1920x1080@60, 0x0, 1
";- Reset to auto:
extraMonitorSettings = "";Solution:
Use nwg-displays (press F8) or manually:
# List available outputs
hyprctl monitors
# Test configuration
hyprctl keyword monitor "DP-1,2560x1440@144,0x0,1"Make permanent in variables.nix:
extraMonitorSettings = "
monitor = DP-1, 2560x1440@144, 0x0, 1
monitor = HDMI-A-1, 1920x1080@60, 2560x0, 1
";Solution:
# In home/hyprland/hyprland.nix
general = {
allow_tearing = false;
};For NVIDIA:
env = WLR_DRM_NO_ATOMIC,1Check logs:
journalctl --user -u hyprland -fCommon fixes:
- Missing environment variables:
# In home/hyprland/env.nix
env = [
"XDG_CURRENT_DESKTOP,Hyprland"
"XDG_SESSION_TYPE,wayland"
"XDG_SESSION_DESKTOP,Hyprland"
];- NVIDIA cursor issues:
env = [
"WLR_NO_HARDWARE_CURSORS,1"
];Solutions:
- Check for conflicts:
hyprctl binds- Verify syntax:
# Correct
bind = SUPER, Return, exec, ghostty
# Wrong - missing comma
bind = SUPER Return exec ghostty- Reload config:
hyprctl reloadDebug:
# Try from terminal
ghostty
firefox
# Check if installed
which ghosttyFix path:
# Ensure apps are in packages
home.packages = with pkgs; [
ghostty
firefox
];Solutions:
- Check PipeWire:
systemctl --user status pipewire
systemctl --user status pipewire-pulse- Restart audio:
systemctl --user restart pipewire pipewire-pulse- Check volume:
wpctl status
wpctl set-volume @DEFAULT_AUDIO_SINK@ 50%-
Select output:
- Press
SUPER + Mto open Pavucontrol - Check Configuration and Output Devices tabs
- Press
Solution:
# In modules/system/audio.nix
services.pipewire.extraConfig.pipewire = {
"context.properties" = {
"default.clock.rate" = 48000;
"default.clock.quantum" = 1024;
"default.clock.min-quantum" = 512;
};
};Solutions:
# Restart Bluetooth
sudo systemctl restart bluetooth
# Check codec
pactl list | grep bluetoothEnable better codecs:
hardware.bluetooth = {
enable = true;
settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
};Solutions:
- Check interface:
ip link
nmcli device status- Enable NetworkManager:
networking.networkmanager.enable = true;- Connect to network:
nmcli device wifi list
nmcli device wifi connect "SSID" password "password"Solution:
# In variables.nix
add_rtl8852cu = true;Tailscale:
# Check status
tailscale status
# Reauthenticate
tailscale upMullvad:
mullvad status
mullvad connectSolutions:
- Check build log:
nix log /nix/store/failed-build-path- Update flake:
nix flake update- Try stable version:
environment.systemPackages = [
pkgs.stable.package-name
];Solutions:
- Search correctly:
nix search nixpkgs package-name- Check if unfree:
# Should already be enabled
nixpkgs.config.allowUnfree = true;- Use correct attribute:
# Find exact name
nix search nixpkgs --json "package" | jqProblem: Two packages provide the same file.
Solution:
Use priority or overlay:
home.packages = [
(pkgs.package1.overrideAttrs (old: {
meta = old.meta // { priority = 1; };
}))
pkgs.package2
];Solutions:
- Rebuild home-manager:
home-manager switch --flake .- Check for errors:
home-manager switch --flake . --show-trace- Restart user services:
systemctl --user daemon-reloadCheck boot time:
systemd-analyze
systemd-analyze blameSolutions:
- Disable unnecessary services:
services.unnecessary-service.enable = false;- Optimize nix:
nix.settings = {
auto-optimise-store = true;
max-jobs = "auto";
};Check processes:
btop
htopCommon culprits:
- Baloo indexer (KDE):
services.baloo.enable = false;- Update services:
systemctl list-units --type=service --state=runningCheck usage:
free -h
btopSolutions:
- Increase swap:
swapDevices = [{
device = "/swapfile";
size = 16384; # 16GB
}];- Disable memory-hungry services
Solution:
# In variables.nix
gitUsername = "Your Name";
gitEmail = "you@email.com";Or manually:
git config --global user.name "Your Name"
git config --global user.email "you@email.com"Generate key:
nix-shell -p openssh --run "ssh-keygen -t ed25519 -C 'your@email.com'"Add to GitHub:
cat ~/.ssh/id_ed25519.pub
# Copy output to GitHub Settings → SSH KeysTest:
ssh -T git@github.comSolution:
Should already be enabled in NullOS, but verify:
# In flake.nix or configuration.nix
nix.settings.experimental-features = [ "nix-command" "flakes" ];Clean up:
# Remove old generations
sudo nix-collect-garbage -d
# Optimize store
nix-store --optimise
# Check space
df -h /nix/storeSolutions:
- Parallelize builds:
nix.settings.max-jobs = "auto";
nix.settings.cores = 4;- Use binary cache:
nix.settings.substituters = [
"https://cache.nixos.org"
"https://nix-community.cachix.org"
];Solution:
boot.tmp = {
useTmpfs = true;
tmpfsSize = "50%"; # Increase size
};Common fixes:
# For user files
chmod +x file.sh
# For system files (be careful!)
sudo chmod +x /path/to/fileFor Nix store (DO NOT MODIFY): Nix store is read-only by design. Rebuild instead.
- Boot from NixOS live USB
- Mount partitions:
sudo mount /dev/sdXn /mnt
sudo mount /dev/sdXm /mnt/boot- Chroot:
sudo nixos-enter- Rollback or rebuild:
# List generations
nix-env --list-generations --profile /nix/var/nix/profiles/system
# Switch to old generation
nix-env --switch-generation 42 --profile /nix/var/nix/profiles/systemFrom live USB:
sudo mount /dev/sdXn /mnt
sudo nixos-enter
passwd usernameVerify store:
nix-store --verify --check-contentsRepair:
nix-store --verify --check-contents --repairSystem logs:
journalctl -xe
journalctl -b # Current boot
journalctl -u service-nameUser services:
journalctl --user -xeHyprland logs:
cat ~/.cache/hyprland/hyprland.logVerbose rebuild:
sudo nixos-rebuild switch --flake .#hostname --show-traceNix debug:
nix develop --debugger- NixOS Discourse: https://discourse.nixos.org
- NixOS Wiki: https://nixos.wiki
- Hyprland Discord: https://discord.gg/hyprland
- r/NixOS: https://reddit.com/r/nixos
- Matrix: #nixos:matrix.org
When asking for help, include:
- NixOS version:
nixos-version-
Relevant config snippet
-
Error message:
# Full error output
sudo nixos-rebuild switch --flake .#hostname 2>&1 | tee error.log- Logs:
journalctl -xe > journal.log# Weekly: Update flake
nix flake update
# Weekly: Garbage collect old generations
sudo nix-collect-garbage -d
# Monthly: Optimize store
nix-store --optimise
# Before big changes: Commit to git
git add .
git commit -m "Working config before changes"- Git repository - Version control your config
- Restic backups - Automated backups configured
- Keep old generations - Don't delete all immediately
# Build only (don't activate)
sudo nixos-rebuild build --flake .#hostname
# Test (temporary, reverts on reboot)
sudo nixos-rebuild test --flake .#hostname
# Switch (permanent)
sudo nixos-rebuild switch --flake .#hostnamenix-instantiate --eval --strict --show-trace '<nixpkgs/nixos>' -A config.system.build.toplevelnix build --keep-failed --show-tracenix derivation show .#nixosConfigurations.hostname.config.system.build.toplevelWhen something breaks:
- Check recent changes (git log)
- Review error message carefully
- Check system logs (journalctl)
- Try rebuilding (sudo nixos-rebuild switch)
- Reboot
- Boot into previous generation
- Check NixOS wiki/discourse for similar issues
- Ask in community channels
- File Structure - Understanding configuration layout
- Variables Reference - Configuration variables
- Recovery - Advanced recovery procedures
- Customization Guide - Avoiding issues while customizing