This document provides a comprehensive guide to the issues faced during the configuration and maintenance of a NixOS system, the solutions implemented to resolve these issues, and a set of commands for regular maintenance.
During the setup of Home Manager, several errors were encountered, including missing packages and syntax errors in the configuration files.
Updated the home.nix file to ensure proper syntax and included all necessary packages. Removed unnecessary or conflicting packages such as Python-related packages.
{ config, pkgs, ... }:
{
home.username = "rob";
home.homeDirectory = "/home/rob";
home.stateVersion = "24.05";
home.packages = [
pkgs.hugo
pkgs.wget
pkgs.git
pkgs.docker
pkgs.docker-compose
pkgs.ispell
pkgs.nixpkgs-fmt
];
home.file = { };
home.sessionVariables = {
PATH = "${config.home.homeDirectory}/.config/emacs/bin:${pkgs.coreutils}/bin:${pkgs.docker}/bin:${pkgs.git}/bin:${pkgs.wget}/bin:${pkgs.ispell}/bin:${pkgs.nixpkgs-fmt}/bin";
};
programs.bash = {
enable = true;
initExtra = ''
export PATH="$HOME/.config/emacs/bin:$PATH"
'';
shellAliases = {
ll = "ls -la";
gs = "git status";
up = "sudo nixos-rebuild switch --upgrade";
};
};
programs.home-manager.enable = true;
}Errors encountered due to invalid options like system.autoUpgrade.numberOfGenerations. Additionally, issues with ClamAV package causing build failures.
Removed invalid options and ClamAV package from the configuration. Ensured proper inclusion of necessary packages and correct syntax in configuration.nix.
{ config, pkgs, lib, ... }:
let
secrets = import ./secrets.nix;
in
{
imports = [
./hardware-configuration.nix
];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
networking.networkmanager.enable = true;
systemd.services."NetworkManager-wait-online".enable = false;
time.timeZone = "America/Chicago";
i18n.defaultLocale = "en_US.UTF-8";
boot.kernelParams = [
"intel_iommu=on"
"iommu=pt"
];
services.timesyncd.enable = true;
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = lib.mkForce true;
services.xserver.desktopManager.gnome.enable = true;
services.tlp.enable = true;
powerManagement.powertop.enable = true;
services.power-profiles-daemon.enable = false;
services.flatpak.enable = true;
users.mutableUsers = false;
users.users = {
root = {
password = secrets.passdw;
};
rob = {
isNormalUser = true;
description = "Rob Alicea";
extraGroups = [ "wheel" "networkmanager" "docker" "kvm" "libvirtd" ];
password = secrets.passd;
home = "/home/rob";
};
};
environment.systemPackages = with pkgs; [
wget vim git ripgrep fd shellcheck discount cmake gnumake pipenv cabextract flatpak ffmpeg tlp dconf gnome3.gnome-shell gnomeExtensions.pop-shell nixpkgs-fmt emacs qemu_kvm virt-manager virt-viewer gitAndTools.git-extras gnomeExtensions.user-themes gnome-themes-extra arc-theme papirus-icon-theme fastfetch gnome-tweaks
];
boot.kernelModules = [ "binder_linux" "ashmem_linux" ];
fonts.packages = with pkgs; [
fira-code
(pkgs.fetchurl {
url = "https://downloads.sourceforge.net/project/corefonts/the%20fonts/final/arial32.exe";
sha256 = secrets.sha256Hash;
})
];
nix.gc.automatic = true;
nix.gc.dates = "weekly";
nix.gc.options = "--delete-older-than 10d";
networking.wg-quick.interfaces = {
wg0 = {
address = [ "10.72.1.2/24" ];
listenPort = 51820;
privateKey = secrets.wireguardPrivateKey;
dns = [ "10.72.1.1" ];
peers = [{
publicKey = "HYrJHiCFn5+dzDzr1RSHWHsbc0Cv8RhRaABNDl5Xd0A=";
allowedIPs = [ "0.0.0.0/0, ::/0" ];
endpoint = "${secrets.endpoint}:51820";
persistentKeepalive = 25;
}];
};
};
virtualisation.podman.enable = true;
virtualisation.waydroid.enable = true;
virtualisation.docker.enable = true;
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
};
virtualisation.libvirtd = {
enable = true;
qemu.package = pkgs.qemu_kvm;
};
networking.firewall = {
enable = true;
allowedTCPPorts = [ 22 80 443 8443 ];
allowedUDPPorts = [ 123 ];
interfaces = {
"eth0" = { allowedTCPPorts = [ 8080 ]; };
};
};
services.resolved.enable = true;
environment.etc."NetworkManager/NetworkManager.conf".text = lib.mkForce ''
[main]
dns=systemd-resolved
'';
systemd.services.systemd-oomd.enable = false;
systemd.sockets.systemd-oomd.enable = false;
system.stateVersion = "24.05";
}After resolving the issues with Home Manager and system configurations, the system is now stable and functioning as expected. The following maintenance commands are essential for keeping the system updated and optimized.
Keep your system updated with the latest packages and configurations.
sudo nixos-rebuild switch --upgrade --flake .#rob-nixos
home-manager switch --flake .Clean up old generations and unused packages to free up disk space.
sudo nix-collect-garbage -dOptimize the Nix store to improve performance.
sudo nix store optimiseUse journalctl and other tools to monitor system health.
journalctl -xeList and delete old generations to keep your system clean.
nix-env --list-generations
nix-env --delete-generations old- Use Git for version control of your Nix and Home Manager configurations.
- Document custom configurations and important commands for future reference.
If you encounter any issues or need further assistance, feel free to ask for help.

You don't need to manually set
PATHlike that... Home Manager builds a big ol' set of symlinks for all the packages installed viahome.packagesand adds it to your path for you. (Same thing happens forenvironment.systemPackages, but it's the set of symlinks is located in a system-wide place.)