diff --git a/default.nix b/default.nix index bd90606..a1da823 100644 --- a/default.nix +++ b/default.nix @@ -6,6 +6,8 @@ let inherit (pkgs) lib mkShell; + inherit (pkgs.lib.fileset) gitTracked toSource; + git-checks = (import sources.git-hooks).run { src = ./.; @@ -39,14 +41,18 @@ in }; install = - config: + { src, ... }@config: let project = lib.evalModules { modules = [ ./modules { - config = config // { + config = (removeAttrs config [ "src" ]) // { _module.args.pkgs = pkgs; + rootSrc = toSource { + root = src; + fileset = gitTracked src; + }; }; } ]; diff --git a/modules/workflows.nix b/modules/workflows.nix index 481795a..ef90a30 100644 --- a/modules/workflows.nix +++ b/modules/workflows.nix @@ -21,6 +21,7 @@ let attrsOf bool enum + path str ; @@ -49,7 +50,7 @@ let json2yaml "$valuePath" "$out" # Check that the workflow is valid - action-validator "$out" + cd "${cfg.rootSrc}" && action-validator "$out" '' ) { }; @@ -104,6 +105,13 @@ in Whether to remove unknown workflow files. ''; }; + + rootSrc = mkOption { + type = path; + description = '' + The source of the project. + ''; + }; }; config = {