From 5d1990096e438a059d124208e8236f9eb63a4268 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Wed, 4 Sep 2024 01:51:46 -0400 Subject: [PATCH] templates: handle non-flake templates --- templates/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/default.nix b/templates/default.nix index d55db48..dfdec16 100644 --- a/templates/default.nix +++ b/templates/default.nix @@ -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