feat: nih forgejo alias

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-04-12 22:59:40 -03:00
parent e1901c2954
commit d9725b8c64
2 changed files with 31 additions and 0 deletions

View File

@@ -262,6 +262,8 @@ case "$1" in
"exec" | "x" ) shift 1; nih-execute "$@" ;;
"sync") nih-sync "$flake_dir" "$host" ;;
"format") nih-format "$flake_dir" ;;
"forgejo") shift 1; nih-forgejo "$@" ;;
"forgejo-act") shift 1; nih-forgejo-act "$@" ;;
*) gum log --structured --prefix 'nih' --level error "Command $1 does not exist" ;;
esac

View File

@@ -23,6 +23,35 @@
flake_dir="${toString cfg.flakeDir}";
host="${toString cfg.host}";
function nih-forgejo() {
${
if config.services.forgejo.actions.enable
then ''
sudo --user=${config.services.forgejo.user} \
${config.services.forgejo.package}/bin/gitea \
--work-path ${config.services.forgejo.stateDir} \
"$@"
''
else ''
gum log --structured --prefix 'nih' --level error "Forgejo action runnser service is not enabled"
''
}
}
function nih-forgejo-act() {
${
if config.services.forgejo.enable
then ''
sudo --user=${config.services.forgejo.user} \
${config.services.gitea-actions-runner.package}/bin/act_runner \
--config /var/lib/gitea-runner/forgejo${toString config.services.forgejo.settings.server.HTTP_PORT} \
"$@"
''
else ''
gum log --structured --prefix 'nih' --level error "Forgejo service is not enabled"
''
}
}
${builtins.readFile ./cli.sh}
'';