templates: handle non-flake templates
This commit is contained in:
parent
6047b5361f
commit
5d1990096e
1 changed files with 3 additions and 2 deletions
|
@ -3,10 +3,11 @@ let
|
|||
mkTemplate = name:
|
||||
let
|
||||
path = ./. + "/${name}";
|
||||
flake = import (path + "/flake.nix");
|
||||
flakePath = path + "/flake.nix";
|
||||
meta = if builtins.pathExists flakePath then import flakePath else { };
|
||||
in
|
||||
{ inherit path; }
|
||||
// lib.optionalAttrs (flake ? description) { inherit (flake) description; };
|
||||
// lib.optionalAttrs (meta ? description) { inherit (meta) description; };
|
||||
|
||||
templates = lib.attrNames (lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./.));
|
||||
in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue