From 6d4fb02e3406c4076444586cb79159d10fc72e4a Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Wed, 20 May 2026 09:23:06 -0500 Subject: [PATCH] github-copilot-cli: use lib.hm.strings.isPathLike --- modules/programs/github-copilot-cli.nix | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/modules/programs/github-copilot-cli.nix b/modules/programs/github-copilot-cli.nix index b77039116..04228aa5c 100644 --- a/modules/programs/github-copilot-cli.nix +++ b/modules/programs/github-copilot-cli.nix @@ -19,11 +19,6 @@ let upstreamConfigDir = "${config.home.homeDirectory}/.copilot"; - isStorePathString = - content: builtins.isString content && lib.hasPrefix "${builtins.storeDir}/" content; - - isPathLikeContent = content: lib.isPath content || isStorePathString content; - transformSingleServer = _name: server: let @@ -344,11 +339,11 @@ in config = mkIf cfg.enable { assertions = [ { - assertion = !isPathLikeContent cfg.agents || lib.pathIsDirectory cfg.agents; + assertion = !lib.hm.strings.isPathLike cfg.agents || lib.pathIsDirectory cfg.agents; message = "`programs.github-copilot-cli.agents` 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.github-copilot-cli.skills` must be a directory when set to a path"; } ]; @@ -379,19 +374,19 @@ in }; "${cfg.configDir}/copilot-instructions.md" = - if isPathLikeContent cfg.context then + if lib.hm.strings.isPathLike cfg.context then { source = cfg.context; } else mkIf (cfg.context != "") { text = cfg.context; }; - "${cfg.configDir}/agents" = mkIf (isPathLikeContent cfg.agents) { + "${cfg.configDir}/agents" = mkIf (lib.hm.strings.isPathLike cfg.agents) { source = cfg.agents; recursive = true; }; - "${cfg.configDir}/skills" = mkIf (isPathLikeContent cfg.skills) { + "${cfg.configDir}/skills" = mkIf (lib.hm.strings.isPathLike cfg.skills) { source = cfg.skills; recursive = true; }; @@ -400,21 +395,21 @@ in lib.mapAttrs' ( name: content: lib.nameValuePair "${cfg.configDir}/agents/${name}.agent.md" ( - if isPathLikeContent content then { source = content; } else { text = content; } + if lib.hm.strings.isPathLike content then { source = content; } else { text = content; } ) ) cfg.agents ) // lib.optionalAttrs (builtins.isAttrs cfg.skills) ( lib.mapAttrs' ( name: content: - if isPathLikeContent content && lib.pathIsDirectory content then + if lib.hm.strings.isPathLike content && lib.pathIsDirectory content then lib.nameValuePair "${cfg.configDir}/skills/${name}" { source = content; recursive = true; } else lib.nameValuePair "${cfg.configDir}/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; } ) ) cfg.skills );