0
0
Fork 0
mirror of https://codeberg.org/forgejo/docs.git synced 2025-01-21 02:12:15 -05:00

admin: runner-installation: update NixOS instructions (#998)

Preview: https://forgejo.codeberg.page/@docs_pull_998/docs/next/admin/runner-installation/#nixos

Fixes #903.

As described in that issue, the Nix package has been renamed upstream, as well as that the mentioned service module does not exist in reality.
I reworked that section to bring everything up-to-date. The mentioned labels pre-population does not apply to Forgejo, at least.  I have also added a small example as reference.

Further, I included a small change to `scripts/preview.sh`, to detect the actual URL open command - on Linux, `xdg-open` is normally the canonical one.

Reviewed-on: https://codeberg.org/forgejo/docs/pulls/998
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Christoph Heiss <christoph@c8h4.io>
Co-committed-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2025-01-05 09:51:32 +00:00 committed by Earl Warren
parent 2da0c137a6
commit 2bb951215c
2 changed files with 30 additions and 3 deletions

View file

@ -517,9 +517,30 @@ Now, `Forgejo runner` will create networks with IPv6 enabled, and workflow conta
### NixOS
The [`forgejo-actions-runner`](https://github.com/NixOS/nixpkgs/blob/ac6977498b1246f21af08f3cf25ea7b602d94b99/pkgs/development/tools/continuous-integration/forgejo-actions-runner/default.nix) recipe is released in NixOS.
A [`forgejo-runner`](https://search.nixos.org/packages?channel=unstable&show=forgejo-runner&type=packages&query=forgejo-runner) package is available for Nix.
As NixOS service module [`services.gitea-actions-runner.*`](https://search.nixos.org/options?channel=unstable&type=options&query=services.gitea-actions-runner) can be used.
Please note that the `services.forgejo-actions-runner.instances.<name>.labels` key may be set to `[]` (an empty list) to use the packaged Forgejo instance list. One of `virtualisation.docker.enable` or `virtualisation.podman.enable` will need to be set. The default Forgejo image list is populated with docker images.
If application containers are to be used (Docker or Podman), one of `virtualisation.docker.enable` or `virtualisation.podman.enable` must also be set to `true`.
An example service definition might look like this:
```nix
services.gitea-actions-runner = {
package = pkgs.forgejo-runner;
instances.my-forgejo-instance = {
enable = true;
name = "my-forgejo-runner-01";
token = "<registration-token>";
url = "https://code.forgejo.org/";
labels = [
"node-22:docker://node:22-bookworm"
"nixos-latest:docker://nixos/nix"
];
settings = { ... };
};
```
The runner configuration can be specified in `services.gitea-actions-runner.instances.<instance>.settings` as per [Configuration](#configuration).
IPv6 support is not enabled by default for docker. The following snippet enables this.

View file

@ -1,5 +1,11 @@
#!/usr/bin/env sh
if hash xdg-open 2>/dev/null; then
open_cmd=xdg-open
else
open_cmd=open
fi
current_branch=$(git branch --show-current)
repo_path=$(pwd)
@ -32,7 +38,7 @@ mkdir -p $(dirname ./src/content/images/$current_branch) # in case of branch na
ln -s $repo_path/images/ ./public/images/$current_branch
# once the dev server is running, open the current docs branch in the browser
sleep 3 && open http://localhost:4321/docs/$current_branch/ &
sleep 3 && $open_cmd http://localhost:4321/docs/$current_branch/ &
# start the dev server
pnpm run dev