NI

Nix Defaults

Core Nix expression language conventions for readable, reproducible package and configuration definitions

Details

Language / Topic
nixNix
Category
Style Guide

Rules

balanced
- Use `let ... in` for local bindings — keep bindings at the narrowest scope needed and avoid shadowing outer names.
- Prefer attribute set argument destructuring (`{ pkgs, lib, ... }:`) over positional arguments for function parameters — always include `...` to allow future extension.
- Use `lib.mkOption` with `type`, `default`, and `description` for every NixOS module option — never expose bare attribute sets as public module API.
- Use `inherit` to lift names from enclosing scope into attribute sets: `{ inherit stdenv lib; }` instead of `{ stdenv = stdenv; lib = lib; }`.