diff --git a/snowfall-lib/path/default.nix b/snowfall-lib/path/default.nix index bd39e1f..894b5b2 100644 --- a/snowfall-lib/path/default.nix +++ b/snowfall-lib/path/default.nix @@ -133,5 +133,18 @@ in #@ Path -> String get-output-name = path: builtins.unsafeDiscardStringContext (get-parent-directory path); + + ## Get the directory name for flake outputs. + ## Example Usage: + ## ```nix + ## get-directory-name /templates/foo + ## ``` + ## Result: + ## ```nix + ## "foo" + ## ``` + #@ Path -> String + get-directory-name = path: + builtins.unsafeDiscardStringContext (baseNameOf path); }; } diff --git a/snowfall-lib/template/default.nix b/snowfall-lib/template/default.nix index ad3f828..0ad43e3 100644 --- a/snowfall-lib/template/default.nix +++ b/snowfall-lib/template/default.nix @@ -41,7 +41,7 @@ in description = flake-attrs.description or null; in { - name = builtins.unsafeDiscardStringContext (baseNameOf template); + name = snowfall-lib.path.get-directory-name template; path = template; } // (if description != null then { inherit description; } else { });