-
Notifications
You must be signed in to change notification settings - Fork 0
File Structure
Understanding the NullOS directory structure.
NullOS uses a well-organized structure separating system configuration, home manager settings, and documentation.
NullOS/
├── flake.nix # Main flake configuration
├── flake.lock # Locked dependencies
├── variables.nix # Per-machine variables (gitignored)
├── variables.nix.example # Variable template
├── README.md # Project documentation
├── WIKI.md # Wiki index
├── .gitignore # Git ignore rules
├── .gitattributes # Git attributes
├── .envrc # Direnv configuration
├── _screenshots/ # Screenshots
├── wallpapers/ # Wallpaper images
├── home/ # Home Manager configs
├── modules/ # NixOS system modules
└── wiki/ # Local wiki (optional)
Main flake configuration that:
- Defines inputs (nixpkgs, home-manager, etc.)
- Configures system outputs
- Sets up overlays
- Defines machine configurations
Key sections:
-
inputs- External dependencies -
outputs- System and home configurations -
nixosConfigurations- Per-machine system configs -
homeConfigurations- User configurations
Per-machine configuration variables:
- Username and hostname
- Git credentials
- Terminal and browser preferences
- Display configuration
- Hardware settings (NVIDIA, etc.)
- Theming options
Important: This file is gitignored for privacy.
Locked versions of all inputs. Ensures reproducibility.
Update with:
nix flake updateUser-level configurations managed by Home Manager.
home/
├── default.nix # Main entry point
├── bat.nix # Bat (cat alternative)
├── bottles.nix # Bottles (Wine)
├── bottom.nix # Bottom (btop)
├── eza.nix # Eza (ls alternative)
├── gh.nix # GitHub CLI
├── ghostty.nix # Ghostty terminal
├── git.nix # Git configuration
├── gtk.nix # GTK theming
├── httpie-desktop.nix # HTTPie GUI
├── kde.nix # KDE integration
├── nvf.nix # Neovim config
├── nwg-displays.nix # Display tool
├── office.nix # Office apps
├── qt.nix # Qt theming
├── starship.nix # Shell prompt
├── stylix.nix # Stylix theming
├── swappy.nix # Screenshot annotation
├── swaync.nix # Notifications
├── swayosd.nix # On-screen display
├── tealdeer.nix # tldr client
├── vscode.nix # VSCode config
├── xdg.nix # XDG directories
├── zoxide.nix # Directory jumper
├── fastfetch/ # System info
├── hyprland/ # Hyprland config
├── rofi/ # App launcher
├── scripts/ # Custom scripts
├── waybar/ # Status bar
├── wlogout/ # Logout menu
├── yazi/ # File manager
└── zsh/ # Shell config
Main home-manager configuration that:
- Imports all other home configs
- Defines user packages
- Sets up programs
- Configures services
Hyprland window manager configuration:
hyprland/
├── default.nix # Entry point
├── animations-end4.nix # Animations
├── binds.nix # Keybindings
├── env.nix # Environment vars
├── hypridle.nix # Idle management
├── hyprland.nix # Core settings
├── hyprlock.nix # Screen lock
├── pyprland.nix # Scratchpads
└── windowrules.nix # Window rules
Custom shell scripts:
scripts/
├── keybinds.nix # Keybind lister
├── rofi-launcher.nix # Rofi launcher
├── screenshotin.nix # Screenshot tool
└── wallsetter.nix # Wallpaper setter
System-level NixOS modules organized by category.
modules/
├── default.nix # Imports all modules
├── misc/ # Miscellaneous configs
├── services/ # System services
├── software/ # Applications
└── system/ # System settings
misc/
├── default.nix # Entry point
├── fonts.nix # Font configuration
└── user.nix # User account setup
Purpose: User management, fonts, locale settings.
services/
├── default.nix # Entry point
├── backup.nix # Restic backups
├── ollama.nix # Ollama AI server
├── services.nix # Core services
├── sunshine.nix # Game streaming
├── virtualisation.nix # Docker/VMs
├── vpn.nix # VPN configs
└── xserver.nix # X11 settings
Purpose: System services configuration.
software/
├── default.nix # Entry point
├── android-studio.nix # Android dev
├── dolphin.nix # File manager
├── flatpak.nix # Flatpak support
├── nh.nix # Nix helper
├── packages.nix # System packages
├── sddm.nix # Display manager
├── starship.nix # Shell prompt
└── steam.nix # Gaming
Purpose: Application installation and configuration.
system/
├── default.nix # Entry point
├── audio.nix # PipeWire audio
├── boot.nix # Boot config
├── hardware_add.nix # Additional hardware
├── hardware_nslapt.nix # Laptop config
├── hardware_nspc.nix # Desktop config
├── network.nix # Networking
├── nvidia.nix # NVIDIA drivers
├── power.nix # Power management
├── printing.nix # Printer support
├── rtl8852cu.nix # WiFi driver
├── security.nix # Security settings
└── system.nix # Core system
Purpose: Low-level system configuration, hardware support.
-
flake.nixloadsvariables.nix - Variables are passed to system and home configs
-
modules/default.niximports all system modules -
home/default.niximports all home configs - Build process generates system configuration
- Activation applies configuration to system
variables.nix
↓
flake.nix (vars)
↓
├─→ nixosConfigurations (system)
│ ↓
│ modules/ (receives vars)
│
└─→ homeConfigurations (user)
↓
home/ (receives vars)
- Create file in
home/:
# home/my-app.nix
{ config, pkgs, ... }:
{
programs.myapp = {
enable = true;
settings = { };
};
}- Import in
home/default.nix:
imports = [
./my-app.nix
];- Create in appropriate
modules/subdirectory:
# modules/software/my-software.nix
{ config, pkgs, ... }:
{
environment.systemPackages = [ pkgs.my-package ];
}- Import in
modules/software/default.nix:
imports = [
./my-software.nix
];-
Separation of Concerns
- System configs in
modules/ - User configs in
home/ - Variables in root
- System configs in
-
Categorization
- Group related configs together
- Use subdirectories for complex configs
-
Naming Conventions
- Descriptive filenames
- Use
.nixextension - Match program name when possible
-
Modularity
- One program per file
- Import from central
default.nix - Reusable components
✅ Do commit:
- All
.nixfiles (exceptvariables.nix) - Documentation
- Scripts
- Wallpapers (if not too large)
- Example files
❌ Don't commit:
-
variables.nix(personal data) -
resultsymlinks - Build outputs
- Secrets/passwords
- Cache files
# Personal configuration
variables.nix
# Nix build outputs
result
result-*
# Direnv
.direnv/
# Editor files
.vscode/
.idea/Application X:
- Check
home/default.nixpackages - Look for
home/X.nix - Check
modules/software/packages.nix
Service Y:
- Check
modules/services/Y.nix - Look in
modules/services/services.nix
System Setting Z:
- Check
modules/system/Z.nix - Look in
modules/system/system.nix
Keybinding:
home/hyprland/binds.nix
Theme/Colors:
home/stylix.nix-
variables.nix(stylixImage)
- Installation - Setting up NullOS
- Customization Guide - Modifying configs
- Variables Reference - All variables explained