A set of project templates for Nix-powered development. Aiming to align with latest best practices in an opinionated way.
This project includes a collection of flake.nix templates for projects of different languages. Each playground provides
nix developfor development environment.nix buildfor production build and packaging.nix fmtfor code formatting.
Recommended to be used with direnv and nix-direnv.
$ nix flake init --template github:SharzyL/flakae#cpp_cmakeor
$ nix flake new --template github:SharzyL/flakae#cpp_cmake ./cpp_cmakeReplace cpp_cmake with the desired template name, which is a directory name in this project root.
To synchronize nixpkgs to the system version (as in ~/.config/nix/registry.json):
./bump.shPre-commit hook that performs format checks
#!/usr/bin/env bash
set -euo pipefail
nix fmt -- --fail-on-changePre-commit hook that performs flake checks
#!/usr/bin/env bash
set -euo pipefail
nix flake checkname: Nix Flake Check
on:
push:
branches: [ goshujin ]
pull_request:
branches: [ goshujin ]
jobs:
nix-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Check Nix flake
run: |
nix build
nix flake check