···11<!-- Badges -->
2233<p align="right">
44- <a href="https://github.com/sponsors/vic"><img src="https://img.shields.io/badge/sponsor-vic-white?logo=githubsponsors&logoColor=white&labelColor=%23FF0000" alt="Sponsor Vic"/>
44+ <a href="https://dendritic.oeiuwq.com/sponsor"><img src="https://img.shields.io/badge/sponsor-vic-white?logo=githubsponsors&logoColor=white&labelColor=%23FF0000" alt="Sponsor Vic"/>
55 </a>
66- <a href="https://vic.github.io/dendrix/Dendritic-Ecosystem.html#vics-dendritic-libraries"> <img src="https://img.shields.io/badge/Dendritic-Nix-informational?logo=nixos&logoColor=white" alt="Dendritic Nix"/> </a>
66+ <a href="https://dendritic.oeiuwq.com"> <img src="https://img.shields.io/badge/Dendritic-Nix-informational?logo=nixos&logoColor=white" alt="Dendritic Nix"/> </a>
77 <a href="https://github.com/vic/flake-file/actions">
88 <img src="https://github.com/vic/flake-file/workflows/flake-check/badge.svg" alt="CI Status"/> </a>
99 <a href="LICENSE"> <img src="https://img.shields.io/github/license/vic/flake-file" alt="License"/> </a>
···11111212# Generate `flake.nix`/`unflake.nix`/`npins` from inputs defined as module options.
13131414-> `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)
1414+> `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)
15151616**flake-file** lets you generate a clean, maintainable `flake.nix` from Nix module options. Use the _real_ Nix language to define your inputs.
1717
···11---
22-title: Overview
22+title: Docs Overview
33description: Everything flake-file.
44---
55···2727 Bootstrap a new project with the `dendritic` template and generate your first `flake.nix` in minutes.
2828 <LinkButton href="/tutorials/quick-start" variant="minimal" icon="right-arrow">Learn More</LinkButton>
2929 </Card>
3030+ <Card title="Bootstrapping" icon="add-document">
3131+ Generate a first `flake.nix` without any existing flake using a one-shot bootstrap command.
3232+ <LinkButton href="/tutorials/bootstrap" variant="minimal" icon="right-arrow">Learn More</LinkButton>
3333+ </Card>
3034 <Card title="Migration Guide" icon="pencil">
3135 Step-by-step guide for adopting flake-file in an existing flake-parts project.
3236 <LinkButton href="/tutorials/migrate" variant="minimal" icon="right-arrow">Learn More</LinkButton>
3337 </Card>
3434- <Card title="Bootstrapping" icon="add-document">
3535- Generate a first `flake.nix` without any existing flake using a one-shot bootstrap command.
3636- <LinkButton href="/tutorials/bootstrap" variant="minimal" icon="right-arrow">Learn More</LinkButton>
3838+ <Card title="Migrate a flake-parts flake" icon="pencil">
3939+ Adopt flake-file in a project that already uses flake-parts.
4040+ <LinkButton href="/tutorials/migrate-flake-parts" variant="minimal" icon="right-arrow">Learn More</LinkButton>
4141+ </Card>
4242+ <Card title="Migrate a traditional flake" icon="pencil">
4343+ Adopt flake-file in a project with a traditional flake (no flake-parts).
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.
4848+ <LinkButton href="/tutorials/migrate-no-flakes" variant="minimal" icon="right-arrow">Learn More</LinkButton>
3749 </Card>
3850</CardGrid>
3951···7284 <Card title="All Options" icon="document">
7385 Complete reference for every `flake-file.*` module option.
7486 <LinkButton href="/reference/options" variant="minimal" icon="right-arrow">Learn More</LinkButton>
8787+ </Card>
8888+ <Card title="Bootstrap Command" icon="setting">
8989+ All arguments and apps for the one-shot bootstrap command.
9090+ <LinkButton href="/reference/bootstrap" variant="minimal" icon="right-arrow">Learn More</LinkButton>
7591 </Card>
7692</CardGrid>
+103
docs/src/content/docs/reference/bootstrap.mdx
···11+---
22+title: Bootstrap Command Reference
33+description: All options for the flake-file bootstrap command.
44+---
55+66+import { Aside } from '@astrojs/starlight/components';
77+88+The bootstrap command lets you generate `flake.nix`, `unflake.nix`, or `npins/` from scratch — without being inside an existing flake.
99+1010+```shell
1111+nix-shell https://github.com/vic/flake-file/archive/refs/heads/main.zip \
1212+ -A flake-file.sh --run <app> [--arg <name> <value>]...
1313+```
1414+1515+## Apps
1616+1717+The `flake-file.sh` shell provides these commands:
1818+1919+| App | Description |
2020+| --- | --- |
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-npins` | Generate/update `npins/` directory via [npins](https://github.com/andir/npins) |
2525+2626+## Arguments
2727+2828+All arguments are passed as `--arg <name> <value>` to `nix-shell`.
2929+3030+### `modules`
3131+3232+The Nix file or directory containing your flake-file module definitions. All `.nix` files in a directory are auto-imported via [import-tree](https://github.com/vic/import-tree).
3333+3434+- **Type:** path
3535+- **Default:** `[]` (empty)
3636+3737+```shell
3838+# Single file
3939+--arg modules ./flake-file.nix
4040+4141+# Directory (all .nix files imported)
4242+--arg modules ./modules
4343+```
4444+4545+### `bootstrap`
4646+4747+Include predefined inputs from the built-in `bootstrap.nix`. When set to `true`, all bootstrap inputs are included. When set to a list, only the named inputs are included.
4848+4949+- **Type:** `true` | list of input names
5050+- **Default:** `[]` (none)
5151+5252+Available bootstrap inputs:
5353+5454+| Name | Default URL |
5555+| --- | --- |
5656+| `import-tree` | `github:vic/import-tree` |
5757+| `flake-file` | `github:vic/flake-file` |
5858+| `flake-parts` | `github:hercules-ci/flake-parts` |
5959+| `nixpkgs` | `https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz` |
6060+6161+```shell
6262+# Include all bootstrap inputs
6363+--arg bootstrap true
6464+6565+# Include only specific ones
6666+--arg bootstrap '["flake-file" "nixpkgs"]'
6767+```
6868+6969+<Aside type="tip">
7070+Bootstrap inputs use `lib.mkDefault`, so your modules can override any of them.
7171+</Aside>
7272+7373+### `outdir`
7474+7575+The directory where generated files are written.
7676+7777+- **Type:** string
7878+- **Default:** `"."`
7979+8080+<Aside type="caution" title="Important!">
8181+Always use `--argstr` since this value is a string not a Nix Path.
8282+</Aside>
8383+8484+```shell
8585+--argstr outdir ./my-project
8686+```
8787+8888+### `outputs`
8989+9090+Override the `flake-file.outputs` expression. When not provided, the default from your modules is used.
9191+9292+- **Type:** null | string (Nix expression)
9393+- **Default:** `null`
9494+9595+```shell
9696+--argstr outputs 'inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules)'
9797+```
9898+9999+Instead of the above, some special values are recognized: see [outputs.nix](https://github.com/vic/flake-file/blob/main/modules/options/outputs.nix)
100100+101101+```shell
102102+--argstr outputs flake-parts
103103+```
+23-14
docs/src/content/docs/tutorials/bootstrap.mdx
···11---
22-title: Bootstrapping
22+title: Sandboxed Bootstrapping
33description: Generate a first flake.nix without any existing flake.
44---
5566## The Bootstrap Command
7788+You can try flake-file bootstrap command without having to
99+change anything in your flake.
1010+1111+Just create a temporary directory where to experiment safely.
1212+1313+```shell "bootstrap"
1414+mkdir bootstrap
1515+cd bootstrap
1616+```
1717+818You can create a `flake.nix` from scratch — without running inside an existing flake — using a one-shot bootstrap command:
9191010-```shell
1111-# Write a minimal bootstrap module
1212-echo '{ flake-file.inputs.flake-file.url = "github:vic/flake-file"; }' > bootstrap.nix
2020+```shell "write-flake" "./flake-file.nix"
2121+# Write a minimal flake-file.nix file (or copy a flake.nix of yours)
2222+echo '{ inputs.flake-file.url = "github:vic/flake-file"; }' > flake-file.nix
13231414-# Generate flake.nix
2424+# Generate flake.nix or unflake.nix or npins from flake-file.nix
1525nix-shell https://github.com/vic/flake-file/archive/refs/heads/main.zip \
1616- -A flake-file.sh \
1717- --run write-flake \
1818- --arg modules ./bootstrap.nix
2626+ -A flake-file.sh --run write-flake --arg modules ./flake-file.nix
1927```
20282929+> <small>See also: all [bootstrap command args](/reference/bootstrap)</small>
3030+2131Replace `write-flake` with `write-inputs`, `write-unflake`, or `write-npins` to target a different backend.
22323333+2334## Using a modules directory
24352525-`bootstrap.nix` can also be a directory. All `.nix` files in it will be auto-imported:
3636+`bootstrap.nix` can also be a directory. All `.nix` files in it will be auto-imported using [import-tree](https://github.com/vic/import-tree):
26372727-```shell
3838+```shell "./modules"
2839nix-shell https://github.com/vic/flake-file/archive/refs/heads/main.zip \
2929- -A flake-file.sh \
3030- --run write-flake \
3131- --arg modules ./modules
4040+ -A flake-file.sh --run write-flake --arg modules ./modules
3241```
33423443This is useful when you already have module files and just need the initial `flake.nix` to be generated before Nix can evaluate the flake itself.
35443645## Next Steps
37463838-After generating `flake.nix`, continue with the standard [Quick Start](/tutorials/quick-start) flow.
4747+See the [bootstrap command reference](/reference/bootstrap) for more options.
···11+---
22+title: With a flake-parts flake
33+description: Migrate a flake-parts flake to flake-file
44+---
55+66+import { Aside } from '@astrojs/starlight/components';
77+88+99+Suppose you have a flake-parts enabled flake that looks like:
1010+1111+```nix "(A)" "(B)"
1212+# flake.nix
1313+{
1414+ inputs = { # (A) So much inputs
1515+ nixpkgs.url = "github:nixos/nixpkgs/unstable";
1616+ flake-parts.url = "github:hercules-ci/flake-parts";
1717+ foo.url = "github:coolguy/foo";
1818+ bar.url = "github:coolguy/bar";
1919+ };
2020+ outputs = inputs:
2121+ inputs.flake-parts.lib.mkFlake { inherit inputs; }
2222+ # (B) flake-parts entry-point module.
2323+ { systems = [ "aarch64-darwin" ]; ... };
2424+}
2525+```
2626+2727+Your flake is already modular (in this case flake-parts modules),
2828+so your migration path is smoother here.
2929+3030+## Split `flake.nix` in two
3131+3232+First step is moving the <strong>`(B)`</strong> flake-parts entry-point module
3333+outside of the flake.nix file into `modules/default.nix`.
3434+3535+```nix "./inputs.nix"
3636+# modules/default.nix
3737+{
3838+ imports = [ ./inputs.nix ];
3939+ systems = [ "aarch64-darwin" ];
4040+4141+ ... # same code as before
4242+}
4343+```
4444+4545+Second is also moving the <strong>`(A)`</strong> inputs into `./modules`
4646+4747+```nix "flake-file.inputs"
4848+# modules/inputs.nix
4949+# This is now real Nix code, use let bindings, { lib, ... } etc.
5050+# best practice is to split this inputs.nix into other modules
5151+{
5252+ flake-file.inputs = {
5353+ nixpkgs.url = "github:nixos/nixpkgs/unstable";
5454+ flake-parts.url = "github:hercules-ci/flake-parts";
5555+ # all your other inputs
5656+ };
5757+}
5858+```
5959+6060+6161+6262+## Boostraping using `./modules`
6363+6464+And now, lets replace `flake.nix` using bootstrapping magic step:
6565+6666+```shell "./modules" "flake-parts"
6767+nix-shell https://github.com/vic/flake-file/archive/main.tar.gz \
6868+ -A flake-file.sh --run write-flake \
6969+ --arg modules ./modules --argstr outputs flake-parts
7070+```
7171+7272+> <small>See also: all [bootstrap command args](/reference/bootstrap)</small>
7373+7474+7575+Run the **same** command whenever your input changes and they
7676+will be reflected into the **static** `flake.nix`.
7777+7878+<Aside title="You are done!">
7979+You can stop here and enjoy your dynamic inputs at `./modules`.
8080+8181+Simply run the same bootstrap command whenever inputs change.
8282+</Aside>
8383+8484+## Enabling `.#write-flake` app.
8585+8686+Edit `./modules/inputs.nix` module to add in-flake flake-file.
8787+8888+```diff lang="nix" "resolved flake inputs" " inputs =" "flake-file.inputs option" "inputs," " outputs =" "type-checked schema" ins="flake-module" "flake-file.inputs"
8989+# modules/inputs.nix
9090++ { inputs, lib, ... }: # resolved flake inputs as specialArgs
9191+ {
9292+ # same inputs code as before
9393+ flake-file.inputs = {
9494+9595+ # make sure you add flake-file dependency.
9696++ flake-file.url = lib.mkDefault "github:vic/flake-file";
9797+ };
9898+9999+ imports = [
100100+ # enable inside-flake and say goodbye to bootstrap
101101++ inputs.flake-file.flakeModule
102102+103103+ # start splitting from inputs.nix into other files
104104+ ];
105105+106106+ # generate the same output function we used at bootstrap
107107++ flake-file.outputs = "flake-parts";
108108+ }
109109+```
110110+111111+112112+## Your flake is flake-file enabled
113113+114114+Commands for your daily life:
115115+116116+```shell
117117+nix run .#write-flake # whenever you need to regen flake.nix
118118+119119+nix flake check # will make sure your flake.nix is up-to-date
120120+```
···11+---
22+title: With No Flakes
33+description: Migrate a non-flake to flake-file
44+---
55+66+import { Aside } from '@astrojs/starlight/components';
77+88+99+<Aside title="Fetching and locking Nix dependencies">
1010+flake-file is not a locking/fetching tool, we have plenty
1111+of tools for that in the ecosystem.
1212+1313+flake-file has support
1414+for [`unflake`](https://codeberg.org/goldstein/unflake)
1515+and [`npins`](https://github.com/andir/npins)
1616+send PR for others.
1717+1818+This guide shows npins as it is the most popular one.
1919+</Aside>
2020+2121+2222+Suppose you have a `default.nix` that looks like:
2323+2424+```nix "(A)" "(B)"
2525+# default.nix
2626+let
2727+ sources = import ./npins;
2828+in
2929+{
3030+ nixosConfigurations.my-laptop = ...; # use sources
3131+}
3232+```
3333+3434+First step is adding flake-like input definitions on it,
3535+or in a separate `./flake-file.nix` file.
3636+3737+```nix
3838+# flake-file.nix
3939+{
4040+ flake-file.inputs = {
4141+ nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
4242+ };
4343+}
4444+```
4545+4646+## Boostraping using `./flake-file.nix`
4747+4848+<Aside type="caution" title="Backup your ./npins">
4949+The following bootstrap command will write `./npins` so make sure
5050+to rename your existing directory first.
5151+</Aside>
5252+5353+And now, lets generate `./npins` from `./flake-file.nix`.
5454+5555+```shell "./flake-file.nix" "write-npins"
5656+nix-shell https://github.com/vic/flake-file/archive/main.tar.gz \
5757+ -A flake-file.sh --run write-npins --arg modules ./flake-file.nix
5858+```
5959+6060+> <small>See also: all [bootstrap command args](/reference/bootstrap)</small>
6161+6262+6363+Run the **same** command whenever your input changes and they
6464+will be reflected into your pins.
6565+6666+<Aside title="You are done!">
6767+You can stop here and enjoy your dynamic inputs at `./flake-file.nix`.
6868+6969+Simply run the same bootstrap command whenever inputs change.
7070+</Aside>
7171+7272+## Enabling Modular non-flakes.
7373+7474+Lets make use of Nix Modules in our non-flake.
7575+7676+First, create a `./modules` directory and move
7777+our previous `default.nix` and `flake-file.nix` on it.
7878+7979+```shell
8080+mkdir modules
8181+mv flake-file.nix modules/inputs.nix
8282+mv default.nix modules/default.nix
8383+```
8484+8585+8686+```diff lang="nix" "inputs" "flake."
8787+# modules/default.nix
8888++ { inputs, lib, ... }:
8989+ let
9090+- sources = import ./npins;
9191+ in
9292+ {
9393++ imports = [ ./inputs.nix ];
9494+9595+- nixosConfigurations.my-laptop = ...; # use sources
9696++ nixosConfigurations.my-laptop = ...; # use inputs
9797+ }
9898+```
9999+100100+Now create a new `defualt.nix` as follows:
101101+102102+```nix
103103+# default.nix
104104+let
105105+ sources = import ./npins;
106106+ nixpkgs = import sources.nixpkgs { };
107107+ outputs = (nixpkgs.lib.evalModules {
108108+ modules = ./modules;
109109+ specialArgs = {
110110+ inputs = sources; # (A) NOTE: Not flake-like inputs.
111111+ };
112112+ }).config;
113113+in
114114+outputs
115115+```
116116+117117+To update npins from inputs at ./modules do:
118118+119119+```shell "./modules" "write-npins"
120120+nix-shell https://github.com/vic/flake-file/archive/main.tar.gz \
121121+ -A flake-file.sh --run write-npins --arg modules ./modules
122122+```
123123+124124+### `(A)` flake-like inputs
125125+126126+If you wish to have flake-like resolved inputs
127127+to use flakes from non-flake world, take a
128128+look at [with-inputs.nix](https://github.com/vic/flake-file/tree/main/templates/npins/with-inputs.nix) used by [templates/npins](https://github.com/vic/flake-file/tree/main/templates/npins/default.nix)
···11+---
22+title: With a traditional flake
33+description: Migrate a traditional flake to flake-file (no flake-parts)
44+---
55+66+import { Aside } from '@astrojs/starlight/components';
77+88+99+As always, start a new empty commit so you can always revert to safe state.
1010+1111+Suppose you have a flake that looks like:
1212+1313+```nix
1414+# flake.nix
1515+{
1616+ inputs = { # So much inputs
1717+ nixpkgs.url = "github:nixos/nixpkgs/unstable";
1818+ foo.url = "github:coolguy/foo";
1919+ bar.url = "github:coolguy/bar";
2020+ };
2121+ outputs = inputs: { ... }; # wow! very outputs
2222+}
2323+```
2424+2525+## Boostraping flake-file
2626+2727+First, move your `flake.nix` file as `flake-file.nix`.
2828+2929+And now, the bootstrapping magic step:
3030+3131+```shell
3232+nix-shell https://github.com/vic/flake-file/archive/main.tar.gz \
3333+ -A flake-file.sh --run write-flake \
3434+ --arg modules ./flake-file.nix --argstr outputs flake-file
3535+```
3636+3737+> <small>See also: all [bootstrap command args](/reference/bootstrap)</small>
3838+3939+4040+## The new `flake.nix` (static Nix)
4141+4242+You will notice your new `flake.nix` looks like this:
4343+4444+```diff lang="nix" "(A)" "(B)" "(C)" "(D)"
4545+ # flake.nix
4646+ # DO-NOT-EDIT. This file was auto-generated using github:vic/flake-file. (A)
4747+ # Use `nix run .#write-flake` to regenerate it. (D)
4848+ {
4949+ outputs = inputs: (import ./flake-file.nix).outputs inputs; # (B)
5050+ inputs = {
5151+ # (C) all your inputs (static version)
5252+ };
5353+ }
5454+```
5555+<strong>(A)</strong> The `--arg modules ./flake-file.nix` option indicates
5656+the module entry-point. Your old flake is **already** a module for flake-file.
5757+5858+<strong>(B)</strong> The `--argstr outputs flake-file` generated
5959+an `outputs` function that just **delegates** to the one in `flake-file.nix`.
6060+6161+<strong>(C)</strong> Your `inputs` are now the **static** version (Nix subset)
6262+of the **real Nix** inputs at your `flake-file.nix` file.
6363+6464+## Edit `flake-file.nix` (real Nix)
6565+6666+Now that `flake-file.nix` is real Nix code, you can refactor your inputs code
6767+to your heart's content.
6868+6969+```nix
7070+# flake-file.nix
7171+# Now with more and **real** Nix
7272+let
7373+ # for example purposes
7474+ gh = user: repo: branch: "github:${user}/${repo}/${branch}";
7575+7676+ coolguy = repo: gh "coolguy" repo "main";
7777+ channel = "unstable";
7878+in {
7979+ inputs = {
8080+ nixpkgs.url = gh "nixos" "nixpkgs" channel;
8181+ foo.url = coolguy "foo";
8282+ bar.url = coolguy "bar";
8383+ };
8484+8585+ outputs = inputs: { ... }; # keeps the same
8686+}
8787+```
8888+8989+## Update static from dynamic Nix.
9090+9191+Run the **same** command again, your input changes will be reflected into
9292+the **static** `flake.nix`.
9393+9494+```shell
9595+nix-shell https://github.com/vic/flake-file/archive/main.tar.gz \
9696+ -A flake-file.sh --run write-flake \
9797+ --arg modules ./flake-file.nix --argstr outputs flake-file
9898+```
9999+100100+<Aside title="You are done!">
101101+You can stop here and enjoy your dynamic inputs at `flake-file.nix`.
102102+103103+Simply run the same bootstrap command whenever inputs change.
104104+</Aside>
105105+106106+## Moving into a module-based flake.
107107+108108+<strong>(D)</strong> You might have noticed the comment about the `.#write-flake` app.
109109+To include this app as part of your flake and not having use the bootstrap command
110110+and specify all the same options each time, you need:
111111+112112+Use `flake-module` outputs instead of `flake-file` on the bootstrap command:
113113+114114+```shell ins="flake-module"
115115+nix-shell https://github.com/vic/flake-file/archive/main.tar.gz \
116116+ -A flake-file.sh --run write-flake \
117117+ --arg modules ./flake-file.nix --argstr outputs flake-module
118118+```
119119+120120+Add options to your `flake-file.nix` **module**. I told you it was a module already.
121121+122122+```diff lang="nix" "resolved flake inputs" " inputs =" "flake-file.inputs option" "inputs," " outputs =" "type-checked schema" ins="flake-module"
123123+ # flake-file.nix
124124++ { inputs, lib, ... }: # resolved flake inputs as specialArgs
125125+ let
126126+ # same helper code as before
127127+ in
128128+ {
129129+ # same inputs code as before
130130+ inputs = { # Alias option for flake-file.inputs type-checked schema!
131131+132132+ # make sure you add flake-file dependency.
133133++ flake-file.url = lib.mkDefault "github:vic/flake-file";
134134+ };
135135+136136+ # same outputs code as before
137137+ outputs = inputs: ...; # Now with **extensible** type-checked schema!
138138+139139+ # since this IS a module it can import other modules
140140+ imports = [
141141+ # enable inside-flake and say goodbye to bootstrap
142142++ inputs.flake-file.flakeModule
143143+144144+ # start splitting from huge monolithic code to modular nix.
145145+ # each input can be defined on their relevant module files.
146146+ # maybe move outputs function to ./outputs.nix
147147+ ];
148148+149149+ # generate the same output function we used at bootstrap
150150++ flake-file.outputs = "flake-module";
151151+ }
152152+```
153153+154154+155155+## Your flake is flake-file enabled
156156+157157+Commands for your daily life:
158158+159159+```shell
160160+nix run .#write-flake # whenever you need to regen flake.nix
161161+162162+nix flake check # will make sure your flake.nix is up-to-date
163163+```
+29-42
docs/src/content/docs/tutorials/quick-start.mdx
···33description: Bootstrap a new project with flake-file in minutes.
44---
5566-## Prerequisites
66+import { Card, LinkButton, Aside } from '@astrojs/starlight/components';
7788-- Nix with flakes enabled.
99-- An internet connection to fetch the template.
1081111-## Create a new project
99+This section will help you get started with `flake-file` in minutes.
12101313-Use the `dendritic` template — it sets up a full [flake-parts](https://flake.parts) + [import-tree](https://github.com/vic/import-tree) environment with flake-file already wired in.
1111+It pretty much depends on your current Nix choices -the library adapts to you-
1212+and what your destination is.
14131515-```shell
1616-nix flake init -t github:vic/flake-file#dendritic
1717-```
1414+## Choose your path
18151919-## Generate flake.nix
1616+<Card title="Sandboxed Bootstrap" icon="nix">
1717+ Try flake-file in a temporary directory using your flake inputs.
20182121-```shell
2222-nix run ".#write-flake"
2323-```
1919+ <LinkButton variant="secondary" icon="right-arrow" href="/tutorials/bootstrap">Try It Now!</LinkButton>
2020+</Card>
24212525-This evaluates your modules, merges all `flake-file.*` options, and writes `flake.nix`.
2222+<Card title="Brand new project (with or without flakes)" icon="rocket">
2323+ We provide many `templates` providing different features.
26242727-```shell
2828-cat flake.nix # inspect the generated file
2929-```
2525+ <LinkButton variant="secondary" href="/guides/templates" icon="right-arrow">Pick one</LinkButton> that suits you more, and run:
30263131-## Verify
2727+ ```shell
2828+ nix flake init -t github:vic/flake-file#default
2929+ ```
3030+</Card>
32313333-```shell
3434-nix flake check
3535-```
3232+<Card title="Use with a traditional flake (no flake-parts)" icon="nix">
3333+ You don't need to change your loved flake structure nor adopt a module system.
36343737-This confirms that `flake.nix` is up to date with the current module state. Run this in CI.
3535+ Even better, `flake-file` can use your **current** `flake.nix` as a module.
38363939-## Add your first input
3737+ <LinkButton variant="secondary" icon="right-arrow" href="/tutorials/migrate-traditional-flake">Lets Do It!</LinkButton>
3838+</Card>
40394141-Open (or create) a module under `./modules/`. Declare any dependency close to where it is used:
42404343-```nix
4444-# modules/my-tool.nix
4545-{ inputs, lib, ... }: {
4646- flake-file.inputs.my-tool.url = lib.mkDefault "github:owner/my-tool";
4141+<Card title="Use with a flake-parts flake" icon="nix">
4242+ Nice! You already use flake modules, just add some water and enjoy your cool-inputs.
47434848- # Use the input once it's in flake.nix
4949- imports = lib.optionals (inputs ? my-tool) [
5050- inputs.my-tool.flakeModule
5151- ];
5252-}
5353-```
4444+ <LinkButton variant="secondary" icon="right-arrow" href="/tutorials/migrate-flake-parts">Lets Do It!</LinkButton>
4545+</Card>
54465555-Then regenerate:
56475757-```shell
5858-nix run ".#write-flake"
5959-```
4848+<Card title="Use with no flakes" icon="nix">
4949+ Easy as pie.
60506161-## Next Steps
6262-6363-- [Migration Guide](/tutorials/migrate) — adopt flake-file in an existing project.
6464-- [flakeModules](/guides/flake-modules) — explore all built-in modules.
6565-- [Options Reference](/reference/options) — every `flake-file.*` option explained.
5151+ <LinkButton variant="secondary" icon="right-arrow" href="/tutorials/migrate-no-flakes">Lets Do It!</LinkButton>
5252+</Card>