/nixos

My NixOS configuration.

Primary LanguageNix

⚠️ This configuration is currently not maintained, as I switched to MacOS -> See my nix-darwin configuration.

Introduction

Welcome to my modular NixOS system configuration.

There are four essential building blocks: hosts, users, modules and profiles.

A host expression represents a physical or virtual machine. A host has one or more users and imports their configuration.

User configurations are handled by Home Manager.

Modules are regular NixOS/Home Manager modules used by host and user expressions.

Profiles are reusable snippets used by host and user expressions or modules.

Additions to /nix

Additions to /etc/nixos

  • /etc/nixos/compat - Compatibility layer for non-flake utils
  • /etc/nixos/current - The active configuration
  • /etc/nixos/nixpkgs - Link to current NixOS nixpkgs
  • /etc/nixos/options.json - JSON file of all available NixOS options
  • /etc/nixos/system-packages - List of installed packages

Files & directories

scripts/

  • rebuild.sh - Wrapper for nixos-rebuild switch

    Example

    ./scripts/rebuild.sh xps15@home
  • update.sh - Updates flake inputs, /nix/nixpkgs and packages managed by niv

  • update-all.sh - Runs all other update scripts

  • clean-up.sh - Removes old generations and collects garbage

VSCode

Scripts to simplify the work with VSCode extensions.

  • add-vscode-extension.sh - Add VSCode extension to nix/sources.json

    Example

    ./scripts/add-vscode-extension.sh formulahendry.auto-rename-tag
  • update-vscode-extensions.sh - Updates all extensions to the latest version

IntelliJ IDEA

Scripts to simplify the work with IntelliJ IDEA plugins.

  • add-idea-plugin.sh - Add IDEA plugin to nix/sources.json
  • update-idea-plugins.sh - Updates all plugins to the latest version

profiles/

hosts/

  • default - Base configuration for a default host
  • minimal - Minimal configuration

users/

  • markus - Base configuration for my user
  • nixos - Configuration for NixOS users
  • non-nixos - Configuration for non-NixOS users

hosts/

  • deskop@home - Configuration for my workstation
  • xps15@home - Configuration for my laptop
  • demo - Example host configuration (installation guide)
  • demo-dual - Example dual-boot configuration (installation guide)

users/

  • user - Example user configuraton
  • user@ubuntu - Example user configuraton for Ubuntu (installation guide)
  • markus@home - User for my workstation at home
  • markus@chromeos - User for my Chromebook
  • ...

modules/

nixos/

  • amd-gpu - Support for AMD GPUs
  • android - Support for Android devices
  • apx - Adds the APX package manager
  • avahi - Configures avahi
  • base-packages - Collection of essential CLI tools
  • btrfs - Configures btrfs
  • command-not-found - Adds simple command-not-found script
  • compatibility - Adds some tools for better compatibility with other Linux distributions
  • desktop - Essential packages for desktop environments
  • docker - Adds Docker and utilities
  • ecryptfs - Support for eCryptfs
  • fonts - Adds some fonts
  • gnome - Configures Gnome desktop environment
  • grub-efi - Configures GRUB for UEFI systems
  • kodi - Adds Kodi
  • home-overlay - Creates an overlay for /home
  • libreoffice - Adds LibreOffice
  • libvirtd - Support for libvirtd
  • lxd - Support for LXD
  • lutris - Adds Lutris
  • nvidia - Configures proprietary NVIDIA drivers
  • nix - Nix configuration and additions
  • opengl - Configures OpenGL
  • pipewire - Configures PipeWire
  • podman - Adds Podman
  • resolved - Configures systemd-resolved
  • snapd - Adds snapd
  • snapper - Configures Snapper to create snapshots of /home on boot
  • sshd - Configures OpenSSH server
  • steam - Configures Steam
  • sway - Configures sway window manager
  • systemd-boot - Configures systemd-boot
  • tap - Configures TAP network device
  • toolbox - Adds toolbox
  • virtualbox - Adds VirutalBox and utilities
  • waydroid - Adds Waydroid
  • wayland - Adds Wayland utilities
  • x11 - Configures X11

nixos/virtualization

  • crosvm-guest - Prepares host to run crosvm guest
  • docker-container - Prepares host to run as Docker container
  • lxd-container - Prepares host to run as LXD container
  • lxd-vm - Prepares host to run as LXD VM
  • qemu-quest - Prepares host to run QEMU guest

home-manager/

  • bash - Configures Bash shell
  • borg-backup - Adds job which runs BorgBackup/borgmatic
  • chromeos - Use if ChromeOS
  • conky - Configures conky
  • dconf - Loads dconf configuration from file
  • devShells - Adds custom development shells
  • disable-bluetooth - Disables Bluetooth on start
  • emacs - Configures Emacs
  • fish - Configures Fish shell
  • hide-applications - Hides applications from launcher
  • idea - Adds IntelliJ IDEA with plugins
  • non-nixos - Use if other Linux OS than NixOS
  • nixos - NixOS configuration and additions
  • vscode-profiles - Adds VSCode with multiple profiles
  • waypipe - Connects host wayland to VM via waypipe, socat and vsocks

overlays/

Contains some custom overlays.

  • application/networking/browsers/chromium - Chromium with Wayland support
  • desktops/gnome/core/gnome-terminal - Gnome Terminal with transparency patch
  • desktops/gnome/core/nautilus - Change grid icon sizes
  • tools/package-management/nix - Patched to allow downloads from VSCode Marketplace
  • tools/admin/lxd - LXD with VM support
  • tools/nix/nixos-option - nixos-option using compatibility layer

pkgs/

Contains a bunch of extra packages.

repos/

These repositories are added as Git submodules.

examples/

Collection of examples, each with it's own README.

docs/

Documentation and guides.

misc/

Stuff that doesn't fit anywhere else.

Appendix A: Naming conventions

  • File names: kebab-case
  • Package names: kebab-case
  • Module names: camel-case
  • Module options: camel-case
  • Functions: kebab-case

Appendix B: File structures

Hosts

  1. Imports
  2. Modules
  3. Boot
  4. Filesystems
  5. Networking
  6. Hardware
  7. systemd
  8. Services
  9. Security
  10. Virtualization
  11. Environment
  12. Activation
  13. Programs
  14. Packages
  15. Fonts
  16. Users

NixOS modules

Same as hosts

Home Manager modules

  1. Packages
  2. Services
  3. Activation
  4. Programs

Users

  1. Imports
  2. Modules
  3. Files
  4. Services
  5. Activation
  6. Programs
  7. Packages