NixOS
NixOS is a Linux distribution based on the Nix package manager and build system. It supports reproducible and declarative system-wide configuration management as well as atomic upgrades and rollbacks, although it can additionally support imperative package and user management. In NixOS, all components of the distribution — including the kernel, installed packages and system configuration files — are built by Nix from pure functions called Nix expressions.
— NixOS Wiki
NixOS is my current favorite Linux distribution. I like their features and trying to use it everywhere where it’s possible. Arch Linux is also good (minimal), but I like the NixOS approach more.
Features
- Declarative configuration model (Nix language, global configuration file).
- Reliable and atomic upgrades (same result on different machines, atomic. upgrades which are resistant to power failures).
- Rollbacks (boot menu with previous configurations).
- Reproducible system configurations (easily clone system across many machines).
- Source-based model with binary cache (flexible build configuration, change package options)
- Consistency (rebuild all dependencies when core packages are updated).
- Multi-user package management (users can install packages without root).
-
80,000 official packages (Nixpkgs), special packages with easily configurable options (NixOS options, > 10000 options).
- Documentation and community (Guides and Tutorials, NixOS wiki, Discourse, Matrix, GitHub).
Cleanup old generations
Native nix commands:
TODO: own hey utility?
Get revision/hash for fetchFromGitHub/fetchit
For example this repo: https://github.com/cli/cli
LD_LIBRARY_PATH issues
This can happen when importing python libraries: Solution: add ${stdenv.cc.cc.lib}/lib/libstdc++.so.6 to the LD_LIBRARY_PATH.
A sample shell.nix:
{ pkgs ? (import <nixpkgs> {}).pkgs }:
with pkgs;
mkShell {
buildInputs = [
python3Packages.virtualenv # run virtualenv .
python3Packages.pyqt5 # avoid installing via pip
python3Packages.pyusb # fixes the pyusb 'No backend available' when installed directly via pip
];
shellHook = ''
# fixes libstdc++ issues and libgl.so issues
LD_LIBRARY_PATH=${stdenv.cc.cc.lib}/lib/:/run/opengl-driver/lib/
# fixes xcb issues :
QT_PLUGIN_PATH=${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}
'';
}
PCI passthrough
- Notes on PCI passthrough on NixOS using QEMU and VFIO
- Review and add notes Virtiofs: Shared file system
TODO:
- linux kernel flake + le9ec
- test Plasma/Wayland
- pipewire low-latency + rtkit