1
0
Fork
You've already forked flake-templates
0
Personal list of nix flake templates
  • Nix 100%
2026年06月24日 19:30:54 +02:00
c3 feat: update package importing 2026年06月03日 13:52:40 +02:00
java feat: update package importing 2026年06月03日 13:52:40 +02:00
meta chore: rename template to meta 2026年06月03日 13:52:40 +02:00
python fix(python): deprecate direnv flakes 2026年06月24日 19:30:54 +02:00
rust feat(rust): remove cranelift codegen 2026年06月23日 14:16:25 +02:00
flake.nix chore: rename template to meta 2026年06月03日 13:52:40 +02:00
LICENSE chore: add LICENSE 2026年06月03日 13:52:40 +02:00
README.md doc(comms): clarify in readme 2026年06月03日 13:52:40 +02:00

hyperpastels flake templates

This repository contains my personal nix templates that I use to initialize projects.

Project Layout

The flake.nix contains entries for every template offered by this set. Each entry contains the path to the template folder, which intern contains all the files that will be copied by the init command. All template folders are placed adjacent to the flake file, at the root of this repository.

Using these templates

Nix allows the initialization of directories using the command nix flake init. This command will copy all the template files to the current working directory (so invoke it once you're inside the project folder).

To use these templates, invoke it as

nix flake init --template "git+https://codeberg.org/hyperpastel/flake-templates.git"#<template_name>

Replace <template_name> with the name of any of the folders in this directory for the corresponding template, i.e. replacing it with rust to initialize a project for rust.

However, pasting the URL everytime is tedious. Instead, you can add this repository's flake to your systems nix registry, allowing it to be stored locally and then reused under an alias. To do this, your system needs to already be configured through flakes (see this guide for details). Then, inside your systems flake.nix, add this repository as a flake input:

{
 inputs = {
 # ...
 templates.url = "git+https://codeberg.org/hyperpastel/flake-templates.git";
 # ...
 };
 # ...
}

The name of the input can be chosen freely, and especially if using several template sets, you may wish to give it a more decisive name. Then, at whichever place you configure your system's environment, add the following:

nix.registry.project-templates.flake = templates;

The name on the left can be chosen freely again, the one on the right must match your earlier declaration. Remember to add the flake input as package parameters at the top of that file, likely something like:

{ templates, pkgs, lib, ... }:

Rebuild your systems configuration, i.e. through

sudo nixos-rebuild switch --flake /path/to/config/flake

You can now invoke the previous init command as

nix flake init --template project-template#rust

assuming you've named the registry entry the same way as above.