-
Notifications
You must be signed in to change notification settings - Fork 0
Variables Reference
Complete reference for all available configuration variables in variables.nix.
The variables.nix file is the central configuration hub for NullOS. It contains high-level settings that customize your system without diving into Nix module details.
Location: Root of NullOS directory
Template: variables.nix.example
Git Status: Ignored (add to .gitignore for privacy)
Type: String
Required: Yes
Example: "nullstring"
Your system username. Used for:
- User account creation
- Home directory path (
/home/${username}) - Home Manager configuration
- Git commit author (if not overridden)
username = "yourusername";Type: String
Required: Yes
Example: "NullString"
Your Git commit author name.
gitUsername = "Your Name";Type: String
Required: Yes
Example: "you@example.com"
Your Git commit email address.
gitEmail = "you@example.com";Type: String
Required: Yes
Example: "nslapt" or "nspc"
System hostname. Must match the configuration name in flake.nix.
Available Configurations:
-
nslapt- Laptop configuration -
nspc- Desktop configuration
hostname = "nslapt";Note: When building, use: sudo nixos-rebuild switch --flake .#nslapt
Type: String
Required: Yes
Default: "x86_64-linux"
System architecture. Currently only x86_64 Linux is supported.
system = "x86_64-linux";Type: String
Required: Yes
Example: "Europe/London" or "America/New_York"
System timezone. Find your timezone:
timedatectl list-timezones | grep -i londontimeZone = "Europe/London";Type: String
Required: Yes
Example: "en_GB.UTF-8" or "en_US.UTF-8"
System locale for language and formatting.
locale = "en_GB.UTF-8";Type: String
Required: Yes
Example: "gb", "us", "de", "fr"
X11/Wayland keyboard layout.
keyboardLayout = "gb";Type: String
Required: Yes
Example: "uk", "us", "de", "fr"
Console (TTY) keyboard layout.
consoleKeyMap = "uk";Type: String
Required: Yes
Default: "ghostty"
Default terminal emulator executable name.
Available Options:
-
"ghostty"- Modern GPU-accelerated terminal -
"kitty"- Fast, feature-rich terminal -
"alacritty"- Lightweight GPU terminal
terminal = "ghostty";Type: Package
Required: Yes
Example: pkgs.brave, pkgs.firefox, pkgs.chromium
Default web browser package.
browser = pkgs.brave; # or pkgs.firefox, pkgs.chromium, etc.Type: Boolean
Required: Yes
Default: true (for hybrid graphics laptops)
Enable NVIDIA PRIME for hybrid graphics (Intel + NVIDIA).
-
true- Enable NVIDIA PRIME offload -
false- Disable PRIME (single GPU systems)
useNvidiaPrime = true;When to use true:
- Laptops with Intel CPU + NVIDIA GPU
- Want to use integrated graphics by default
- Want option to run apps on NVIDIA when needed
When to use false:
- Desktop with only NVIDIA GPU
- Desktop with only Intel/AMD GPU
- Single GPU laptops
Type: String
Required: If useNvidiaPrime = true
Example: "PCI:0:2:0"
PCI bus ID for Intel integrated GPU.
How to find:
nix-shell -p pciutils --run "lspci | grep VGA"Output example:
00:02.0 VGA compatible controller: Intel Corporation ...
Convert 00:02.0 to PCI:0:2:0
intelBusId = "PCI:0:2:0";Type: String
Required: If useNvidiaPrime = true
Example: "PCI:2:0:0" or "PCI:1:0:0"
PCI bus ID for NVIDIA GPU.
How to find:
nix-shell -p pciutils --run "lspci | grep -i nvidia"Output example:
02:00.0 VGA compatible controller: NVIDIA Corporation ...
Convert 02:00.0 to PCI:2:0:0
nvidiaBusId = "PCI:2:0:0";Type: Multi-line String
Required: No
Default: ""
Hyprland monitor configuration. Override auto-detection.
Format:
monitor = OUTPUT, RESOLUTION@REFRESH, POSITION, SCALE
Examples:
Single monitor (laptop):
extraMonitorSettings = "
monitor = eDP-1, 1920x1080@60, auto, 1
";Dual monitors (desktop):
extraMonitorSettings = "
monitor = DP-1, 2560x1440@144, 0x0, 1
monitor = HDMI-A-1, 1920x1080@60, 2560x0, 1
";Triple monitors:
extraMonitorSettings = "
monitor = DP-1, 2560x1440@144, 0x0, 1
monitor = DP-2, 1920x1080@60, 2560x0, 1
monitor = DP-3, 1920x1080@60, 2560x1080, 1
";Find monitor names:
hyprctl monitorsLeave empty for auto-detection:
extraMonitorSettings = "";Type: Path
Required: Yes
Example: wallpapers/screen.jpg
Path to wallpaper image used for Stylix theming.
Stylix generates a color scheme from this image and applies it system-wide.
stylixImage = wallpapers/mywall.jpg;Supported formats:
- JPEG (.jpg, .jpeg)
- PNG (.png)
- WebP (.webp)
Tips:
- Images with distinct colors work best
- Place wallpapers in
wallpapers/directory - Use relative path from flake root
Type: Path
Required: Yes
Default: home/waybar/default.nix
Path to Waybar configuration file.
waybarConfig = home/waybar/default.nix;You can create custom Waybar configs:
waybarConfig = home/waybar/custom-waybar.nix;Type: Path
Required: Yes
Default: home/hyprland/animations-end4.nix
Path to Hyprland animation configuration.
animationSet = home/hyprland/animations-end4.nix;Available options:
- Create your own in
home/hyprland/ - Modify existing animation files
- Disable animations entirely
Type: String
Required: Only if using backups
Example: "sftp:user@host:/backups/nslapt"
Restic backup repository location.
Supported backends:
Local:
resticRepository = "/mnt/backup";SFTP:
resticRepository = "sftp:user@server.com:/backups";S3:
resticRepository = "s3:s3.amazonaws.com/bucket-name";B2:
resticRepository = "b2:bucket-name";Note: Also configure password file in modules/services/backup.nix
Type: Boolean
Required: Yes
Default: true
Enable printing support (CUPS).
printEnable = true; # Enable printers
printEnable = false; # Disable printersType: List of Packages
Required: If printEnable = true
Example: [ pkgs.hplip pkgs.gutenprint ]
Printer driver packages.
printDrivers = [ ]; # Auto-detect
printDrivers = [ pkgs.hplip ]; # HP printers
printDrivers = [ pkgs.gutenprint pkgs.epson-escpr ]; # Multiple driversCommon drivers:
-
pkgs.hplip- HP printers -
pkgs.gutenprint- Canon, Epson, etc. -
pkgs.epson-escpr- Epson ESC/P-R -
pkgs.brlaser- Brother laser
Type: Boolean
Required: No
Default: false
Add RTL8852CU WiFi driver (for specific USB WiFi adapters).
add_rtl8852cu = false; # Don't need driver
add_rtl8852cu = true; # Add RTL8852CU driverWhen to enable:
- You have an RTL8852CU USB WiFi adapter
- WiFi not working out-of-box
Here's a complete example variables.nix:
{ nixpkgs, ... }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in
{
username = "alice";
hostname = "nslapt";
system = "x86_64-linux";
gitUsername = "Alice Smith";
gitEmail = "alice@example.com";
terminal = "ghostty";
browser = pkgs.firefox;
keyboardLayout = "us";
consoleKeyMap = "us";
timeZone = "America/New_York";
locale = "en_US.UTF-8";
useNvidiaPrime = true;
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
stylixImage = wallpapers/nord-mountains.jpg;
waybarConfig = home/waybar/default.nix;
animationSet = home/hyprland/animations-end4.nix;
resticRepository = "sftp:alice@backup.example.com:/backups/laptop";
extraMonitorSettings = "
monitor = eDP-1, 1920x1080@144, auto, 1
";
printEnable = true;
printDrivers = [ pkgs.hplip ];
add_rtl8852cu = false;
}After editing variables.nix, validate with:
nix flake checkBuild without switching:
sudo nixos-rebuild build --flake .#yourhostname- Customization Guide - How to use these variables
- Per Machine Config - Managing multiple machines
- Installation - Setting up variables during install