Skip to content

flake-file

Nix flakes require flake.nix to be written in a restricted subset of Nix — no imports, no lib.mkDefault, no computed values. flake-file removes this limitation:

  • Define inputs anywhere — in any Nix module, using full Nix language features
  • Typed schemas — Input and Output definitions based on Nix types
  • One-command regenerationnix run .#write-flake produces a clean flake.nix
  • Consistency checksflake check ensures generated files stay in sync
  • Multiple backends — supports flake.nix, unflake.nix, and npins/
  • Automatic lock flattening — via allfollow or nix-auto-follow
# modules/inputs.nix — define inputs using real Nix
{ lib, ... }: {
flake.inputs.nixpkgs.url = lib.mkDefault "github:NixOS/nixpkgs/nixos-${channel}";
flake.inputs.home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
}

Then regenerate:

Terminal window
nix run .#write-flake

Used across the Dendritic ecosystem — den, checkmate, dendrix, and many flake-aspects users rely on flake-file for maintainable flake definitions.

Source Code Documentation Support this project
Hire Vic Consultancy Sponsor