mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
opencode: use lib.hm.strings.isPathLike
This commit is contained in:
@@ -63,9 +63,6 @@ let
|
||||
else
|
||||
cfg.package;
|
||||
|
||||
isStorePathString =
|
||||
content: builtins.isString content && lib.hasPrefix "${builtins.storeDir}/" content;
|
||||
isPathLikeContent = content: lib.isPath content || isStorePathString content;
|
||||
in
|
||||
{
|
||||
meta.maintainers = with lib.maintainers; [ delafthi ];
|
||||
@@ -435,7 +432,7 @@ in
|
||||
message = "`programs.opencode.tools` must be a directory when set to a path";
|
||||
}
|
||||
{
|
||||
assertion = !isPathLikeContent cfg.skills || lib.pathIsDirectory cfg.skills;
|
||||
assertion = !lib.hm.strings.isPathLike cfg.skills || lib.pathIsDirectory cfg.skills;
|
||||
message = "`programs.opencode.skills` must be a directory when set to a path";
|
||||
}
|
||||
{
|
||||
@@ -522,7 +519,7 @@ in
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
"opencode/skills" = mkIf (isPathLikeContent cfg.skills) {
|
||||
"opencode/skills" = mkIf (lib.hm.strings.isPathLike cfg.skills) {
|
||||
source = cfg.skills;
|
||||
recursive = true;
|
||||
};
|
||||
@@ -558,14 +555,14 @@ in
|
||||
)
|
||||
// lib.mapAttrs' (
|
||||
name: content:
|
||||
if isPathLikeContent content && lib.pathIsDirectory content then
|
||||
if lib.hm.strings.isPathLike content && lib.pathIsDirectory content then
|
||||
lib.nameValuePair "opencode/skills/${name}" {
|
||||
source = content;
|
||||
recursive = true;
|
||||
}
|
||||
else
|
||||
lib.nameValuePair "opencode/skills/${name}/SKILL.md" (
|
||||
if isPathLikeContent content then { source = content; } else { text = content; }
|
||||
if lib.hm.strings.isPathLike content then { source = content; } else { text = content; }
|
||||
)
|
||||
) (if builtins.isAttrs cfg.skills then cfg.skills else { })
|
||||
// lib.optionalAttrs (builtins.isAttrs cfg.themes) (
|
||||
|
||||
Reference in New Issue
Block a user