mirror of
https://github.com/nmasur/dotfiles
synced 2025-02-12 19:22:02 +00:00
20 lines
512 B
Nix
20 lines
512 B
Nix
|
# Return a list of all templates
|
||
|
|
||
|
{ lib, ... }:
|
||
|
|
||
|
lib.pipe (lib.filesystem.listFilesRecursive ./.) [
|
||
|
# Get only files ending in default.nix
|
||
|
(builtins.filter (name: lib.hasSuffix "flake.nix" name))
|
||
|
# Import each template function
|
||
|
map
|
||
|
(file: rec {
|
||
|
name = builtins.baseNameOf (builtins.dirOf file);
|
||
|
value = {
|
||
|
path = builtins.dirOf file;
|
||
|
description = "${name} template";
|
||
|
};
|
||
|
})
|
||
|
# Convert to an attrset of template name -> template path and description
|
||
|
(builtins.listToAttrs)
|
||
|
]
|