Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jorsn/flakegen
Flake inputs with the full power of Nixlang
https://github.com/jorsn/flakegen
Last synced: 1 day ago
JSON representation
Flake inputs with the full power of Nixlang
- Host: GitHub
- URL: https://github.com/jorsn/flakegen
- Owner: jorsn
- License: mit
- Created: 2024-01-12T16:55:25.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-02-05T08:09:04.000Z (9 months ago)
- Last Synced: 2024-02-05T09:27:40.423Z (9 months ago)
- Language: Nix
- Size: 7.81 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flakegen
In Nix flakes, inputs must be written as pure data, without functions or thunks
(see issues [NixOS/nix#3966](https://github.com/NixOS/nix/issues/3966)
and [NixOS/nix#4945](https://github.com/NixOS/nix/issues/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.