Example corpus¶
Tiny illustrative Nix snippets other wiki pages can cite. Not a second tutorial track or full project templates. For multi-file “how it all fits” walkthroughs, see 16-configuration-examples.
Snippets are invented minimal fixtures—not copied host configs. They are not evaluated in this vault by default. Pins such as nixos-26.05 and system = "x86_64-linux" are illustrative; adjust for your machine. Flake examples need experimental nix-command and flakes (e.g. experimental-features = nix-command flakes in nix.conf).
Validate locally (when Nix is installed): node meta/examples/validate.mjs from the repo root — runs nix-instantiate --parse on standalone .nix files and nix flake check --no-build on flake directories. Skips with exit 0 if nix is not in PATH.
Contents¶
- hello-flake/flake.nix — minimal
packages.default+devShells.default - flake-with-checks/flake.nix — hello-flake plus
checks.${system}.smokeand a tinyhydraJobsleaf - overlay-snippet.nix —
final: prev:overlay shape - shell.nix — classic
mkShellfornix-shell/ direnvuse nix - minimal-module.nix — tiny NixOS module with
mkEnableOption+lib.mkIf - minimal-configuration.nix — tiny NixOS module entry shape (
imports, boot, user,stateVersion) - simple-package.nix —
callPackage-shaped recipe wrappinghello(no fake fetch hash) - fod-fetchurl.nix —
fetchurlFOD with obviously placeholderhash - networking-nftables-minimal.nix — nftables backend + firewall holes +
extraInputRules - impure-vs-pure-flake/broken-flake.nix / fixed-flake.nix —
<nixpkgs>anti-pattern vs locked input - systemd-oneshot-service.nix — declarative
systemd.servicesoneshot unit