Bootstrap Command Reference
The bootstrap command lets you generate flake.nix, unflake.nix, nixlock.lock.nix, or npins/ from scratch — without being inside an existing flake.
nix-shell https://github.com/vic/flake-file/archive/refs/heads/main.zip \ -A flake-file.sh --run <app> [--arg <name> <value>]...The flake-file.sh shell provides these commands:
| App | Description |
|---|---|
write-lock | Detect existing lock file and delegate to one of the following as appropriate; requires a lock file already present |
write-flake | Generate a flake.nix file |
write-inputs | Generate an inputs.nix expression (for debugging) |
write-unflake | Generate unflake.nix via unflake |
write-nixlock | Generate nixlock.lock.nix via nixlock |
write-npins | Generate/update npins/ directory via npins |
Arguments
Section titled “Arguments”All arguments are passed as --arg <name> <value> to nix-shell.
modules
Section titled “modules”The Nix file or directory containing your flake-file module definitions. All .nix files in a directory are auto-imported via import-tree.
- Type: path
- Default:
[](empty)
# Single file--arg modules ./flake-file.nix
# Directory (all .nix files imported)--arg modules ./modulesbootstrap
Section titled “bootstrap”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.
- Type:
true| list of input names - Default:
[](none)
Available bootstrap inputs:
| Name | Default URL |
|---|---|
import-tree | github:vic/import-tree |
flake-file | github:vic/flake-file |
flake-parts | github:hercules-ci/flake-parts |
nixpkgs | https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz |
# Include all bootstrap inputs--arg bootstrap true
# Include only specific ones--arg bootstrap '["flake-file" "nixpkgs"]'outdir
Section titled “outdir”The directory where generated files are written.
- Type: string
- Default:
"."
--argstr outdir ./my-projectoutputs
Section titled “outputs”Override the flake-file.outputs expression. When not provided, the default from your modules is used.
- Type: null | string (Nix expression)
- Default:
null
--argstr outputs 'inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules)'Instead of the above, some special values are recognized: see outputs.nix
--argstr outputs flake-parts