Skip to content

Quick Start

  • Nix with flakes enabled.
  • An internet connection to fetch the template.

Use the dendritic template — it sets up a full flake-parts + import-tree environment with flake-file already wired in.

Terminal window
nix flake init -t github:vic/flake-file#dendritic
Terminal window
nix run ".#write-flake"

This evaluates your modules, merges all flake-file.* options, and writes flake.nix.

Terminal window
cat flake.nix # inspect the generated file
Terminal window
nix flake check

This confirms that flake.nix is up to date with the current module state. Run this in CI.

Open (or create) a module under ./modules/. Declare any dependency close to where it is used:

modules/my-tool.nix
{ inputs, lib, ... }: {
flake-file.inputs.my-tool.url = lib.mkDefault "github:owner/my-tool";
# Use the input once it's in flake.nix
imports = lib.optionals (inputs ? my-tool) [
inputs.my-tool.flakeModule
];
}

Then regenerate:

Terminal window
nix run ".#write-flake"
Contribute Community Sponsor