aboutsummaryrefslogtreecommitdiffstats
path: root/nix-conf
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2026-11-05 09:49:34 +0000
committerDavid Morgan <djm_uk@protonmail.com>2026-11-05 09:49:34 +0000
commitb900377bb3774e3cc0d8e1ecd3918a4a1fca302e (patch)
treeac9f7582ff4d00efd8aa98df8dc1f3c798a01038 /nix-conf
parent20242e347cb1a0841ccebae435e08b42c39a3103 (diff)
downloaddotfiles-b900377bb3774e3cc0d8e1ecd3918a4a1fca302e.tar.gz
Update local versions and create local brave derivation
Brave was removed from nixpkgs, so add it to the packages overlay
Diffstat (limited to 'nix-conf')
-rw-r--r--nix-conf/flake.lock20
-rw-r--r--nix-conf/overlays/_version-overrides.nix8
-rw-r--r--nix-conf/overlays/modifications.nix14
-rw-r--r--nix-conf/pkgs/brave/default.nix346
-rw-r--r--nix-conf/pkgs/brave/sources.nix19
-rw-r--r--nix-conf/pkgs/scripts/check-versions.nix67
-rw-r--r--nix-conf/pkgs/twg-cli/default.nix8
7 files changed, 425 insertions, 57 deletions
diff --git a/nix-conf/flake.lock b/nix-conf/flake.lock
index e68da23..58f6afb 100644
--- a/nix-conf/flake.lock
+++ b/nix-conf/flake.lock
@@ -143,11 +143,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
- "lastModified": 1793791834,
- "narHash": "sha256-UrfZHIqHuVa96v4sxHGekGIU32MOhD7xfOjHJCF/h98=",
+ "lastModified": 1793859612,
+ "narHash": "sha256-DDsPI44qOjlRdnWbaVlcU5iwUPfadigR4oUrVWq2G0I=",
"owner": "numtide",
"repo": "llm-agents.nix",
- "rev": "e13c1ed201c998aa73aef33233514cb2bf3a881d",
+ "rev": "499fb79f92064e92cdb968d12ffeb92d36243b50",
"type": "github"
},
"original": {
@@ -199,11 +199,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1793345420,
- "narHash": "sha256-e/yiZ31gXRROBDcnOtT3YwDQ73NVG9Cepccbt86LIn8=",
+ "lastModified": 1793795574,
+ "narHash": "sha256-pgG/CO+txdf2sA2z6DsM+2G3F9ajfIp/3BMC4wfKMDY=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "885ba4d038f10c3d17d7a92e8c3cc185b99c9158",
+ "rev": "13e53762c5afaf384d4614e94527a9ccfafe41d0",
"type": "github"
},
"original": {
@@ -244,11 +244,11 @@
},
"nixpkgs-unstable": {
"locked": {
- "lastModified": 1793735720,
- "narHash": "sha256-WqewjvVjGQ1yhAvxeZW7IKoIT08vUNfyaeZewOwyYxg=",
- "rev": "9d3b8db48266c17be0b5f9c6360c3ecfbac3d1f5",
+ "lastModified": 1793795574,
+ "narHash": "sha256-ey4jOibbc003QnvG+D7j8S5w2m33vf0S800hWUMoDOI=",
+ "rev": "13e53762c5afaf384d4614e94527a9ccfafe41d0",
"type": "tarball",
- "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.11pre1107841.9d3b8db48266/nixexprs.tar.zst"
+ "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.11pre1108269.13e53762c5af/nixexprs.tar.zst"
},
"original": {
"id": "nixpkgs",
diff --git a/nix-conf/overlays/_version-overrides.nix b/nix-conf/overlays/_version-overrides.nix
index 7fc9fd0..bd695a6 100644
--- a/nix-conf/overlays/_version-overrides.nix
+++ b/nix-conf/overlays/_version-overrides.nix
@@ -1,11 +1,5 @@
{
- brave = null;
-
- google-chrome = {
- version = "157.0.8103.39";
- slug = "lj4mgpdwdwirchvgzajx46etji";
- hash = "sha256-xM2afDW2CuBd238ew/zkkRY24brQysuZ4aLqH/IBMQU=";
- };
+ google-chrome = null;
firefox = null;
diff --git a/nix-conf/overlays/modifications.nix b/nix-conf/overlays/modifications.nix
index 2a14879..efda55f 100644
--- a/nix-conf/overlays/modifications.nix
+++ b/nix-conf/overlays/modifications.nix
@@ -38,19 +38,7 @@ in
prev.git-remote-codecommit;
}
// prev.lib.optionalAttrs prev.stdenv.hostPlatform.isDarwin (
- 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) {
+ 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
new file mode 100644
index 0000000..b932939
--- /dev/null
+++ b/nix-conf/pkgs/brave/default.nix
@@ -0,0 +1,346 @@
+# 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
new file mode 100644
index 0000000..0feb959
--- /dev/null
+++ b/nix-conf/pkgs/brave/sources.nix
@@ -0,0 +1,19 @@
+# Updated by check-versions; keep the layout (one version line, one hash per platform).
+rec {
+ version = "1.98.63";
+
+ archives = {
+ aarch64-linux = {
+ url = "https://github.com/brave/brave-browser/releases/download/v${version}/brave-browser_${version}_arm64.deb";
+ hash = "sha256-jQtKAVXCgQ7JwuK3VRWbmieL1R+50Nd2ynrE9C4MwvM=";
+ };
+ x86_64-linux = {
+ url = "https://github.com/brave/brave-browser/releases/download/v${version}/brave-browser_${version}_amd64.deb";
+ hash = "sha256-JCJ81aklnr3FEI2zlMxZmN9aw2NfhPiDinRkp7XN3VU=";
+ };
+ aarch64-darwin = {
+ url = "https://github.com/brave/brave-browser/releases/download/v${version}/Brave-Browser-arm64.dmg";
+ hash = "sha256-13XmtzqQIFTu3gj2aeIFDtbDaRJfhLbEsKd0biTBV7k=";
+ };
+ };
+}
diff --git a/nix-conf/pkgs/scripts/check-versions.nix b/nix-conf/pkgs/scripts/check-versions.nix
index 77436ab..35aedc5 100644
--- a/nix-conf/pkgs/scripts/check-versions.nix
+++ b/nix-conf/pkgs/scripts/check-versions.nix
@@ -7,6 +7,7 @@ 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";
@@ -35,6 +36,7 @@ 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'
@@ -73,7 +75,24 @@ 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 the local package's version or hashes.
+ # 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"))
+ }
+
twg_sources() {
local version="$1" platforms platform url hash
platforms=$(${sed} -n 's/^ *platform = "\([^"]*\)";$/\1/p' "$twg_package_file") || return 1
@@ -96,7 +115,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 "brave.version" "1.0"
+ # Update a field within a nested-style entry, e.g. update_field "slack.version" "1.0"
# Will be a no-op if the package is currently set to null.
update_field() {
local path="$1" value="$2"
@@ -166,27 +185,26 @@ 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
@@ -235,22 +253,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.
@@ -274,7 +292,6 @@ 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)
@@ -299,13 +316,6 @@ 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}"
@@ -344,6 +354,11 @@ 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}"
@@ -394,13 +409,6 @@ 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}"
@@ -440,6 +448,20 @@ 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}"
@@ -459,7 +481,6 @@ 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 ;;
diff --git a/nix-conf/pkgs/twg-cli/default.nix b/nix-conf/pkgs/twg-cli/default.nix
index 0f09a2f..2dfeb86 100644
--- a/nix-conf/pkgs/twg-cli/default.nix
+++ b/nix-conf/pkgs/twg-cli/default.nix
@@ -10,22 +10,22 @@ let
sources = {
aarch64-darwin = {
platform = "darwin-arm64";
- hash = "sha256-W/CvcAB1NllVrU+Nkpc6ggCPbCs/fmB+OaZHBXs0B4Q=";
+ hash = "sha256-xb3e8N+QBA3hwJT6VKNv/0wh5ftQcesanUWPsZIsr2I=";
};
aarch64-linux = {
platform = "linux-arm64";
- hash = "sha256-xb0h6pTqqVRGiXse7gcrOK9g2iyIBWEgriKUqt558sA=";
+ hash = "sha256-usXYshnfHyp7px+X8d9sukXlsvErI1/euXO3YxJuPpY=";
};
x86_64-linux = {
platform = "linux-x64";
- hash = "sha256-CGZixqoNnj2GyfLwABFbjMJI1jFSqx+T4iLpVRXQUgA=";
+ hash = "sha256-+GRY9D76pTMrvukNU1ZD/fbcETmC4nJje9//FRL1lKE=";
};
};
source = sources.${stdenvNoCC.hostPlatform.system};
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "twg-cli";
- version = "1.4.2";
+ version = "1.4.3";
src = fetchurl {
url = "https://teamwork-graph.atlassian.com/cli/twg-${source.platform}-v${finalAttrs.version}";