···99 <a href="LICENSE"> <img src="https://img.shields.io/github/license/vic/flake-file" alt="License"/> </a>
1010</p>
11111212-# Generate `flake.nix`/`unflake.nix`/`npins` from inputs defined as module options.
1212+### Generate `flake.nix`/`unflake.nix`/`npins`/`nixlock` from inputs defined as module options.
13131414> `flake-file` and [vic](https://bsky.app/profile/oeiuwq.bsky.social)'s [dendritic libs](https://dendritic.oeiuwq.com) made for you with Love++ and AI--. If you like my work, consider [sponsoring](https://dendritic.oeiuwq.com/sponsor)
1515···2323- Your inputs follow a **typed Input Schema**.
2424- Your outputs can be defined on a **typed Output Schema**.
25252626-> Despite the original flake-oriented name, it NOW also works on _stable Nix_, non-flakes environments via [npins](templates/npins) or [unflake](templates/unflake).
2626+> Despite the original flake-oriented name, it NOW also works on _stable Nix_, non-flakes environments via [npins](templates/npins), [unflake](templates/unflake), [nixlock](https://codeberg.org/FrdrCkII/nixlock)
27272828<table><tr><td>
29293030-## Features
3030+### Features
31313232- Flake definition aggregated from Nix modules.
3333- [Input](https://github.com/vic/flake-file/blob/main/modules/options/default.nix) and Output schemas based on Nix types.
···3939- Incrementally add [flake-parts-builder](#parts_templates) templates.
4040- Pick flakeModules for different feature sets.
4141- [Dendritic](https://vic.github.io/dendrix/Dendritic.html) flake template.
4242-- Works on stable Nix, [npins](templates/npins) and [unflake](templates/unflake) environments.
4242+- Works on stable Nix, [npins](templates/npins), [unflake](templates/unflake), [nixlock](templates/nixlock) environments.
43434444</td><td>
4545
···3636Even if some people use unstable flakes, others should not be forced out of stable Nix.
37373838Each module defines inputs and flake-file can extract to whatever input-locking backend you need.
3939-Be it `flake.nix`, `unflake.nix`, `npins`.
3939+Be it `flake.nix`, `unflake.nix`, `nixlock`, `npins`.
40404141## Everybody `.follows`
4242···66666767- **Modular:** Each module declares only its own dependencies.
6868- **Composable:** Modules can be shared across projects — including their input declarations.
6969-- **Backend-agnostic:** The same module options generate `flake.nix`, `unflake.nix`, or `npins/` depending on the chosen backend.
6969+- **Backend-agnostic:** The same module options generate `flake.nix`, `unflake.nix`, `nixlock` or `npins/` depending on the chosen backend.
7070- **Standard Nix:** Uses the Nix module system — `lib.mkDefault`, priority overrides, conditional inputs — all work as expected.
71717272## Real-world Usage
+8-2
docs/src/content/docs/guides/flake-modules.mdx
···78787979Defines `flake-file` options for [npins](https://github.com/andir/npins)-based environments. Exposes `write-npins`. Supports `github`, `gitlab`, `channel`, `tarball`, and `git` schemes. Respects `follows` for deduplication. Prunes stale pins automatically.
80808181-Source: [`modules/npins.nix`](https://github.com/vic/flake-file/tree/main/modules/npins.nix)
8181+Source: [`modules/npins`](https://github.com/vic/flake-file/tree/main/modules/npins)
82828383## `flakeModules.unflake`
84848585Defines `flake-file` options for [unflake](https://codeberg.org/goldstein/unflake)-based environments. Exposes `write-unflake`.
86868787-Source: [`modules/unflake.nix`](https://github.com/vic/flake-file/tree/main/modules/unflake.nix)
8787+Source: [`modules/unflake`](https://github.com/vic/flake-file/tree/main/modules/unflake)
8888+8989+## `flakeModules.nixlock`
9090+9191+Defines `flake-file` options for [nixlock](https://codeberg.org/FrdrCkII/nixlock)-based environments. Exposes `write-nixlock`.
9292+9393+Source: [`modules/nixlock`](https://github.com/vic/flake-file/tree/main/modules/nixlock)
+8
docs/src/content/docs/guides/templates.mdx
···6060nix flake init -t github:vic/flake-file#unflake
6161```
62626363+## `nixlock`
6464+6565+For **non-flake** (stable Nix) environments. Uses [FrdrCkII/nixlock](https://codeberg.org/FrdrCkII/nixlock) to pin inputs.
6666+6767+```shell
6868+nix flake init -t github:vic/flake-file#unflake
6969+```
7070+6371## Tips
64726573> **Tip:** You can use the `write-flake` app as part of a devshell command or a git pre-commit hook to keep `flake.nix` always up to date.
+1-1
docs/src/content/docs/index.mdx
···5555 Built-in support for automatic `flake.lock` flattening via `allfollow` or `nix-auto-follow`.
5656 </Card>
5757 <Card title="Multiple Backends" icon="setting">
5858- Generate `flake.nix`, `unflake.nix`, or `npins/` from the same module options. Switch backends without rewriting your modules.
5858+ Generate `flake.nix`, `unflake.nix`, `nixlock`, or `npins/` from the same module options. Switch backends without rewriting your modules.
5959 </Card>
6060</CardGrid>
+1-1
docs/src/content/docs/overview.mdx
···4444 <LinkButton href="/tutorials/migrate-traditional-flake" variant="minimal" icon="right-arrow">Learn More</LinkButton>
4545 </Card>
4646 <Card title="Migrate without flakes" icon="pencil">
4747- Adopt flake-file in a non-flake project using npins or unflake.
4747+ Adopt flake-file in a non-flake project using npins, nixlock or unflake.
4848 <LinkButton href="/tutorials/migrate-no-flakes" variant="minimal" icon="right-arrow">Learn More</LinkButton>
4949 </Card>
5050</CardGrid>
+2-1
docs/src/content/docs/reference/bootstrap.mdx
···5566import { Aside } from '@astrojs/starlight/components';
7788-The bootstrap command lets you generate `flake.nix`, `unflake.nix`, or `npins/` from scratch — without being inside an existing flake.
88+The bootstrap command lets you generate `flake.nix`, `unflake.nix`, `nixlock.lock.nix`, or `npins/` from scratch — without being inside an existing flake.
991010```shell
1111nix-shell https://github.com/vic/flake-file/archive/refs/heads/main.zip \
···2121| `write-flake` | Generate a `flake.nix` file |
2222| `write-inputs` | Generate an `inputs.nix` expression (for debugging) |
2323| `write-unflake` | Generate `unflake.nix` via [unflake](https://codeberg.org/goldstein/unflake) |
2424+| `write-nixlock` | Generate `nixlock.lock.nix` via [nixlock](https://codeberg.org/FrdrCkII/nixlock) |
2425| `write-npins` | Generate/update `npins/` directory via [npins](https://github.com/andir/npins) |
25262627## Arguments
+2-2
docs/src/content/docs/tutorials/bootstrap.mdx
···2121# Write a minimal flake-file.nix file (or copy a flake.nix of yours)
2222echo '{ inputs.flake-file.url = "github:vic/flake-file"; }' > flake-file.nix
23232424-# Generate flake.nix or unflake.nix or npins from flake-file.nix
2424+# Generate flake.nix or unflake.nix or npins or nixlock from flake-file.nix
2525nix-shell https://github.com/vic/flake-file/archive/refs/heads/main.zip \
2626 -A flake-file.sh --run write-flake --arg modules ./flake-file.nix
2727```
28282929> <small>See also: all [bootstrap command args](/reference/bootstrap)</small>
30303131-Replace `write-flake` with `write-inputs`, `write-unflake`, or `write-npins` to target a different backend.
3131+Replace `write-flake` with `write-inputs`, `write-unflake`, `write-nixlock`, or `write-npins` to target a different backend.
323233333434## Using a modules directory
···12121313flake-file has support
1414for [`unflake`](https://codeberg.org/goldstein/unflake)
1515+and [`nixlock`](https://codeberg.org/FrdrCkII/nixlock)
1516and [`npins`](https://github.com/andir/npins)
1617send PR for others.
1718
···11+# Nixlock
22+33+This template is an example of using `flake-file.inputs` in a non-flakes project.
44+55+It uses [nixlock](https://codeberg.org/FrdrCkII/nixlock) to pin and fetch inputs defined as options inside `./modules`.
66+77+## Generate nixlock
88+99+The following command is a convenience for generating `nixlock.lock.nix`:
1010+1111+```shell
1212+nix-shell . -A flake-file.sh --run write-nixlock
1313+```
1414+1515+You can also the `update` command.
1616+1717+```shell
1818+nix-shell . -A flake-file.sh --run 'write-nixlock update'
1919+```