templates: init

This commit is contained in:
Infinidoge 2024-08-07 18:51:52 -04:00
parent 4ffa6a63e2
commit cab19ec5ca
Signed by: Infinidoge
SSH key fingerprint: SHA256:GT2StvPQMMfFHyiiFJymQxfTG/z6EWLJ6NWItf5K5sA
4 changed files with 46 additions and 0 deletions

15
templates/default.nix Normal file
View file

@ -0,0 +1,15 @@
{ lib, ... }:
let
mkTemplate = name:
let
path = ./. + "/${name}";
flake = import (path + "/flake.nix");
in
{ inherit path; }
// lib.optionalAttrs (flake ? description) { inherit (flake) description; };
templates = lib.attrNames (lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./.));
in
{
flake.templates = lib.genAttrs templates mkTemplate;
}