Skip to content

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.

Terminal window
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:

AppDescription
write-lockDetect existing lock file and delegate to one of the following as appropriate; requires a lock file already present
write-flakeGenerate a flake.nix file
write-inputsGenerate an inputs.nix expression (for debugging)
write-unflakeGenerate unflake.nix via unflake
write-nixlockGenerate nixlock.lock.nix via nixlock
write-npinsGenerate/update npins/ directory via npins

All arguments are passed as --arg <name> <value> to nix-shell.

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)
Terminal window
# Single file
--arg modules ./flake-file.nix
# Directory (all .nix files imported)
--arg modules ./modules

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:

NameDefault URL
import-treegithub:vic/import-tree
flake-filegithub:vic/flake-file
flake-partsgithub:hercules-ci/flake-parts
nixpkgshttps://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz
Terminal window
# Include all bootstrap inputs
--arg bootstrap true
# Include only specific ones
--arg bootstrap '["flake-file" "nixpkgs"]'

The directory where generated files are written.

  • Type: string
  • Default: "."
Terminal window
--argstr outdir ./my-project

Override the flake-file.outputs expression. When not provided, the default from your modules is used.

  • Type: null | string (Nix expression)
  • Default: null
Terminal window
--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

Terminal window
--argstr outputs flake-parts
Contribute Community Sponsor