Nix-integrated project templates (flake init -t)
- Nix 82.2%
- Rust 9.4%
- Astro 2.3%
- Emacs Lisp 2%
- CMake 1.8%
- Other 2.3%
| astro | ||
| cpp | ||
| elisp | ||
| nixlib | ||
| rust-app | ||
| rust-tui | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
lunixose templates — Nix-integrated project starting points
Reusable project skeletons, each a self-contained flake with:
flake.nix+ ownflake.lock(works standalone)nix/package.nix(language-appropriate packaging)devShells.default = pkgs.mkShell(matches the rest of the lunixose stack).forgejo/workflows/ci.yml(generic build+test, no deploy coupling)
Use
# copy a template into the current (empty) dir
nix flake init -t github:quocjq/templates#astro
nix flake init -t git+https://git.lunixose.duckdns.org/lunixose/templates#rust-tui
# or from a local checkout
nix flake init -t /path/to/templates#cpp
# then
nix develop # dev shell
nix build . # build the package
nix flake check # run checks
Templates
| name | what | stack |
|---|---|---|
astro |
Astro SSR webapp | astro + @astrojs/node, buildNpmPackage |
rust-tui |
Rust TUI | crane + rust-overlay + ratatui |
rust-app |
Rust application | crane + rust-overlay, plain binary |
cpp |
C++ app | cmake + clang, stdenv.mkDerivation |
elisp |
Emacs Lisp package | trivialBuild |
nixlib |
Minimal Nix lib | packages + checks + overlay |
Adding the self-deploy chain (optional)
Templates ship a generic CI (build + test) on purpose — a new project should build in isolation, not assume the lunatix deploy infra exists.
When you DO want a project to auto-deploy via the lunatix flake chain (like
blog/homepage), add a stage to .forgejo/workflows/ci.yml:
- name: bump lunatix input
env:
HOME: /var/lib/gitea-runner/default
run: |
set -euo pipefail
rm -rf lunatix-ci
git clone git@github.com:quocjq/lunatix.git lunatix-ci
cd lunatix-ci
nix flake update <your-project>
git config user.name "forgejo-ci"
git config user.email "ci@lunixose.local"
git add flake.lock flake.nix
git diff --cached --quiet && { echo "input already up to date"; exit 0; }
git commit -m "chore(flake): bump <your-project> input [actions]"
git push origin main
Then add <your-project> as a flake input in lunatix (modules/community/server/<name>.nix
with flake-file.inputs.<name>) — the oracle deploy timer picks the rest up.
Notes
- npmDepsHash (astro): a magic blob in
nix/package.nix. When deps change, runnix build . 2>&1 | grep npmDepsHashand paste the value it prints. - Each template has its own lock;
nix flake updateper project, not globally. - CI runs on the oracle runner (
host:host, aarch64) — rust/cpp templates are verified on both arches.