Files
org-roam/20251104101248-nixos.org
2025-11-05 09:18:11 +01:00

1.8 KiB

nixos

NixOS is a Linux distribution built around the nix package manager. Unlike traditional Linux distributions, NixOS uses a functional language to describe the system configuration. This enables complete system profiles to be generated, allowing for reproducible deployments, atomic upgrades, and system rollbacks.

All installations and configurations are done mainly in one file: configuration.nix. Every component, from packages to port openings and the window-manager, is declared and configured here. This file can be split up using flakes and home-manager. The home folder for the configurations is ~/nixhome. The main flake, which defines the configuration layout, is located there. Inside the main folder are other subfolders containing more configuration files. The main configuration file configuration.nix is located in ~/nixhome/hosts/server or ~/nixhome/hosts/worker, depending on the desired structure.

The hardware-configuration.nix file, which defines the hardware layout of your system, is in the same folder. This file is autogenerated and can be obtained using the sudo nixos-generate-config command in the /etc/nixos folder. The configuration.nix file should be the same for every server in use. If a server requires special programs or configurations, these changes are made in the Nix modules. These modules are loaded into configuration.nix depending on the VM. These modules are located in ~/nixhome/modules/nixos and are named after the structure using them. For example: A VM needs Emacs to be installed. The VM is called VM1, so the module file is called VM1.nix.