- Notifications
You must be signed in to change notification settings - Fork 0
Variables Reference
Complete reference for configuration variables and the new 3-stage pipeline.
NullOS config is no longer driven by a single variables.nix. Instead, it uses a three-stage pipeline defined in flake.nix that resolves into a vars object available to all modules.
- Base (
machines/profiles/base.nix): Defines all possible feature flags (defaults mostly tofalse). - Profile (
machines/profiles/{pc,server}.nix): Enables sets of features based on the machine class. - Machine (
machines/{hostname}/default.nix): The specific overrides for that host.
In each machine's default.nix, you define a set of variables that override the base and profile configurations. Any non-reserved attributes provided here are automatically converted into extraNixosConfig, allowing arbitrary NixOS config directly in the machine file.
Example machines/nslapt/default.nix:
{username="nullstring";hostname="nslapt";system="x86_64-linux";# Desktop / WMdesktopEnvironment="hyprland";# "hyprland", "kde", or null# HardwareuseNvidiaPrime=true;intelBusId="PCI:0:2:0";nvidiaBusId="PCI:1:0:0";# StylingstylixImage=../../wallpapers/nord-mountains.jpg;# FeaturesenableBottles=true;enableLutris=true;enableSteam=true;enableOllama=false;# Extra NixOS config (quirk)boot.devSize="8G";}username: The primary user account created on the machine.hostname: System hostname (must match directory name inmachines/).
Determines which desktop environment modules are loaded:
"hyprland": Enables Hyprland (primary)."kde": Enables KDE Plasma (secondary).null: Headless mode (for servers likensminipc).
Used for hybrid graphics setups (like nslapt).
useNvidiaPrime = trueconfigures offloading to the NVIDIA dGPU.
A string of monitor configurations dynamically loaded via Lua for Hyprland or standard Nix config.
Various boolean flags defined in base.nix that conditionally load Home Manager and NixOS modules.
enableSteam,enableLutris,enableBottles: Gaming features.enableOpencode,enableVSCode,enableNVIM: Development tools.enableDocker,enableDirenv: Work environments.enableOllama: AI services.enableMullvadVPN,enableTailscale: Networking tools.
These feature flags are defined in machines/profiles/base.nix (which defaults them to mostly false or sensible base defaults). They can be overridden in machines/profiles/{pc,server}.nix and machines/{hostname}/default.nix.
system(default:"x86_64-linux"): Target system architecture.username(default:"nullstring1"): Primary system user account name.gitUsername/gitEmail: Default credentials used for Git commits.keyboardLayout(default:"gb"): X11/Wayland desktop keyboard layout.consoleKeyMap(default:"uk"): TTY console keymap.timeZone(default:"Europe/London"): System time zone configuration.locale(default:"en_GB.UTF-8"): System locale and language formatting.requirePasswordForSudo(default:true): Iffalse, enables passwordless sudo.autoUpgrade(default:true): Enables automatic NixOS system upgrades.
desktopEnvironment(default:nullin base,"hyprland"in pc): Selects the desktop environment.nullmeans headless.terminal(default:"ghostty"): Default terminal emulator application.browser(default:pkgs.brave): Default system web browser.
laptopPowerManagement(default:false): Toggles battery optimization services (e.g., TLP, auto-cpufreq) for laptops.enableBluetooth(default:true): Enables Bluetooth daemon and support tools.enableAudio(default:true): Enables sound services (PipeWire).printEnable(default:false): Enables CUPS printing services.useNvidia/useNvidiaPrime/enableNvidiaOffload: NVIDIA driver and Optimus/PRIME toggles.intelBusId/nvidiaBusId: PCI bus IDs used by PRIME.
enableGit(default:false): Installs and configures Git.enableDocker(default:false): Installs and enables the Docker container engine.enableDirenv(default:false): Enablesdirenvfor per-directory environments.enableNVIM(default:false): Installs Neovim.enableVSCode(default:false): Installs Visual Studio Code.enableOpencode(default:false): Installs Opencode tools.enableAndroid(default:false): Installs Android dev tools (adb, Android Studio).enableDBGate(default:false): Installs DbGate (database client/manager).enableDevMisc(default:false): Installs misc dev utilities (binwalk, hexedit, etc.).enableOllama/enableExposeOllama: Toggles for the Ollama local AI server.
enableSteam,enableLutris,enableBottles: Gaming clients and WINE prefix managers.enableMoonlight: Installs Moonlight for game streaming.enableWine: Installs the standard WINE compatibility layer.enableMinecraft: Installs a Minecraft launcher.
enableTailscale(default:false): Enables the Tailscale mesh VPN daemon.enableMullvadVPN: Enables Mullvad VPN application and daemon.enableCloudflareWarp: Enables Cloudflare WARP client.enableOpenFortiVPN: Enables OpenFortiVPN client.enableWayVNC: Enables WayVNC (VNC server designed for Wayland).enableNextDNS: Enables NextDNS integration for system-wide blocking.
enableFlatpak(default:false): Enables Flatpak support.enableQBittorrent(default:false): Installs the qBittorrent client.enableGnomeNetworkDisplays(default:false): Enables Miracast/screencasting support.enableLibreOffice(default:false): Installs the LibreOffice productivity suite.enableResticBackup(default:false): Enables automated, scheduled Restic backups.
Variables like access tokens and passwords have been moved to SOPS encryption.
Secrets are kept in machines/{hostname}/secrets.yaml and unlocked using an age key located at ~/.config/sops/age/keys.txt.
Common secrets:
githubTokenresticRepositoryand passwords- NextDNS credentials (
nextdnsServerName, etc.)
When writing your own modules (e.g., in home/default.nix or modules/system/), access these settings via the vars argument:
{config,pkgs,vars, ... }:
{config=lib.mkIfvars.enableSteam{programs.steam.enable=true;};}- File Structure - Understand the directory layout
- Per-Machine Config - How to set up new machines