https://github.com/sagikazarmark/nix-templates
My Nix flake templates
https://github.com/sagikazarmark/nix-templates
Last synced: 6 months ago
JSON representation
My Nix flake templates
- Host: GitHub
- URL: https://github.com/sagikazarmark/nix-templates
- Owner: sagikazarmark
- License: mit
- Created: 2022-10-30T13:55:17.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-06T18:29:58.000Z (10 months ago)
- Last Synced: 2025-04-02T13:50:09.455Z (6 months ago)
- Language: Nix
- Size: 229 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# My Nix flake templates
[](https://builtwithnix.org)
This repository contains a list of project templates to be used with the `nix flake init` command.
## Usage
If you like any of the templates in this repository,
you can easily start a new project from them with the one of the following commands:```shell
# Initialize in the current directory
nix flake init --template github:sagikazarmark/nix-templates#TEMPLATE# Create a new directory
nix flake new --template github:sagikazarmark/nix-templates#TEMPLATE NEW_PROJECT
```## Templates
| Template | Description |
|----------------------------------|--------------------------------------------------|
| [base](./base) | A basic project template |
| [base-dev](./base-dev) | A basic project template targeted at development |
| [base-kube](./base-kube) | A basic project template with Kubernetes tools |
| [go-library](./go-library) | A Go library template |
| [go-service](./go-service) | A Go service template |
| [go-simple-cli](./go-simple-cli) | A simple Go CLI template |## Development
### Creating a new template
Use the `base` template to scaffold a new template:
```shell
nix flake new --template .#base NEW_TEMPLATE
```Add the template to the list above.
### Updating templates
Some of the components need updating from time to time.
This section describes the steps to do that.#### Upgrade nix-direnv
All templates come with a [nix-direnv](https://github.com/nix-community/nix-direnv) initialization in `.envrc` to make sure the generated projects are self-contained.
This makes projects usable without installing nix-direnv on the machine manually.The nix-direnv version in `.envrc` is pinned, so it needs updating from time to time.
Run the following command to update nix-direnv to a [specific version](https://github.com/nix-community/nix-direnv/releases):
```shell
update-envrc 2.1.2
```Review the changes then commit, push and open a PR.
## Credits
Check out the [Official Nix templates](https://github.com/NixOS/templates) for more examples.
Kudos to [@lucperkins](https://github.com/lucperkins) for creating [The Nix Way](https://github.com/the-nix-way).
These template are inspired by his [dev templates](https://github.com/the-nix-way/dev-templates).## License
The project is licensed under the [MIT License](LICENSE).