feat: add path.get-directory-name helper for consistent directory name extraction

This commit is contained in:
anntnzrb
2025-10-08 23:39:54 -05:00
parent a8025edb45
commit 903e38d999
2 changed files with 14 additions and 1 deletions

View File

@@ -133,5 +133,18 @@ in
#@ Path -> String #@ Path -> String
get-output-name = path: get-output-name = path:
builtins.unsafeDiscardStringContext (get-parent-directory 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);
}; };
} }

View File

@@ -41,7 +41,7 @@ in
description = flake-attrs.description or null; description = flake-attrs.description or null;
in in
{ {
name = builtins.unsafeDiscardStringContext (baseNameOf template); name = snowfall-lib.path.get-directory-name template;
path = template; path = template;
} }
// (if description != null then { inherit description; } else { }); // (if description != null then { inherit description; } else { });