|
9 | 9 | <a href="LICENSE"> <img src="https://img.shields.io/github/license/vic/flake-file" alt="License"/> </a> |
10 | 10 | </p> |
11 | 11 |
|
12 | | -# flake-file — Generate flake.nix from flake-parts modules. |
| 12 | +# flake-file — Generate flake.nix or unflake.nix from inputs defined as module options. |
13 | 13 |
|
14 | 14 | > `flake-file` and [vic](https://bsky.app/profile/oeiuwq.bsky.social)'s [dendritic libs](https://vic.github.io/dendrix/Dendritic-Ecosystem.html#vics-dendritic-libraries) made for you with Love++ and AI--. If you like my work, consider [sponsoring](https://github.com/sponsors/vic) |
15 | 15 |
|
16 | | -**flake-file** lets you generate a clean, maintainable `flake.nix` from modular options, using [flake-parts](https://flake.parts/). |
| 16 | +**flake-file** lets you generate a clean, maintainable `flake.nix` from modular options. It works on both flakes and non-flakes environments. |
17 | 17 |
|
18 | 18 | It makes your flake configuration modular and based on the Nix module system. This means you can use |
19 | 19 | `lib.mkDefault` or anything you normally do with Nix modules, and have them reflected in flake schema values. |
20 | 20 |
|
| 21 | +> Despite the original flake-oriented name, it NOW also works on _stable Nix_, [_non flakes_](templates/unflake) environments. |
| 22 | +
|
21 | 23 | <table><tr><td> |
22 | 24 |
|
23 | 25 | ## Features |
24 | 26 |
|
25 | | -- Flake definition aggregated from all flake-parts modules. |
| 27 | +- Flake definition aggregated from Nix modules. |
26 | 28 | - Schema as [options](https://github.com/vic/flake-file/blob/main/modules/options/default.nix). |
27 | 29 | - Syntax for nixConfig and follows is the same as in flakes. |
28 | 30 | - `flake check` ensures files are up to date. |
29 | | -- App for generator: `nix run .#write-flake` |
| 31 | +- App for `flake.nix` generator: `nix run .#write-flake` |
30 | 32 | - Custom do-not-edit header. |
31 | 33 | - Automatic flake.lock [flattening](#automatic-flakelock-flattening). |
32 | 34 | - Incrementally add [flake-parts-builder](#parts_templates) templates. |
33 | 35 | - Pick flakeModules for different feature sets. |
34 | 36 | - [Dendritic](https://vic.github.io/dendrix/Dendritic.html) flake template. |
| 37 | +- Works on stable Nix, [unflake](templates/unflake) environments. |
35 | 38 |
|
36 | 39 | </td><td> |
37 | 40 |
|
@@ -60,7 +63,7 @@ It makes your flake configuration modular and based on the Nix module system. Th |
60 | 63 | ## Who is this for? |
61 | 64 |
|
62 | 65 | - Nix users who want to keep their `flake.nix` modular and maintainable |
63 | | -- Anyone using [flake-parts](https://flake.parts/) and looking to automate or simplify flake input management |
| 66 | +- Anyone using Nix modules and looking to automate or simplify flake input management |
64 | 67 | - Teams or individuals who want to share and reuse flake modules across projects |
65 | 68 |
|
66 | 69 | --- |
@@ -148,9 +151,14 @@ The following is a complete example from our [`templates/dendritic`](https://git |
148 | 151 |
|
149 | 152 | > Previously, this module included `flake-aspects` and `den` as dependencies. It now provides a pure flake-parts Dendritic setup. If you need the complete [den](https://github.com/vic/den) functionality, use den's `flakeModules.dendritic` instead. |
150 | 153 |
|
| 154 | +#### [`flakeModules.unflake`](https://github.com/vic/flake-file/tree/main/modules/unflake.nix) |
| 155 | + |
| 156 | +- Defines `flake-file` options. |
| 157 | +- Exposes `write-unflake` to generate `unflake.nix` or `npins`. See [templates/unflake](templates/unflake) for usage. |
| 158 | + |
151 | 159 | ### Flake Templates |
152 | 160 |
|
153 | | -#### `default` template |
| 161 | +#### [`default`](templates/default) template |
154 | 162 |
|
155 | 163 | A more basic, explicit setup. |
156 | 164 |
|
@@ -178,14 +186,18 @@ A more basic, explicit setup. |
178 | 186 | > [!TIP] |
179 | 187 | > You can use the `write-flake` app as part of a devshell or git hook. |
180 | 188 |
|
181 | | -#### `dendritic` template |
| 189 | +#### [`dendritic`](templates/dendritic) template |
182 | 190 |
|
183 | 191 | A template for dendritic setups; includes `flakeModules.dendritic`. |
184 | 192 |
|
185 | | -#### `parts` template |
| 193 | +#### [`parts`](templates/parts) template |
186 | 194 |
|
187 | 195 | A template that uses `lib.flakeModules.flake-parts-builder`. |
188 | 196 |
|
| 197 | +#### [`unflake`](templates/unflake) template |
| 198 | + |
| 199 | +Uses [goldstein/unflake](https://codeberg.org/goldstein/unflake) to pin and fetch inputs that were defined as options for non-flakes stable Nix environments. |
| 200 | + |
189 | 201 | --- |
190 | 202 |
|
191 | 203 | ## Available Options |
|
0 commit comments