Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 1.06 KB

README.md

File metadata and controls

41 lines (32 loc) · 1.06 KB

flakegen

In Nix flakes, inputs must be written as pure data, without functions or thunks (see issues NixOS/nix#3966 and NixOS/nix#4945). To generate inputs with the full power of the Nix language, one can create a template file, e.g. flake.in.nix and generate the flake.nix by evaluating and pretty-printing the inputs attribute.

This flake is a convenience wrapper around that.

Usage

To start using this, run

nix flake init -t github:jorsn/flakegen

This will create the files flake.nix and flake.in.nix. It will not overwrite existing files. After editing flake.in.nix as you like, run

nix run .#genflake flake.nix

to update the flake.nix. To preview the new flake.nix without replacing it, run the following:

nix run .#genflake

Repair broken flake.nix

You can repair a broken flake.nix by deleting flake.nix and running

nix flake init -t github:jorsn/flakegen
nix run .#genflake flake.nix

as long as flake.in.nix works.