Skip to content

Variables Reference

NullString1 edited this page May 29, 2026 · 3 revisions

Variables Reference

Complete reference for configuration variables and the new 3-stage pipeline.

Overview

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.

  1. Base (machines/profiles/base.nix): Defines all possible feature flags (defaults mostly to false).
  2. Profile (machines/profiles/{pc,server}.nix): Enables sets of features based on the machine class.
  3. Machine (machines/{hostname}/default.nix): The specific overrides for that host.

Machine Overrides (machines/{hostname}/default.nix)

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 / WM
  desktopEnvironment = "hyprland"; # "hyprland", "kde", or null
  
  # Hardware
  useNvidiaPrime = true;
  intelBusId = "PCI:0:2:0";
  nvidiaBusId = "PCI:1:0:0";
  
  # Styling
  stylixImage = ../../wallpapers/nord-mountains.jpg;
  
  # Features
  enableBottles = true;
  enableLutris = true;
  enableSteam = true;
  enableOllama = false;

  # Extra NixOS config (quirk)
  boot.devSize = "8G";
}

Core Variables

username & hostname

  • username: The primary user account created on the machine.
  • hostname: System hostname (must match directory name in machines/).

desktopEnvironment

Determines which desktop environment modules are loaded:

  • "hyprland": Enables Hyprland (primary).
  • "kde": Enables KDE Plasma (secondary).
  • null: Headless mode (for servers like nsminipc).

Hardware Configuration

useNvidiaPrime, intelBusId, nvidiaBusId

Used for hybrid graphics setups (like nslapt).

  • useNvidiaPrime = true configures offloading to the NVIDIA dGPU.

extraMonitorSettings

A string of monitor configurations dynamically loaded via Lua for Hyprland or standard Nix config.


Feature Flags

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.

Complete Feature Flags List

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 & User Preferences

  • 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): If false, enables passwordless sudo.
  • autoUpgrade (default: true): Enables automatic NixOS system upgrades.

🖥️ Desktop & UI

  • desktopEnvironment (default: null in base, "hyprland" in pc): Selects the desktop environment. null means headless.
  • terminal (default: "ghostty"): Default terminal emulator application.
  • browser (default: pkgs.brave): Default system web browser.

🛠️ Hardware & Power

  • 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.

🧑‍💻 Development Tools

  • enableGit (default: false): Installs and configures Git.
  • enableDocker (default: false): Installs and enables the Docker container engine.
  • enableDirenv (default: false): Enables direnv for 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.

🎮 Gaming & Compatibility

  • 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.

🌐 Networking & VPN

  • 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.

📦 Applications & Utilities

  • 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.

Secrets via SOPS-Nix

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:

  • githubToken
  • resticRepository and passwords
  • NextDNS credentials (nextdnsServerName, etc.)

The vars Object in Modules

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.mkIf vars.enableSteam {
    programs.steam.enable = true;
  };
}

Next Steps

Clone this wiki locally