Skip to content

Flakes Cheatsheet

Create a new directory, or cd into an existing project directory that you want to convert into a flake.

Initialize using a template:

Terminal window
nix flake init -t github:akirak/flake-templates#flake-utils

You can also initialize with the default template:

Terminal window
nix flake init

List templates from the built-in registry:

Terminal window
nix flake show templates

You can also inspect templates from any flake:

Terminal window
nix flake show github:akirak/flake-templates

To see what a flake provides (packages, devShells, apps, etc.):

Terminal window
nix flake show

To inspect a specific flake:

Terminal window
nix flake show github:NixOS/nixpkgs

Flake inputs support several URL-like syntaxes (GitHub, Git, local paths, tarballs, etc.).

Official reference:

https://nix.dev/manual/nix/2.18/command-ref/new-cli/nix3-flake#url-like-syntax