From 3bd14b4479ed8521f57d71e5374c4819f17f2a40 Mon Sep 17 00:00:00 2001 From: "Thomas G. Lopes" Date: Mon, 13 Apr 2026 16:22:09 +0100 Subject: [PATCH] separate custom pkgs into its own repo --- .gitea/scripts/commit-update.sh | 20 ------- .gitea/scripts/create-gitea-pr.sh | 48 ----------------- .gitea/scripts/update-appimage-nix.sh | 72 ------------------------- .gitea/workflows/handy-update.yml | 70 ------------------------ .gitea/workflows/helium-update.yml | 70 ------------------------ .gitea/workflows/t3code-update.yml | 70 ------------------------ .gitea/workflows/zen-browser-update.yml | 70 ------------------------ flake.lock | 29 +++++++++- flake.nix | 7 +++ modules/browsers.nix | 5 +- modules/packages.nix | 8 +-- modules/pkgs/handy.nix | 29 ---------- modules/pkgs/helium.nix | 22 -------- modules/pkgs/t3code.nix | 37 ------------- modules/pkgs/zen-browser.nix | 41 -------------- 15 files changed, 41 insertions(+), 557 deletions(-) delete mode 100644 .gitea/scripts/commit-update.sh delete mode 100644 .gitea/scripts/create-gitea-pr.sh delete mode 100644 .gitea/scripts/update-appimage-nix.sh delete mode 100644 .gitea/workflows/handy-update.yml delete mode 100644 .gitea/workflows/helium-update.yml delete mode 100644 .gitea/workflows/t3code-update.yml delete mode 100644 .gitea/workflows/zen-browser-update.yml delete mode 100644 modules/pkgs/handy.nix delete mode 100644 modules/pkgs/helium.nix delete mode 100644 modules/pkgs/t3code.nix delete mode 100644 modules/pkgs/zen-browser.nix diff --git a/.gitea/scripts/commit-update.sh b/.gitea/scripts/commit-update.sh deleted file mode 100644 index c4d29dd..0000000 --- a/.gitea/scripts/commit-update.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -: "${BRANCH:?BRANCH is required}" -: "${FILE:?FILE is required}" -: "${COMMIT_MESSAGE:?COMMIT_MESSAGE is required}" - -git config user.name "gitea actions" -git config user.email "actions@localhost" - -git checkout -B "$BRANCH" -git add "$FILE" - -if git diff --cached --quiet; then - echo "No staged changes for ${FILE}; skipping commit" - exit 0 -fi - -git commit -m "$COMMIT_MESSAGE" -git push --force origin "$BRANCH" diff --git a/.gitea/scripts/create-gitea-pr.sh b/.gitea/scripts/create-gitea-pr.sh deleted file mode 100644 index b4b0fdf..0000000 --- a/.gitea/scripts/create-gitea-pr.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -: "${GITEA_API:?GITEA_API is required}" -: "${GITEA_TOKEN:?GITEA_TOKEN is required}" -: "${BRANCH:?BRANCH is required}" -: "${TITLE:?TITLE is required}" -: "${BODY:?BODY is required}" - -owner_prefix="${HEAD_OWNER_PREFIX:-thomas}" - -existing=$(curl -fsS \ - -H "Authorization: token ${GITEA_TOKEN}" \ - "${GITEA_API}/pulls?state=open" \ - | python -c 'import json,sys,os; d=json.load(sys.stdin); b=os.environ["BRANCH"]; print(next((str(pr["number"]) for pr in d if isinstance(pr,dict) and pr.get("head",{}).get("ref")==b), ""))') - -if [ -n "$existing" ]; then - echo "PR already exists: #$existing" - exit 0 -fi - -echo "Creating PR..." -created="false" -for head in "${BRANCH}" "${owner_prefix}:${BRANCH}"; do - echo "Trying head=${head}" - payload=$(HEAD_REF="$head" TITLE="$TITLE" BODY="$BODY" python -c 'import json,os; print(json.dumps({"title": os.environ["TITLE"], "head": os.environ["HEAD_REF"], "base": "main", "body": os.environ["BODY"]}))') - response=$(curl -sS -w '\n%{http_code}' -X POST \ - -H "Authorization: token ${GITEA_TOKEN}" \ - -H "Content-Type: application/json" \ - "${GITEA_API}/pulls" \ - -d "$payload") - - body=$(printf '%s\n' "$response" | sed '$d') - code=$(printf '%s\n' "$response" | tail -n1) - - echo "Create PR status: $code" - echo "$body" - - if [ "$code" -ge 200 ] && [ "$code" -lt 300 ]; then - created="true" - break - fi -done - -if [ "$created" != "true" ]; then - echo "PR creation failed" - exit 1 -fi diff --git a/.gitea/scripts/update-appimage-nix.sh b/.gitea/scripts/update-appimage-nix.sh deleted file mode 100644 index 72e3752..0000000 --- a/.gitea/scripts/update-appimage-nix.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -: "${FILE:?FILE is required}" -: "${LATEST_RELEASE_URL:?LATEST_RELEASE_URL is required}" -: "${DOWNLOAD_URL_TEMPLATE:?DOWNLOAD_URL_TEMPLATE is required}" - -if command -v python >/dev/null 2>&1; then - PYTHON_BIN=python -elif command -v python3 >/dev/null 2>&1; then - PYTHON_BIN=python3 -else - echo "python is required but was not found" - exit 1 -fi - -version_strip_prefix="${LATEST_VERSION_STRIP_PREFIX:-v}" -release_tag_template="${RELEASE_TAG_TEMPLATE:-{version}}" -release_tag_template="${release_tag_template//$'\r'/}" - -current_version=$($PYTHON_BIN - <<'PY' -import re -import os -p=os.environ["FILE"] -s=open(p).read() -m=re.search(r'version\s*=\s*"([^"]+)";', s) -print(m.group(1) if m else "") -PY -) - -latest_version=$(curl -fsSLI -o /dev/null -w '%{url_effective}' "$LATEST_RELEASE_URL" \ - | sed -E 's#.*/##') - -if [ -n "$version_strip_prefix" ]; then - latest_version="${latest_version#${version_strip_prefix}}" -fi - -echo "current=$current_version" -echo "latest=$latest_version" - -if [ -z "$latest_version" ] || [ "$latest_version" = "$current_version" ]; then - echo "updated=false" >> "$GITHUB_OUTPUT" - exit 0 -fi - -download_url="${DOWNLOAD_URL_TEMPLATE//\{version\}/$latest_version}" -new_hash=$(nix store prefetch-file --json "$download_url" | "$PYTHON_BIN" -c 'import json,sys; print(json.load(sys.stdin)["hash"])') - -export LATEST_VERSION="$latest_version" -export NEW_HASH="$new_hash" - -"$PYTHON_BIN" - <<'PY' -import os -import re -p=os.environ["FILE"] -s=open(p).read() -s=re.sub(r'version\s*=\s*"[^"]+"', f'version = "{os.environ["LATEST_VERSION"]}"', s, count=1) -s=re.sub(r'hash\s*=\s*"[^"]+"', f'hash = "{os.environ["NEW_HASH"]}"', s, count=1) -open(p,"w").write(s) -PY - -release_tag="${release_tag_template//\{version\}/$latest_version}" -release_tag="${release_tag#\{}" -release_tag="${release_tag%\}}" -release_tag="${release_tag#\'}" -release_tag="${release_tag%\'}" -release_url="${LATEST_RELEASE_URL%/latest}/tag/${release_tag}" - -echo "updated=true" >> "$GITHUB_OUTPUT" -echo "version=$latest_version" >> "$GITHUB_OUTPUT" -echo "previous_version=$current_version" >> "$GITHUB_OUTPUT" -echo "release_url=$release_url" >> "$GITHUB_OUTPUT" diff --git a/.gitea/workflows/handy-update.yml b/.gitea/workflows/handy-update.yml deleted file mode 100644 index cad891a..0000000 --- a/.gitea/workflows/handy-update.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: handy update - -on: - schedule: - - cron: "40 6 * * *" - workflow_dispatch: - -jobs: - update-handy: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: install nix - uses: cachix/install-nix-action@v27 - with: - nix_path: nixpkgs=channel:nixos-unstable - - - name: check latest handy release and update file - id: update - env: - FILE: modules/pkgs/handy.nix - LATEST_RELEASE_URL: https://github.com/cjpais/Handy/releases/latest - DOWNLOAD_URL_TEMPLATE: https://github.com/cjpais/Handy/releases/download/v{version}/Handy_{version}_amd64.AppImage - RELEASE_TAG_TEMPLATE: v{version} - shell: bash - run: bash .gitea/scripts/update-appimage-nix.sh - - - name: create branch and commit - if: steps.update.outputs.updated == 'true' - shell: bash - run: | - set -euo pipefail - version="${{ steps.update.outputs.version }}" - - BRANCH="bot/handy-${version}" \ - FILE="modules/pkgs/handy.nix" \ - COMMIT_MESSAGE="update handy to ${version}" \ - bash .gitea/scripts/commit-update.sh - - - name: open pull request - if: steps.update.outputs.updated == 'true' - env: - GITEA_TOKEN: ${{ secrets.tea_token || secrets.TEA_TOKEN }} - shell: bash - run: | - set -euo pipefail - - version="${{ steps.update.outputs.version }}" - previous_version="${{ steps.update.outputs.previous_version }}" - release_url="${{ steps.update.outputs.release_url }}" - - pr_body=$(cat <