From eceaac05131da19da0714c1c0265cebddbb18e30 Mon Sep 17 00:00:00 2001 From: imnyang Date: Sun, 26 Apr 2026 02:11:42 +0900 Subject: [PATCH] wow --- .forgejo/workflows/update-helium.yml | 94 ++++++++++++++++++++++++++++ flake.lock | 6 +- flake.nix | 3 +- pkgs/helium/default.nix | 56 +++++++++++++++++ 4 files changed, 155 insertions(+), 4 deletions(-) create mode 100644 .forgejo/workflows/update-helium.yml create mode 100644 pkgs/helium/default.nix diff --git a/.forgejo/workflows/update-helium.yml b/.forgejo/workflows/update-helium.yml new file mode 100644 index 0000000..0d8467b --- /dev/null +++ b/.forgejo/workflows/update-helium.yml @@ -0,0 +1,94 @@ +name: Update Helium + +on: + schedule: + - cron: '0 0 * * *' # 매일 UTC 00:00 + workflow_dispatch: + +jobs: + update: + runs-on: x86_64 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Check for new helium release + id: check + run: | + source /etc/bashrc + + CURRENT_VERSION=$(grep 'version = ' pkgs/helium/default.nix | head -1 | grep -oP '"[^"]+"' | tr -d '"') + echo "Current version: $CURRENT_VERSION" + + LATEST_VERSION=$(curl -fsSL https://api.github.com/repos/imputnet/helium-linux/releases/latest | nix run nixpkgs#jq -- -r '.tag_name') + echo "Latest version: $LATEST_VERSION" + + if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ]; then + echo "Already up to date." + echo "updated=false" >> $GITHUB_OUTPUT + exit 0 + fi + + echo "New version found: $LATEST_VERSION" + echo "latest_version=$LATEST_VERSION" >> $GITHUB_OUTPUT + echo "updated=true" >> $GITHUB_OUTPUT + + - name: Update version and sha256 + if: steps.check.outputs.updated == 'true' + id: update + run: | + source /etc/bashrc + + LATEST="${{ steps.check.outputs.latest_version }}" + PNAME="helium" + URL="https://github.com/imputnet/helium-linux/releases/download/${LATEST}/${PNAME}-${LATEST}-x86_64.AppImage" + + echo "Fetching new sha256 for $URL" + NEW_SHA256=$(nix-prefetch-url --type sha256 "$URL" 2>/dev/null | tail -1) + NEW_SHA256_SRI=$(nix hash convert --hash-algo sha256 --to sri "$NEW_SHA256") + echo "New sha256 (SRI): $NEW_SHA256_SRI" + + sed -i "s|version = \".*\";|version = \"${LATEST}\";|" pkgs/helium/default.nix + sed -i "s|sha256 = \"sha256-.*\";|sha256 = \"${NEW_SHA256_SRI}\";|" pkgs/helium/default.nix + + echo "new_sha256=$NEW_SHA256_SRI" >> $GITHUB_OUTPUT + + - name: Verify build + if: steps.check.outputs.updated == 'true' + run: | + source /etc/bashrc + nix build .#helium + + - name: Create Pull Request + if: steps.check.outputs.updated == 'true' + env: + API_FORGEJO_TOKEN: ${{ secrets.API_FORGEJO_TOKEN }} + run: | + source /etc/bashrc + + LATEST="${{ steps.check.outputs.latest_version }}" + BRANCH="update/helium-${LATEST}" + + git config user.name "mizuki" + git config user.email "akiyama@mizuki.guru" + + git checkout -b "$BRANCH" + git add pkgs/helium/default.nix + git commit -m "pkgs/helium: update to ${LATEST}" + + REPO_URL=$(git remote get-url origin | sed 's|https://||') + git push "https://oauth2:${API_FORGEJO_TOKEN}@${REPO_URL}" "$BRANCH" + + # Forgejo API로 PR 생성 + FORGEJO_HOST=$(echo "$REPO_URL" | cut -d'/' -f1) + REPO_PATH=$(echo "$REPO_URL" | cut -d'/' -f2-) + curl -fsSL -X POST \ + -H "Authorization: token ${API_FORGEJO_TOKEN}" \ + -H "Content-Type: application/json" \ + "https://${FORGEJO_HOST}/api/v1/repos/${REPO_PATH}/pulls" \ + -d "{ + \"title\": \"pkgs/helium: update to ${LATEST}\", + \"head\": \"${BRANCH}\", + \"base\": \"main\", + \"body\": \"Automated update of helium to version \`${LATEST}\`.\n\nNew sha256: \`${{ steps.update.outputs.new_sha256 }}\`\" + }" diff --git a/flake.lock b/flake.lock index 347f44c..839eaed 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1773734432, - "narHash": "sha256-IF5ppUWh6gHGHYDbtVUyhwy/i7D261P7fWD1bPefOsw=", + "lastModified": 1776877367, + "narHash": "sha256-EHq1/OX139R1RvBzOJ0aMRT3xnWyqtHBRUBuO1gFzjI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "cda48547b432e8d3b18b4180ba07473762ec8558", + "rev": "0726a0ecb6d4e08f6adced58726b95db924cef57", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 2a931ec..23c5aa5 100644 --- a/flake.nix +++ b/flake.nix @@ -14,13 +14,14 @@ waterfox-bin = final.callPackage ./pkgs/waterfox-bin/default.nix { }; xcursor-mizuki = final.callPackage ./pkgs/xcursor-mizuki/default.nix { stdenv = final.stdenv; }; pjsk-cursor = final.callPackage ./pkgs/pjsk-cursor/default.nix { stdenv = final.stdenv; }; + helium = final.callPackage ./pkgs/helium/default.nix { }; }; pkgs = nixpkgs.legacyPackages.${system}.extend overlay; in { overlays.default = overlay; packages.${system} = { - inherit (pkgs) waterfox-bin xcursor-mizuki pjsk-cursor; + inherit (pkgs) waterfox-bin xcursor-mizuki pjsk-cursor helium; # default = pkgs.waterfox-bin; }; }; diff --git a/pkgs/helium/default.nix b/pkgs/helium/default.nix new file mode 100644 index 0000000..8f59608 --- /dev/null +++ b/pkgs/helium/default.nix @@ -0,0 +1,56 @@ +{ + pkgs, + commandLineArgs ? [ ], + enableFeatures ? [ ], + libvaSupport ? pkgs.stdenv.hostPlatform.isLinux, + widevineSupport ? false, +}: +pkgs.appimageTools.wrapType2 rec { + + pname = "helium"; + version = "0.11.4.1"; + + src = pkgs.fetchurl { + url = "https://github.com/imputnet/helium-linux/releases/download/${version}/${pname}-${version}-x86_64.AppImage"; + sha256 = "sha256-EavHZuleVkgD4J+gcUQ2ZgGHjvWXzdamUh7r42bUkas="; + }; + + _enableFeatures = + enableFeatures + ++ pkgs.lib.optionals libvaSupport [ + "VaapiVideoDecoder" + ]; + + extraPkgs = pkgs: pkgs.lib.optionals libvaSupport [ pkgs.libva ]; + + extraBwrapArgs = [ + "--ro-bind-try /etc/chromium /etc/chromium" + ]; + + nativeBuildInputs = [ pkgs.makeWrapper ]; + + extraInstallCommands = + let + contents = pkgs.appimageTools.extract { inherit pname version src; }; + in + '' + wrapProgram $out/bin/${pname} \ + ${ + pkgs.lib.optionalString ( + _enableFeatures != [ ] + ) "--add-flags \"--enable-features=${pkgs.lib.strings.concatStringsSep "," _enableFeatures}\"" + } \ + ${pkgs.lib.optionalString ( + commandLineArgs != [ ] + ) "--add-flags \"${pkgs.lib.strings.concatStringsSep " " commandLineArgs}\""} \ + ${pkgs.lib.optionalString widevineSupport '' + --run "mkdir -p ~/.config/net.imput.helium/WidevineCdm" \ + --run "echo '{\"Path\":\"${pkgs.widevine-cdm}/share/google/chrome/WidevineCdm\"}' > ~/.config/net.imput.helium/WidevineCdm/latest-component-updated-widevine-cdm" + ''} + install -m 444 -D ${contents}/${pname}.desktop -t $out/share/applications + substituteInPlace $out/share/applications/${pname}.desktop \ + --replace 'Exec=AppRun' 'Exec=${pname}' + cp -r ${contents}/usr/share/icons $out/share + ''; + +}