actions.nix
actions-nix
is a nix
module that converts nix
configuration into GitHub/Gitea action
syntax yaml
. Use nix
for workflow definition instead of yaml
.
Installation
To use these options, add to your flake inputs:
actions-nix.url = "github:nialov/actions.nix";
and inside the mkFlake
:
imports = [
inputs.actions-nix.flakeModules.default
];
Run nix flake lock
and you're set.
Options
flake.actions-nix
Configuration of actions.
Type: submodule
Declared by:
flake.actions-nix.defaults.jobs.runs-on
Default value for runs-on for jobs.
Type: string
Example:
"ubuntu-latest"
Declared by:
flake.actions-nix.defaults.jobs.timeout-minutes
Default value for timeout-minutes for jobs.
Type: signed integer
Example:
60
Declared by:
flake.actions-nix.pre-commit.enable
Whether to enable pre-commit generation of workflow yaml files.
The pre-commit hook, generated using
git-hooks.nix, converts
flake.actions-nix.workflows
configuration into respective workflow
files in the path defined within the configuration, i.e. key in
actions-nix.workflows
attribute set
.
Type: boolean
Default:
false
Example:
true
Declared by:
flake.actions-nix.render-package.enable
Whether to enable addition of a package definition to perSystem.packages.render-workflows
for rendering workflows.
.
Type: boolean
Default:
false
Example:
true
Declared by:
flake.actions-nix.workflows
Attributes where key is the file in which you want the yaml
configuration and the value is the workflow definition attribute set
in nix
. The value is freeform, i.e., you may use any keys and
values within the attribute set. However, some common keys and values
have option definitions. If these definitions do not allow syntax
that is valid within an action framework, e.g. GitHub or Gitea,
please file an issue.
See GitHub documentation for GitHub Actions syntax:
https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions
See Gitea documentation for Gitea Actions syntax:
https://docs.gitea.com/next/usage/actions/overview/
Type: attribute set of (attribute set)
Default:
{ }
Example:
{
".github/workflows/main.yaml" = {
jobs = {
nix-flake-check = {
steps = [
{
uses = "actions/checkout@v4";
}
{
uses = "DeterminateSystems/nix-installer-action@v9";
}
{
name = "Check flake";
run = "nix -Lv flake check";
}
];
};
};
};
}
Declared by:
flake.actions-nix.workflows.<name>.jobs
Configuration of jobs.
Type: attribute set of (attribute set)
Declared by:
flake.actions-nix.workflows.<name>.jobs.<name>.needs
Type: null or (list of string)
Default:
null
Declared by:
flake.actions-nix.workflows.<name>.jobs.<name>.runs-on
Type: string
Default:
defaults.jobs.runs-on
Declared by:
flake.actions-nix.workflows.<name>.jobs.<name>.steps
Type: list of (attribute set)
Default:
[ ]
Declared by:
flake.actions-nix.workflows.<name>.jobs.<name>.steps.*.env
Type: null or (attribute set)
Default:
null
Declared by:
flake.actions-nix.workflows.<name>.jobs.<name>.steps.*.if
Type: null or string
Default:
null
Declared by:
flake.actions-nix.workflows.<name>.jobs.<name>.steps.*.name
Type: null or string
Default:
null
Declared by:
flake.actions-nix.workflows.<name>.jobs.<name>.steps.*.run
Type: null or string
Default:
null
Declared by:
flake.actions-nix.workflows.<name>.jobs.<name>.steps.*.uses
Type: null or string
Default:
null
Declared by:
flake.actions-nix.workflows.<name>.jobs.<name>.steps.*.with
Type: null or (attribute set)
Default:
null
Declared by:
flake.actions-nix.workflows.<name>.jobs.<name>.strategy
Type: null or (attribute set)
Default:
null
Declared by:
flake.actions-nix.workflows.<name>.jobs.<name>.timeout-minutes
Type: null or signed integer
Default:
defaults.jobs.timeout-minutes
Declared by:
flake.actions-nix.workflows.<name>.on
Trigger(s) to automatically trigger a workflow.
Type: attribute set
Default:
{
push = { };
workflow_dispatch = { };
}
Declared by: