diff options
| -rw-r--r-- | nix-conf/flake.lock | 52 | ||||
| -rw-r--r-- | nix-conf/overlays/_version-overrides.nix | 15 | ||||
| -rw-r--r-- | nix-conf/overlays/modifications.nix | 14 | ||||
| -rw-r--r-- | nix-conf/pkgs/brave/default.nix | 346 | ||||
| -rw-r--r-- | nix-conf/pkgs/brave/sources.nix | 19 | ||||
| -rw-r--r-- | nix-conf/pkgs/scripts/check-versions.nix | 67 |
6 files changed, 74 insertions, 439 deletions
diff --git a/nix-conf/flake.lock b/nix-conf/flake.lock index b5de98f..41757f0 100644 --- a/nix-conf/flake.lock +++ b/nix-conf/flake.lock @@ -100,11 +100,11 @@ ] }, "locked": { - "lastModified": 1792818383, - "narHash": "sha256-199i7ubVSXTMl+0AAlL7cVCXSjcI+jWByMcimYjeMX0=", + "lastModified": 1794251182, + "narHash": "sha256-R2sZBXiOJo3HAnvTiVkbbHDJy//JMlAwUKEiPbfqPXk=", "owner": "nix-community", "repo": "home-manager", - "rev": "24f2190587513b9c2f73db112a17844ae912d965", + "rev": "6eb2d33d1d0c95a37ef6443c88e6c1686012ee8b", "type": "github" }, "original": { @@ -121,11 +121,11 @@ ] }, "locked": { - "lastModified": 1793757180, - "narHash": "sha256-gyV7AtCwLnOImcrfSETP4J3Ie96bz19DY47B7m7Y3HM=", + "lastModified": 1794278858, + "narHash": "sha256-rkrJwLgLSHBnXfgoSKIDa+2LLGdTqynsV3GAxOTGhUU=", "owner": "nix-community", "repo": "home-manager", - "rev": "b787c48e2ec57a9d098f5c2721882a3bc1e16f97", + "rev": "82ce401aa350502897c3f2e85f384d61cd3b0b6d", "type": "github" }, "original": { @@ -143,11 +143,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1793949034, - "narHash": "sha256-xws6ZOZuv6+BtqF9BZ9NRH5GdJ8zTa/ACN9lNeKC/+s=", + "lastModified": 1794551759, + "narHash": "sha256-kL6q4ItZT++IjrrDlcUOL9L0XNzTLb2+4xQgpHBzx/I=", "owner": "numtide", "repo": "llm-agents.nix", - "rev": "baf924369e8d5ec02af1eab444db411d6fed1e5e", + "rev": "860075d959fc68c31fd405989daf85c1b1f0db38", "type": "github" }, "original": { @@ -184,11 +184,11 @@ ] }, "locked": { - "lastModified": 1793543282, - "narHash": "sha256-PHtGxKYM99f8WhGR5YD7iiCiwemKa2wUD4yVI2oALFg=", + "lastModified": 1794132860, + "narHash": "sha256-iGNtQnUZsi+v6/4NbtYr+dsmASa6GkzXtUcTpE8F3mE=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "cee0f879d338cf08f814210fa6c2b280594ade0a", + "rev": "af9249ca33bc2efaae5d071e4c67ddef19dcb681", "type": "github" }, "original": { @@ -199,11 +199,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1793826729, - "narHash": "sha256-D5H7H+qMoTGI/jJtxKP4u7BdjkFnUyhOovTrf3pTOr0=", + "lastModified": 1793977579, + "narHash": "sha256-WrSODdZFVIs/Hh2NzC0bY+ROByi0bATg8WfePX8dPj8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6dadaf4375be35033e1c84395adbd53ff5fded96", + "rev": "4fe25e12eb9f4c744966dd3de5a05246cf098601", "type": "github" }, "original": { @@ -230,11 +230,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1793633738, - "narHash": "sha256-dKEjuquCf1NEYiTZZr6xrvTrkhAm5Q94JuEwLBzycEs=", - "rev": "7dcdd87373d72e7a2173e4db02e20d3d7f495cfd", + "lastModified": 1794165970, + "narHash": "sha256-YqwBRaXgqn0+I8BCsZVLkzd746X/84fr1/FvZiocsYE=", + "rev": "ac588ef1c914865dad517b337ea0eb9694a4021c", "type": "tarball", - "url": "https://releases.nixos.org/nixos/26.05/nixos-26.05.13446.7dcdd87373d7/nixexprs.tar.zst" + "url": "https://releases.nixos.org/nixos/26.05/nixos-26.05.13936.ac588ef1c914/nixexprs.tar.zst" }, "original": { "id": "nixpkgs", @@ -244,11 +244,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1793826729, - "narHash": "sha256-JiTUXdoNJNvdD+fjVlftWiLKJfHut3cIi8j2HXL9kT4=", - "rev": "6dadaf4375be35033e1c84395adbd53ff5fded96", + "lastModified": 1794495034, + "narHash": "sha256-QG/HY0t5t3sfT2ozW/Ikis5Klqf0X4nfTuLvFaBpNno=", + "rev": "2074cc672349f14240fb7ea90d509e0b643e9dd4", "type": "tarball", - "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.11pre1108556.6dadaf4375be/nixexprs.tar.zst" + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.11pre1118975.2074cc672349/nixexprs.tar.zst" }, "original": { "id": "nixpkgs", @@ -280,11 +280,11 @@ ] }, "locked": { - "lastModified": 1793657466, - "narHash": "sha256-GoOvpdsjO5hqZuO6T6ok9u6sJEjO0iPli2zRr9oNUNw=", + "lastModified": 1794261845, + "narHash": "sha256-Ivif/kuD68yEOKcZZG3zSwNMFUuIgzUgeJuzcHrQy+8=", "owner": "Mic92", "repo": "sops-nix", - "rev": "b18e01ce148eb3efff5de2f2d3181ca53b2b2a54", + "rev": "fe7b4228405aeac2ce7192c2049a6e2bc8637082", "type": "github" }, "original": { diff --git a/nix-conf/overlays/_version-overrides.nix b/nix-conf/overlays/_version-overrides.nix index bd695a6..e81b593 100644 --- a/nix-conf/overlays/_version-overrides.nix +++ b/nix-conf/overlays/_version-overrides.nix @@ -1,5 +1,14 @@ { - google-chrome = null; + brave = { + version = "1.99.57"; + hash = "sha256-kik0sjPd7PpJqdxWKdQEaf2wstWcSVR2l+6g7sQIdxE="; + }; + + google-chrome = { + version = "157.0.8103.79"; + slug = "adnzqttux77ny5bapr5n3fiap5cq"; + hash = "sha256-7tFSLYya1ehrUedt8Br0UcfCSAzbDQCph5TlRvkkikY="; + }; firefox = null; @@ -9,8 +18,8 @@ }; slack = { - version = "4.53.280"; - hash = "sha256-yKMpp0U2OD+4BGVXQO9xeWUuh0Sd4ljxqMpd/11m2/Q="; + version = "4.53.287"; + hash = "sha256-TUt5TPygdtQ4EiaTiJF572xZBmojlBO3bfm1HG3RQII="; }; zoom-us = null; diff --git a/nix-conf/overlays/modifications.nix b/nix-conf/overlays/modifications.nix index 304198c..ad9f62c 100644 --- a/nix-conf/overlays/modifications.nix +++ b/nix-conf/overlays/modifications.nix @@ -36,7 +36,19 @@ in prev.git-remote-codecommit; } // prev.lib.optionalAttrs prev.stdenv.hostPlatform.isDarwin ( - prev.lib.optionalAttrs (v.firefox != null) { + prev.lib.optionalAttrs (v.brave != null) { + brave = prev.brave.overrideAttrs ( + finalAttrs: _: { + inherit (v.brave) version; + src = prev.fetchurl { + url = "https://github.com/brave/brave-browser/releases/download/v${finalAttrs.version}/Brave-Browser-arm64.dmg"; + inherit (v.brave) hash; + }; + sourceRoot = "Brave Browser.app"; + } + ); + } + // prev.lib.optionalAttrs (v.firefox != null) { firefox-unwrapped = import (prev.path + "/pkgs/applications/networking/browsers/firefox/packages/firefox.nix") { diff --git a/nix-conf/pkgs/brave/default.nix b/nix-conf/pkgs/brave/default.nix deleted file mode 100644 index b932939..0000000 --- a/nix-conf/pkgs/brave/default.nix +++ /dev/null @@ -1,346 +0,0 @@ -# Brave was removed from nixpkgs on 2026-11-03 ("no committers among its -# maintainers to unblock security issues"). This is upstream's make-brave.nix -# from nixpkgs ea9e3ef341e11c193537f674f821a99f9f43672 with the "browser" -# flavor inlined; the body below is otherwise unchanged apart from dropping -# passthru.updateScript and meta.maintainers. Version and hashes live in -# ./sources.nix, which check-versions rewrites. -let - inherit (import ./sources.nix) version archives; - pname = "brave"; - flavor = "browser"; - optStem = "brave"; - fileStem = "brave-browser"; - appIdStem = "com.brave.Browser"; - darwinStem = "Brave Browser"; - changelogFile = "CHANGELOG_DESKTOP.md"; - homepage = "https://brave.com/"; - innerBinary = "brave"; -in -{ - lib, - stdenv, - fetchurl, - buildPackages, - alsa-lib, - at-spi2-atk, - at-spi2-core, - atk, - cairo, - cups, - dbus, - dpkg, - expat, - fontconfig, - freetype, - gdk-pixbuf, - glib, - adwaita-icon-theme, - gsettings-desktop-schemas, - gtk3, - gtk4, - qt6, - libx11, - libxscrnsaver, - libxcomposite, - libxcursor, - libxdamage, - libxext, - libxfixes, - libxi, - libxrandr, - libxrender, - libxtst, - libdrm, - libkrb5, - libuuid, - libxkbcommon, - libxshmfence, - libgbm, - nspr, - nss, - pango, - pciutils, - pipewire, - snappy, - speechd-minimal, - udev, - wayland, - xdg-utils, - coreutils, - libxcb, - vulkan-loader, - zlib, - # Darwin dependencies - undmg, - makeWrapper, - # command line arguments which are always set e.g "--disable-gpu" - commandLineArgs ? "", - # Necessary for USB audio devices. - pulseSupport ? stdenv.hostPlatform.isLinux, - libpulseaudio, - # For GPU acceleration support on Wayland (without the lib it doesn't seem to work) - libGL, - # For video acceleration via VA-API (--enable-features=AcceleratedVideoDecodeLinuxGL,AcceleratedVideoEncoder) - libvaSupport ? stdenv.hostPlatform.isLinux, - libva, - enableVideoAcceleration ? libvaSupport, - # For Vulkan support (--enable-features=Vulkan); disabled by default as it seems to break VA-API - vulkanSupport ? false, - enableVulkan ? vulkanSupport, -}: - -let - inherit (lib) - optional - optionals - makeLibraryPath - makeSearchPathOutput - makeBinPath - optionalString - strings - escapeShellArg - ; - - # /opt/brave.com/<optName>/ - optName = optStem; - # Basename used for .desktop, gnome-control-center xml and icon files. - fileBase = fileStem; - # Secondary .desktop app-id. - appId = appIdStem; - # Upstream shell wrapper inside /opt. - innerWrapper = fileStem; - # macOS .app bundle name (inside the zip). - darwinApp = darwinStem; - # Upstream Exec= target in .desktop files (replaced with our wrapper). - upstreamBin = "brave-${flavor}-stable"; - - deps = [ - alsa-lib - at-spi2-atk - at-spi2-core - atk - cairo - cups - dbus - expat - fontconfig - freetype - gdk-pixbuf - glib - gtk3 - gtk4 - libdrm - libx11 - libGL - libxkbcommon - libxscrnsaver - libxcomposite - libxcursor - libxdamage - libxext - libxfixes - libxi - libxrandr - libxrender - libxshmfence - libxtst - libuuid - libgbm - nspr - nss - pango - pciutils # ANGLE dlopens libpci to identify GPUs, including for VA-API device selection. - pipewire - udev - wayland - libxcb - zlib - snappy - speechd-minimal # Text-to-speech through speech-dispatcher (--enable-speech-dispatcher). - libkrb5 - vulkan-loader # Chromium and Dawn dlopen libvulkan.so.1 by name. - qt6.qtbase - ] - ++ optional pulseSupport libpulseaudio - ++ optional libvaSupport libva; - - rpath = makeLibraryPath deps + ":" + makeSearchPathOutput "lib" "lib64" deps; - binpath = makeBinPath deps; - - enableFeatures = - optionals enableVideoAcceleration [ - "AcceleratedVideoDecodeLinuxGL" - "AcceleratedVideoEncoder" - ] - ++ optional enableVulkan "Vulkan"; - - disableFeatures = [ - "OutdatedBuildDetector" - ] # disable automatic updates - # The feature disable is needed for VAAPI to work correctly: https://github.com/brave/brave-browser/issues/20935 - ++ optionals enableVideoAcceleration [ "UseChromeOSDirectVideoDecoder" ]; - - archive = - assert lib.assertMsg (builtins.hasAttr stdenv.hostPlatform.system archives) - "${pname} is not available for ${stdenv.hostPlatform.system}"; - archives.${stdenv.hostPlatform.system}; -in -stdenv.mkDerivation { - inherit pname version; - - __structuredAttrs = true; - strictDeps = true; - - src = fetchurl { inherit (archive) url hash; }; - - sourceRoot = lib.optionalString stdenv.hostPlatform.isDarwin "${darwinApp}.app"; - - dontConfigure = true; - dontBuild = true; - dontPatchELF = true; - dontStrip = stdenv.hostPlatform.isDarwin; - doInstallCheck = stdenv.hostPlatform.isLinux; - - nativeBuildInputs = - lib.optionals stdenv.hostPlatform.isLinux [ - dpkg - # override doesn't preserve splicing https://github.com/NixOS/nixpkgs/issues/132651 - # Has to use `makeShellWrapper` from `buildPackages` even though `makeShellWrapper` from the inputs is spliced because `propagatedBuildInputs` would pick the wrong one because of a different offset. - (buildPackages.wrapGAppsHook3.override { makeWrapper = buildPackages.makeShellWrapper; }) - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - undmg - makeWrapper - ]; - - buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ - # needed for GSETTINGS_SCHEMAS_PATH - glib - gsettings-desktop-schemas - gtk3 - gtk4 - - # needed for XDG_ICON_DIRS - adwaita-icon-theme - ]; - - installPhase = - lib.optionalString stdenv.hostPlatform.isLinux '' - runHook preInstall - - mkdir -p $out $out/bin - - cp -R usr/share $out - cp -R opt/ $out/opt - - export BINARYWRAPPER=$out/opt/brave.com/${optName}/${innerWrapper} - - # Fix path to bash in $BINARYWRAPPER - substituteInPlace $BINARYWRAPPER \ - --replace-fail /bin/bash ${stdenv.shell} \ - --replace-fail 'CHROME_WRAPPER' 'WRAPPER' - - ln -sf $BINARYWRAPPER $out/bin/${pname} - - for exe in $out/opt/brave.com/${optName}/{${innerBinary},chrome_crashpad_handler}; do - patchelf \ - --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - --set-rpath "${rpath}" $exe - done - - # Fix paths - substituteInPlace $out/share/applications/{${fileBase},${appId}}.desktop \ - --replace-fail /usr/bin/${upstreamBin} $out/bin/${pname} - substituteInPlace $out/share/gnome-control-center/default-apps/${fileBase}.xml \ - --replace-fail /opt/brave.com $out/opt/brave.com - substituteInPlace $out/opt/brave.com/${optName}/default-app-block \ - --replace-fail /opt/brave.com $out/opt/brave.com - - # Correct icons location - icon_sizes=("16" "24" "32" "48" "64" "128" "256") - - for icon in ''${icon_sizes[*]} - do - mkdir -p $out/share/icons/hicolor/''${icon}x''${icon}/apps - ln -s $out/opt/brave.com/${optName}/product_logo_''${icon}.png $out/share/icons/hicolor/''${icon}x''${icon}/apps/${fileBase}.png - done - - # ANGLE loads this copy by absolute path; the NixOS-patched loader finds ICDs - # under /run/opengl-driver, the bundled one does not. - rm $out/opt/brave.com/${optName}/libvulkan.so.1 - ln -s ${lib.getLib vulkan-loader}/lib/libvulkan.so.1 $out/opt/brave.com/${optName}/libvulkan.so.1 - - # Replace xdg-settings and xdg-mime - ln -sf ${xdg-utils}/bin/xdg-settings $out/opt/brave.com/${optName}/xdg-settings - ln -sf ${xdg-utils}/bin/xdg-mime $out/opt/brave.com/${optName}/xdg-mime - - runHook postInstall - '' - + lib.optionalString stdenv.hostPlatform.isDarwin '' - runHook preInstall - - mkdir -p $out/{Applications,bin} - - cp -r . "$out/Applications/${darwinApp}.app" - - makeWrapper "$out/Applications/${darwinApp}.app/Contents/MacOS/${darwinApp}" $out/bin/${pname} - - runHook postInstall - ''; - - preFixup = lib.optionalString stdenv.hostPlatform.isLinux '' - # Add command line args to wrapGApp. - gappsWrapperArgs+=( - --prefix LD_LIBRARY_PATH : ${rpath} - --prefix PATH : ${binpath} - --suffix PATH : ${ - lib.makeBinPath [ - xdg-utils - coreutils - ] - } - --set CHROME_WRAPPER ${pname} - ${optionalString (enableFeatures != [ ]) '' - --add-flags "--enable-features=${strings.concatStringsSep "," enableFeatures}\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+,WaylandWindowDecorations --enable-wayland-ime=true}}" - ''} - ${optionalString (disableFeatures != [ ]) '' - --add-flags "--disable-features=${strings.concatStringsSep "," disableFeatures}" - ''} - --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto}}" - --add-flags ${escapeShellArg commandLineArgs} - ) - ''; - - installCheckPhase = '' - # Bypass upstream wrapper which suppresses errors - $out/opt/brave.com/${optName}/brave --version - ''; - - meta = { - homepage = homepage; - description = - "Privacy-oriented browser for Desktop and Laptop computers" - + lib.optionalString (flavor == "origin") " (Origin variant)"; - changelog = - "https://github.com/brave/brave-browser/blob/master/${changelogFile}#" - + lib.replaceStrings [ "." ] [ "" ] version; - longDescription = - if flavor == "origin" then - '' - Brave Origin is a stripped-down variant of the Brave browser that - removes most non-privacy features (rewards, wallet, AI, etc.) while - keeping the core privacy, adblock and Chromium-based browsing - experience. - '' - else - '' - Brave browser blocks the ads and trackers that slow you down, - chew up your bandwidth, and invade your privacy. Brave lets you - contribute to your favorite creators automatically. - ''; - sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; - license = lib.licenses.mpl20; - platforms = builtins.attrNames archives; - mainProgram = if flavor == "origin" then "brave-origin" else "brave"; - }; -} diff --git a/nix-conf/pkgs/brave/sources.nix b/nix-conf/pkgs/brave/sources.nix deleted file mode 100644 index b09c1fb..0000000 --- a/nix-conf/pkgs/brave/sources.nix +++ /dev/null @@ -1,19 +0,0 @@ -# Updated by check-versions; keep the layout (one version line, one hash per platform). -rec { - version = "1.99.55"; - - archives = { - aarch64-linux = { - url = "https://github.com/brave/brave-browser/releases/download/v${version}/brave-browser_${version}_arm64.deb"; - hash = "sha256-r5nwaDDQllA/Zmezb/btbEVf7vUgPw0o/vTP065e4Qo="; - }; - x86_64-linux = { - url = "https://github.com/brave/brave-browser/releases/download/v${version}/brave-browser_${version}_amd64.deb"; - hash = "sha256-Nk6VSirYTVuj4OIXoinVhzxK5xB9FeYSDkIHUpU5yI0="; - }; - aarch64-darwin = { - url = "https://github.com/brave/brave-browser/releases/download/v${version}/Brave-Browser-arm64.dmg"; - hash = "sha256-Bd0wDZP2zHtWybW5XPutX6y9WmrowffQ1r4NFi+HCx0="; - }; - }; -} diff --git a/nix-conf/pkgs/scripts/check-versions.nix b/nix-conf/pkgs/scripts/check-versions.nix index 35aedc5..77436ab 100644 --- a/nix-conf/pkgs/scripts/check-versions.nix +++ b/nix-conf/pkgs/scripts/check-versions.nix @@ -7,7 +7,6 @@ let jq = lib.getExe pkgs.jq; mktemp = lib.getExe' pkgs.coreutils "mktemp"; mv = lib.getExe' pkgs.coreutils "mv"; - paste = lib.getExe' pkgs.coreutils "paste"; nix = lib.getExe pkgs.nix; sed = lib.getExe pkgs.gnused; seq = lib.getExe' pkgs.coreutils "seq"; @@ -36,7 +35,6 @@ pkgs.writeShellScriptBin "check-versions" '' flake_dir="''${flake_dir:-.}" overrides_file="$flake_dir/overlays/_version-overrides.nix" - brave_sources_file="$flake_dir/pkgs/brave/sources.nix" twg_package_file="$flake_dir/pkgs/twg-cli/default.nix" green=$'\033[32m' @@ -75,24 +73,7 @@ pkgs.writeShellScriptBin "check-versions" '' ${nix} hash convert --hash-algo sha256 --to sri "$(${nix}-prefetch-url --type sha256 "$1" ''${2:+--name "$2"} 2>/dev/null)" } - # Fetch every platform before changing a local package's version or hashes. - # Each *_sources function prints "key hash" lines. - - # brave: pair each system with its url template from sources.nix. - brave_sources() { - local version="$1" system url hash - [[ -f "$brave_sources_file" ]] || return 1 - while read -r system url; do - [[ -n "$system" && -n "$url" ]] || return 1 - url=$(echo "$url" | ${sed} 's/[$]{version}/'"$version"'/g') - hash=$(prefetch_sri "$url") || return 1 - [[ "$hash" =~ ^sha256-[A-Za-z0-9+/]{43}=$ ]] || return 1 - printf '%s %s\n' "$system" "$hash" - done < <(${paste} -d' ' \ - <(${sed} -n 's/^ \([a-z0-9_]*-[a-z]*\) = {$/\1/p' "$brave_sources_file") \ - <(${sed} -n 's/^ *url = "\(.*\)";$/\1/p' "$brave_sources_file")) - } - + # Fetch every platform before changing the local package's version or hashes. twg_sources() { local version="$1" platforms platform url hash platforms=$(${sed} -n 's/^ *platform = "\([^"]*\)";$/\1/p' "$twg_package_file") || return 1 @@ -115,7 +96,7 @@ pkgs.writeShellScriptBin "check-versions" '' [[ "$1" == "$2" ]] || [[ "$(printf '%s\n%s\n' "$1" "$2" | ${sort} -V | ${tail} -1)" == "$1" ]] } - # Update a field within a nested-style entry, e.g. update_field "slack.version" "1.0" + # Update a field within a nested-style entry, e.g. update_field "brave.version" "1.0" # Will be a no-op if the package is currently set to null. update_field() { local path="$1" value="$2" @@ -185,26 +166,27 @@ pkgs.writeShellScriptBin "check-versions" '' fi } + latest_brave=$(fetch_latest sh -c "${curl} -s 'https://api.github.com/repos/brave/brave-browser/releases/latest' | ${jq} -r '.tag_name | ltrimstr(\"v\")'") latest_chrome=$(fetch_latest sh -c "${curl} -s 'https://versionhistory.googleapis.com/v1/chrome/platforms/mac_arm64/channels/stable/versions/all/releases?filter=endtime=none,fraction%3E=0.5&order_by=version%20desc' | ${jq} -r '.releases[0].version'") latest_firefox=$(fetch_latest sh -c "${curl} -s https://archive.mozilla.org/pub/firefox/releases/ | ${grep} -oP '[0-9]+\.[0-9.]+(?=/)' | ${sort} -t. -k1,1n -k2,2n -k3,3n | ${tail} -1") latest_orbstack=$(fetch_latest sh -c "${curl} -L -I -s 'https://orbstack.dev/download/stable/latest/arm64' | ${grep} -oE 'OrbStack_v[0-9._]+_arm64' | ${sed} 's/OrbStack_v//;s/_arm64//;s/_/-/'") latest_slack=$(fetch_latest sh -c "${curl} -s 'https://slack.com/api/desktop.latestRelease?arch=arm64&variant=dmg' | ${jq} -r .version") latest_zoom=$(fetch_latest sh -c "${curl} -Ls 'https://zoom.us/rest/download?os=mac' | ${jq} -r '.result.downloadVO.zoomArm64.version'") - latest_brave=$(fetch_latest sh -c "${curl} -s 'https://api.github.com/repos/brave/brave-browser/releases/latest' | ${jq} -r '.tag_name | ltrimstr(\"v\")'") latest_twg=$(fetch_latest sh -c "${curl} -fsSL --max-time 30 'https://teamwork-graph.atlassian.com/cli/manifest.json' | ${jq} -er '.version | select(type == \"string\") | select(test(\"^[0-9]+[.][0-9]+[.][0-9]+$\"))'") + nixpkgs_brave=$(nix_ver nixpkgs#brave.version) nixpkgs_chrome=$(nix_ver nixpkgs#google-chrome.version) nixpkgs_firefox=$(nix_ver nixpkgs#firefox.version) nixpkgs_orbstack=$(nix_ver nixpkgs#orbstack.version) nixpkgs_slack=$(nix_ver nixpkgs#slack.version) nixpkgs_zoom=$(nix_ver nixpkgs#zoom-us.version) + local_brave=$(nix_ver "''${flake_dir}#modifications.brave.version") local_chrome=$(nix_ver "''${flake_dir}#modifications.google-chrome.version") local_firefox=$(nix_ver "''${flake_dir}#modifications.firefox.version") local_orbstack=$(nix_ver "''${flake_dir}#modifications.orbstack.version") local_slack=$(nix_ver "''${flake_dir}#modifications.slack.version") local_zoom=$(nix_ver "''${flake_dir}#modifications.zoom-us.version") - local_brave=$(fetch_latest ${sed} -n 's/^ version = "\([^"]*\)";$/\1/p' "$brave_sources_file") local_twg=$(fetch_latest ${sed} -n 's/^ version = "\([^"]*\)";$/\1/p' "$twg_package_file") w=18 @@ -253,22 +235,22 @@ pkgs.writeShellScriptBin "check-versions" '' hline '┌' '┬' '┐' header hline '├' '┼' '┤' + row brave "$nixpkgs_brave" "$local_brave" "$latest_brave" row chrome "$nixpkgs_chrome" "$local_chrome" "$latest_chrome" row firefox "$nixpkgs_firefox" "$local_firefox" "$latest_firefox" row orbstack "$nixpkgs_orbstack" "$local_orbstack" "$latest_orbstack" row slack "$nixpkgs_slack" "$local_slack" "$latest_slack" row zoom "$nixpkgs_zoom" "$local_zoom" "$latest_zoom" - row brave "-" "$local_brave" "$latest_brave" row twg-cli "-" "$local_twg" "$latest_twg" hline '└' '┴' '┘' declare -a outdated=() + should_update "$local_brave" "$latest_brave" && outdated+=(brave) should_update "$local_chrome" "$latest_chrome" && outdated+=(chrome) should_update "$local_firefox" "$latest_firefox" && outdated+=(firefox) should_update "$local_orbstack" "$latest_orbstack" && outdated+=(orbstack) should_update "$local_slack" "$latest_slack" && outdated+=(slack) should_update "$local_zoom" "$latest_zoom" && outdated+=(zoom) - should_update "$local_brave" "$latest_brave" && outdated+=(brave) should_update "$local_twg" "$latest_twg" && outdated+=(twg) # Compute auto-null candidates: active overrides where nixpkgs has caught up. @@ -292,6 +274,7 @@ pkgs.writeShellScriptBin "check-versions" '' version_ge "$nixpkgs_v" "$ov" && version_ge "$nixpkgs_v" "$latest_v" } if [[ "$mode" != "check" && "$mode" != "force" ]]; then + should_null brave brave && to_null+=(brave) should_null chrome google-chrome && to_null+=(chrome) should_null firefox firefox && to_null+=(firefox) should_null orbstack orbstack && to_null+=(orbstack) @@ -316,6 +299,13 @@ pkgs.writeShellScriptBin "check-versions" '' if [[ "$mode" == "check" ]]; then for pkg in "''${outdated[@]}"; do case "$pkg" in + brave) + echo "" + echo "''${bold}brave ''${latest_brave}:''${reset}" + brave_url="https://github.com/brave/brave-browser/releases/download/v''${latest_brave}/Brave-Browser-arm64.dmg" + echo " ''${dim}url: $brave_url''${reset}" + echo " ''${dim}hash: $(prefetch_sri "$brave_url")''${reset}" + ;; chrome) echo "" echo "''${bold}chrome ''${latest_chrome}:''${reset}" @@ -354,11 +344,6 @@ pkgs.writeShellScriptBin "check-versions" '' echo " ''${dim}url: $zoom_url''${reset}" echo " ''${dim}hash: $(prefetch_sri "$zoom_url" zoomusInstallerFull.pkg)''${reset}" ;; - brave) - echo "" - echo "''${bold}brave ''${latest_brave}:''${reset}" - brave_sources "$latest_brave" || { echo "error: could not fetch brave sources" >&2; exit 1; } - ;; twg) echo "" echo "''${bold}twg-cli ''${latest_twg}:''${reset}" @@ -409,6 +394,13 @@ pkgs.writeShellScriptBin "check-versions" '' for pkg in "''${outdated[@]}"; do case "$pkg" in + brave) + echo "" + echo "''${bold}brave''${reset}: $local_brave -> ''${green}$latest_brave''${reset}" + brave_url="https://github.com/brave/brave-browser/releases/download/v''${latest_brave}/Brave-Browser-arm64.dmg" + brave_hash=$(prefetch_sri "$brave_url") + write_entry "brave" "version" "$latest_brave" "hash" "$brave_hash" + ;; chrome) echo "" echo "''${bold}chrome''${reset}: $local_chrome -> ''${green}$latest_chrome''${reset}" @@ -448,20 +440,6 @@ pkgs.writeShellScriptBin "check-versions" '' zoom_hash=$(prefetch_sri "$zoom_url" zoomusInstallerFull.pkg) write_entry "zoom-us" "version" "$latest_zoom" "hash" "$zoom_hash" ;; - brave) - echo "" - echo "''${bold}brave''${reset}: $local_brave -> ''${green}$latest_brave''${reset}" - sources=$(brave_sources "$latest_brave") || { echo "error: could not fetch brave sources" >&2; exit 1; } - declare -a brave_edits=(-e "s|^ version = \"[^\"]*\";| version = \"$latest_brave\";|") - while read -r system hash; do - brave_edits+=(-e "/^ $system = {/,/^ };/ s|^\( *hash = \)\"[^\"]*\";|\1\"$hash\";|") - done <<< "$sources" - sources_tmp=$(${mktemp} "$brave_sources_file.XXXXXX") || exit 1 - ${sed} "''${brave_edits[@]}" "$brave_sources_file" > "$sources_tmp" && - ${chmod} --reference="$brave_sources_file" "$sources_tmp" && - ${mv} "$sources_tmp" "$brave_sources_file" || exit 1 - echo "''${green}Updated $brave_sources_file''${reset}" - ;; twg) echo "" echo "''${bold}twg-cli''${reset}: $local_twg -> ''${green}$latest_twg''${reset}" @@ -481,6 +459,7 @@ pkgs.writeShellScriptBin "check-versions" '' for pkg in "''${to_null[@]}"; do case "$pkg" in + brave) key=brave ;; chrome) key=google-chrome ;; firefox) key=firefox ;; orbstack) key=orbstack ;; |