Nix flake templates for various languages and frameworks
  • Nix 95.7%
  • Makefile 1.7%
  • Rust 0.5%
  • Idris 0.5%
  • Python 0.5%
  • Other 1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-06 22:44:58 -04:00
bash/script/nixpkgs docs: minor writing tweaks 2026-08-06 20:35:16 -04:00
c refactor: fall back from pname to name of packages 2026-08-02 03:11:08 -04:00
fish/script/nixpkgs refactor: fall back from pname to name of packages 2026-08-02 03:11:08 -04:00
haskell/cabal/cabal2nix docs: minor writing tweaks 2026-08-06 20:35:16 -04:00
idris2 feat: Idris 2 templates 2026-08-06 22:44:58 -04:00
none/none/nixpkgs refactor: fall back from pname to name of packages 2026-08-02 03:11:08 -04:00
python/pyproject/nixpkgs docs: minor writing tweaks 2026-08-06 20:35:16 -04:00
rust refactor: fall back from pname to name of packages 2026-08-02 03:11:08 -04:00
typst docs(typst): add note to welcome text 2026-08-02 03:16:52 -04:00
.gitignore feat: C templates 2026-01-19 14:14:24 -05:00
flake.lock Restructure everything 2024-07-28 06:34:56 -04:00
flake.nix feat: Idris 2 templates 2026-08-06 22:44:58 -04:00
LICENSE chore: bump copyright 2026-06-22 02:57:08 -04:00
README.md tweak(python): rename cli template to app 2026-08-06 18:52:55 -04:00

Toki's Nix Flake Template Repository

This is my personal collection of Nix flake templates for various programming languages and build systems.

Motivation

There already exists an official repository of flake templates, so why make my own?

I have a few different reasons:

  • Comprehensiveness: The official template repository is rather small and doesn't have most of the templates I would actually want to use.
  • Consistency: The templates in the official repository are contributed by community members, and there's very little stylistic or structural consistency between them.
  • Preference: The structure of a flake can be very opinionated, and most of the official flake templates are rather poorly constructed by my standards, often not bothering to follow established best practices.

Usage

Flake templates are used with the nix flake init command:

nix flake init -t git+https://git.tokinanpa.dev/toki/templates#<template>

Replace <template> with the template you want to use. In the simplest case, this is just the name of the programming language you want to use; the repository will pick a recommended default template for that language.

If you want more control over the generated repository, you may select a specific template instead. Template names are made of underscore (_) separated fields; the number of fields may very depending on the language, but typically there are three or four:

  1. The programming language
  2. The build system used to compile/package the repository
  3. The Nix evaluation system used in the flake itself
  4. (Optional) Additional differences in project structure, including but not limited to:
    • basic: Minimal acceptable project structure
    • lib: Library
    • app: Executable application
    • cli: CLI program
    • gui: GUI program

For example, the python_pyproject_nixpkgs_app template generates a Python repository packaged in Pyproject format where the flake uses Nixpkgs' standard derivation builders (buildPythonPackage) and the repository builds an executable application.