{ pkgs, ... }: { ... }
This is a function. It receives the package collection and returns your config.
An operating system is the layer that starts your computer, runs programs, talks to hardware, and keeps everything organized. Windows and macOS are operating systems. Linux systems are operating systems too, and NixOS is one of them.
The OS that never lies about its state.
Think of it this way: most operating systems are like a messy desk. You install things, delete things, update things — and over time the desk gets cluttered with stuff you don't remember putting there. NixOS is different. It's like having a desk that resets to exactly the state you described every single morning. You write down what you want — 'I want Firefox, git, and a running web server' — and NixOS makes exactly that happen. Nothing extra. Nothing hidden. And if you wrote it down wrong, you just go back to yesterday's note.
A GitHub repo with 80,000+ Nix expressions. Each expression says how software should be built.
The important part: nixpkgs is not a magic binary package server.
It is a git repo full of build recipes. Binary caches are an optimization layered on top.
It describes inputs and build steps. It is not the package itself.
{
name = "hello-2.12.1";
src = fetchurl {
url = "mirror://gnu/hello/hello-2.12.1.tar.gz";
sha256 = "sha256-...";
};
buildInputs = [ gcc glibc ];
buildPhase = "make";
}
A human-readable package identity. Still only part of the recipe.
Every package lands in a unique immutable path. Dependencies are not hidden.
You declare the system you want. NixOS builds that state instead of guessing what changed.
Every time you change your config and rebuild, NixOS saves the old version. You can jump back to any point like a save file in a game.
A flake adds locked inputs and predictable outputs. The lockfile pins the exact nixpkgs revision.
{
description = "demo system";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }: {
packages.x86_64-linux.default = ...;
devShells.x86_64-linux.default = ...;
};
}
Where nixpkgs comes from. No implicit channel.
A function from inputs to buildable results.
Named things other machines can build the same way.
nix develop drops you into a shell with every tool your project needs — exact versions, no conflicts, works on any machine.
click to run setup
click to enter shell
Nix code looks strange first, but most common snippets are small ideas repeated.
{ pkgs, ... }: { ... }
This is a function. It receives the package collection and returns your config.
with pkgs; [ git firefox ]
with is like saying 'look inside pkgs for these names'. The list is your packages.
mkDerivation { ... }
mkDerivation is the recipe builder. Give it a name, source, and build steps — it gives you a package.
NixOS turns machine state into data you can inspect, rebuild, and roll back.
The recipe lists exact inputs. If inputs match, the build path and result can match too.
A new system generation is built beside the old one. Switch succeeds as one step or the old system remains.
Old generations stay available. If an upgrade breaks, boot or switch back to known-good state.
Built as a school project by Made with vanilla HTML, CSS, and JS — no frameworks. Design inspired by Anthropic/Claude.ai. fan detected ✦