Compare commits
No commits in common. "1fbe51c4ce5ff93da322830166d2e4e520dff353" and "f9ba8473d21c67de140b6237343ae372a5ea0bd1" have entirely different histories.
1fbe51c4ce
...
f9ba8473d2
@ -4,11 +4,11 @@ on: [push]
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
DEBIAN_FRONTEND: noninteractive
|
DEBIAN_FRONTEND: noninteractive
|
||||||
# PATH: /run/current-system/sw/bin/:/nix/var/nix/profiles/per-user/gitea-runner/profile/bin
|
PATH: /run/current-system/sw/bin/:/nix/var/nix/profiles/per-user/gitea-runner/profile/bin
|
||||||
|
|
||||||
defaults:
|
# defaults:
|
||||||
run:
|
# run:
|
||||||
shell: /run/current-system/sw/bin/nix shell nixpkgs#nodejs-18_x
|
# shell: nix shell nixpkgs#nodejs-18_x
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-flake:
|
check-flake:
|
||||||
@ -23,8 +23,8 @@ jobs:
|
|||||||
# with:
|
# with:
|
||||||
# github_access_token: ${{ secrets.__GITHUB_TOKEN }}
|
# github_access_token: ${{ secrets.__GITHUB_TOKEN }}
|
||||||
|
|
||||||
# - name: Install dependencies
|
- name: Install dependencies
|
||||||
# run: nix profile install nixpkgs#nodejs-18_x
|
run: nix profile install nixpkgs#nodejs-18_x
|
||||||
|
|
||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
@ -11,6 +11,12 @@ in
|
|||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = lib.mdDoc "gitea runner data directory.";
|
description = lib.mdDoc "gitea runner data directory.";
|
||||||
};
|
};
|
||||||
|
instanceUrl = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
registrationTokenFile = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
@ -29,6 +35,13 @@ in
|
|||||||
};
|
};
|
||||||
users.groups.gitea-runner = { };
|
users.groups.gitea-runner = { };
|
||||||
|
|
||||||
|
# registration token
|
||||||
|
services.gitea-runner.registrationTokenFile = "/run/agenix/gitea-runner-registration-token";
|
||||||
|
age.secrets.gitea-runner-registration-token = {
|
||||||
|
file = ../../secrets/gitea-runner-registration-token.age;
|
||||||
|
owner = "gitea-runner";
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services.gitea-runner = {
|
systemd.services.gitea-runner = {
|
||||||
description = "Gitea Runner";
|
description = "Gitea Runner";
|
||||||
|
|
||||||
@ -44,7 +57,40 @@ in
|
|||||||
|
|
||||||
path = with pkgs; [ gitea-actions-runner ];
|
path = with pkgs; [ gitea-actions-runner ];
|
||||||
|
|
||||||
|
# based on https://gitea.com/gitea/act_runner/src/branch/main/run.sh
|
||||||
script = ''
|
script = ''
|
||||||
|
. ${cfg.registrationTokenFile}
|
||||||
|
|
||||||
|
if [[ ! -s .runner ]]; then
|
||||||
|
try=$((try + 1))
|
||||||
|
success=0
|
||||||
|
|
||||||
|
LOGFILE="$(mktemp)"
|
||||||
|
|
||||||
|
# The point of this loop is to make it simple, when running both act_runner and gitea in docker,
|
||||||
|
# for the act_runner to wait a moment for gitea to become available before erroring out. Within
|
||||||
|
# the context of a single docker-compose, something similar could be done via healthchecks, but
|
||||||
|
# this is more flexible.
|
||||||
|
while [[ $success -eq 0 ]] && [[ $try -lt ''${10:-10} ]]; do
|
||||||
|
act_runner register \
|
||||||
|
--instance "${cfg.instanceUrl}" \
|
||||||
|
--token "$GITEA_RUNNER_REGISTRATION_TOKEN" \
|
||||||
|
--name "${config.networking.hostName}" \
|
||||||
|
--no-interactive > $LOGFILE 2>&1
|
||||||
|
|
||||||
|
cat $LOGFILE
|
||||||
|
|
||||||
|
cat $LOGFILE | grep 'Runner registered successfully' > /dev/null
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
echo "SUCCESS"
|
||||||
|
success=1
|
||||||
|
else
|
||||||
|
echo "Waiting to retry ..."
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
exec act_runner daemon
|
exec act_runner daemon
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -6,5 +6,10 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
networking.hostName = "phil";
|
networking.hostName = "phil";
|
||||||
services.gitea-runner.enable = true;
|
services.gitea-runner = {
|
||||||
|
enable = true;
|
||||||
|
instanceUrl = "https://git.neet.dev";
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.binfmt.emulatedSystems = [ "x86_64-linux" ];
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,7 @@
|
|||||||
|
|
||||||
networking.hostName = "s0";
|
networking.hostName = "s0";
|
||||||
|
|
||||||
# system.autoUpgrade.enable = true;
|
system.autoUpgrade.enable = true;
|
||||||
|
|
||||||
# gitea runner and allow it to build ARM derivations
|
|
||||||
services.gitea-runner.enable = true;
|
|
||||||
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
|
||||||
nix.gc.automatic = lib.mkForce false; # allow the nix store to serve as a build cache
|
|
||||||
|
|
||||||
services.iperf3.enable = true;
|
services.iperf3.enable = true;
|
||||||
services.iperf3.openFirewall = true;
|
services.iperf3.openFirewall = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user