To initialize (where ${ENV}
is listed in the table below):
nix flake init --template github:the-nix-way/dev-templates#${ENV}
Here's an example (for the rust
template):
# Initialize in the current project
nix flake init --template github:the-nix-way/dev-templates#rust
# Create a new project
nix flake new --template github:the-nix-way/dev-templates#rust ${NEW_PROJECT_DIRECTORY}
Note: All templates are pinned to the [22.11 release][release] of Nixpkgs.
Once your preferred template has been initialized, you can use the provided shell in two ways:
- If you have [
nix-direnv
][nix-direnv] installed, you can initialize the environment by runningdirenv allow
. - If you don't have
nix-direnv
installed, you can runnix develop
to open up the Nix-defined shell.
All of the templates have only the root flake as a flake input. That root flake provides a common revision of [Nixpkgs] and [flake-utils
][flake-utils] to all the templates.