aboutsummaryrefslogtreecommitdiffstats
path: root/nix-conf
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2026-11-04 14:16:11 +0000
committerDavid Morgan <djm_uk@protonmail.com>2026-11-04 14:16:11 +0000
commit20242e347cb1a0841ccebae435e08b42c39a3103 (patch)
tree7ba05845a69ff40b8ffd0864b360e2b80d1b3cc8 /nix-conf
parente83e94c2eb380b662cfddd1fcb5a3dddcc98cf11 (diff)
downloaddotfiles-20242e347cb1a0841ccebae435e08b42c39a3103.tar.gz
Add twg-cli
Diffstat (limited to 'nix-conf')
-rw-r--r--nix-conf/flake.lock14
-rw-r--r--nix-conf/hosts/home-manager/modules/orgs/kevel/default.nix1
-rw-r--r--nix-conf/nix.nix1
-rw-r--r--nix-conf/overlays/_version-overrides.nix10
-rw-r--r--nix-conf/pkgs/scripts/check-versions.nix45
-rw-r--r--nix-conf/pkgs/twg-cli/default.nix67
6 files changed, 121 insertions, 17 deletions
diff --git a/nix-conf/flake.lock b/nix-conf/flake.lock
index a8959f5..e68da23 100644
--- a/nix-conf/flake.lock
+++ b/nix-conf/flake.lock
@@ -143,11 +143,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
- "lastModified": 1793780669,
- "narHash": "sha256-6Gw3SLIXUr1AqakdcPdql07LdIwsXs/IdvOOJ1aljNw=",
+ "lastModified": 1793791834,
+ "narHash": "sha256-UrfZHIqHuVa96v4sxHGekGIU32MOhD7xfOjHJCF/h98=",
"owner": "numtide",
"repo": "llm-agents.nix",
- "rev": "38235de70aec5e5ca95070e8e020be0f31cd8c03",
+ "rev": "e13c1ed201c998aa73aef33233514cb2bf3a881d",
"type": "github"
},
"original": {
@@ -244,11 +244,11 @@
},
"nixpkgs-unstable": {
"locked": {
- "lastModified": 1793706278,
- "narHash": "sha256-iCbwhLa+h23/rxGQD9YJJ+BrMYHCPKB6au/BsobNWB4=",
- "rev": "ea9e3ef341e11c193537f674f821a99f9f436729",
+ "lastModified": 1793735720,
+ "narHash": "sha256-WqewjvVjGQ1yhAvxeZW7IKoIT08vUNfyaeZewOwyYxg=",
+ "rev": "9d3b8db48266c17be0b5f9c6360c3ecfbac3d1f5",
"type": "tarball",
- "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.11pre1107593.ea9e3ef341e1/nixexprs.tar.zst"
+ "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.11pre1107841.9d3b8db48266/nixexprs.tar.zst"
},
"original": {
"id": "nixpkgs",
diff --git a/nix-conf/hosts/home-manager/modules/orgs/kevel/default.nix b/nix-conf/hosts/home-manager/modules/orgs/kevel/default.nix
index d08362c..0484ea8 100644
--- a/nix-conf/hosts/home-manager/modules/orgs/kevel/default.nix
+++ b/nix-conf/hosts/home-manager/modules/orgs/kevel/default.nix
@@ -54,6 +54,7 @@ in
sqlcmd
tailscale
terraform
+ twg-cli
typescript-language-server
]
++ (with inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}; [
diff --git a/nix-conf/nix.nix b/nix-conf/nix.nix
index b93471a..6192630 100644
--- a/nix-conf/nix.nix
+++ b/nix-conf/nix.nix
@@ -19,6 +19,7 @@
"orbstack"
"slack"
"terraform"
+ "twg-cli"
"vscode"
"zoom"
];
diff --git a/nix-conf/overlays/_version-overrides.nix b/nix-conf/overlays/_version-overrides.nix
index 321b291..7fc9fd0 100644
--- a/nix-conf/overlays/_version-overrides.nix
+++ b/nix-conf/overlays/_version-overrides.nix
@@ -7,10 +7,7 @@
hash = "sha256-xM2afDW2CuBd238ew/zkkRY24brQysuZ4aLqH/IBMQU=";
};
- firefox = {
- version = "159.0.1";
- sha512 = "2j2gwnqsrk3l6b0nk8riq8zj9n0klxxk5kbj6z5dw880vlfkd1q76b41bdrxxvy5prlp9lhf0pb487zlkvdavrf3px246rn3065qdz7";
- };
+ firefox = null;
orbstack = {
version = "2.2.5-21124";
@@ -22,8 +19,5 @@
hash = "sha256-yKMpp0U2OD+4BGVXQO9xeWUuh0Sd4ljxqMpd/11m2/Q=";
};
- zoom-us = {
- version = "7.2.5.90525";
- hash = "sha256-TCbr7YvSnOJYrJ2+Dysyf60KBzQkbqWIM5osxf0QUz4=";
- };
+ zoom-us = null;
}
diff --git a/nix-conf/pkgs/scripts/check-versions.nix b/nix-conf/pkgs/scripts/check-versions.nix
index 0dd7f30..77436ab 100644
--- a/nix-conf/pkgs/scripts/check-versions.nix
+++ b/nix-conf/pkgs/scripts/check-versions.nix
@@ -1,9 +1,12 @@
{ lib, pkgs }:
let
+ chmod = lib.getExe' pkgs.coreutils "chmod";
curl = lib.getExe pkgs.curl;
grep = lib.getExe pkgs.gnugrep;
jq = lib.getExe pkgs.jq;
+ mktemp = lib.getExe' pkgs.coreutils "mktemp";
+ mv = lib.getExe' pkgs.coreutils "mv";
nix = lib.getExe pkgs.nix;
sed = lib.getExe pkgs.gnused;
seq = lib.getExe' pkgs.coreutils "seq";
@@ -32,6 +35,7 @@ pkgs.writeShellScriptBin "check-versions" ''
flake_dir="''${flake_dir:-.}"
overrides_file="$flake_dir/overlays/_version-overrides.nix"
+ twg_package_file="$flake_dir/pkgs/twg-cli/default.nix"
green=$'\033[32m'
yellow=$'\033[33m'
@@ -69,6 +73,19 @@ 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.
+ twg_sources() {
+ local version="$1" platforms platform url hash
+ platforms=$(${sed} -n 's/^ *platform = "\([^"]*\)";$/\1/p' "$twg_package_file") || return 1
+ [[ -n "$platforms" ]] || return 1
+ for platform in $platforms; do
+ url="https://teamwork-graph.atlassian.com/cli/twg-$platform-v$version"
+ hash=$(prefetch_sri "$url") || return 1
+ [[ "$hash" =~ ^sha256-[A-Za-z0-9+/]{43}=$ ]] || return 1
+ printf '%s %s\n' "$platform" "$hash"
+ done
+ }
+
color_ver() {
local ver="$1" latest="$2" width="$3" color="$4"
printf '%b%-*s%b' "$color" "$width" "$ver" "$reset"
@@ -155,6 +172,7 @@ pkgs.writeShellScriptBin "check-versions" ''
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_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)
@@ -169,6 +187,7 @@ pkgs.writeShellScriptBin "check-versions" ''
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_twg=$(fetch_latest ${sed} -n 's/^ version = "\([^"]*\)";$/\1/p' "$twg_package_file")
w=18
@@ -198,7 +217,8 @@ pkgs.writeShellScriptBin "check-versions" ''
else local_color="$red"
fi
# Color for nixpkgs
- if [[ "$nixpkgs" == "error" ]]; then nixpkgs_color="$red"
+ if [[ "$nixpkgs" == "-" ]]; then nixpkgs_color="$dim"
+ elif [[ "$nixpkgs" == "error" ]]; then nixpkgs_color="$red"
elif [[ "$nixpkgs" == "$latest" ]]; then nixpkgs_color="$green"
elif version_ge "$nixpkgs" "$latest"; then nixpkgs_color="$blue"
elif version_ge "$local_v" "$latest"; then nixpkgs_color="$yellow"
@@ -221,6 +241,7 @@ pkgs.writeShellScriptBin "check-versions" ''
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 twg-cli "-" "$local_twg" "$latest_twg"
hline '└' '┴' '┘'
declare -a outdated=()
@@ -230,6 +251,7 @@ pkgs.writeShellScriptBin "check-versions" ''
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_twg" "$latest_twg" && outdated+=(twg)
# Compute auto-null candidates: active overrides where nixpkgs has caught up.
# Skipped in check mode (would need to read the file) and force mode (force is
@@ -322,6 +344,11 @@ pkgs.writeShellScriptBin "check-versions" ''
echo " ''${dim}url: $zoom_url''${reset}"
echo " ''${dim}hash: $(prefetch_sri "$zoom_url" zoomusInstallerFull.pkg)''${reset}"
;;
+ twg)
+ echo ""
+ echo "''${bold}twg-cli ''${latest_twg}:''${reset}"
+ twg_sources "$latest_twg" || { echo "error: could not fetch TWG sources" >&2; exit 1; }
+ ;;
esac
done
exit 0
@@ -413,6 +440,20 @@ pkgs.writeShellScriptBin "check-versions" ''
zoom_hash=$(prefetch_sri "$zoom_url" zoomusInstallerFull.pkg)
write_entry "zoom-us" "version" "$latest_zoom" "hash" "$zoom_hash"
;;
+ twg)
+ echo ""
+ echo "''${bold}twg-cli''${reset}: $local_twg -> ''${green}$latest_twg''${reset}"
+ sources=$(twg_sources "$latest_twg") || { echo "error: could not fetch TWG sources" >&2; exit 1; }
+ declare -a twg_edits=(-e "s|^ version = \"[^\"]*\";| version = \"$latest_twg\";|")
+ while read -r platform hash; do
+ twg_edits+=(-e "/^ *platform = \"$platform\";/,/^ *};/ s|^\( *hash = \)\"[^\"]*\";|\1\"$hash\";|")
+ done <<< "$sources"
+ sources_tmp=$(${mktemp} "$twg_package_file.XXXXXX") || exit 1
+ ${sed} "''${twg_edits[@]}" "$twg_package_file" > "$sources_tmp" &&
+ ${chmod} --reference="$twg_package_file" "$sources_tmp" &&
+ ${mv} "$sources_tmp" "$twg_package_file" || exit 1
+ echo "''${green}Updated $twg_package_file''${reset}"
+ ;;
esac
done
@@ -431,5 +472,5 @@ pkgs.writeShellScriptBin "check-versions" ''
done
echo ""
- echo "''${green}Updated $overrides_file''${reset}"
+ echo "''${green}Updated selected package versions.''${reset}"
''
diff --git a/nix-conf/pkgs/twg-cli/default.nix b/nix-conf/pkgs/twg-cli/default.nix
new file mode 100644
index 0000000..0f09a2f
--- /dev/null
+++ b/nix-conf/pkgs/twg-cli/default.nix
@@ -0,0 +1,67 @@
+{
+ lib,
+ stdenvNoCC,
+ fetchurl,
+ autoPatchelfHook,
+ versionCheckHook,
+}:
+
+let
+ sources = {
+ aarch64-darwin = {
+ platform = "darwin-arm64";
+ hash = "sha256-W/CvcAB1NllVrU+Nkpc6ggCPbCs/fmB+OaZHBXs0B4Q=";
+ };
+ aarch64-linux = {
+ platform = "linux-arm64";
+ hash = "sha256-xb0h6pTqqVRGiXse7gcrOK9g2iyIBWEgriKUqt558sA=";
+ };
+ x86_64-linux = {
+ platform = "linux-x64";
+ hash = "sha256-CGZixqoNnj2GyfLwABFbjMJI1jFSqx+T4iLpVRXQUgA=";
+ };
+ };
+ source = sources.${stdenvNoCC.hostPlatform.system};
+in
+stdenvNoCC.mkDerivation (finalAttrs: {
+ pname = "twg-cli";
+ version = "1.4.2";
+
+ src = fetchurl {
+ url = "https://teamwork-graph.atlassian.com/cli/twg-${source.platform}-v${finalAttrs.version}";
+ inherit (source) hash;
+ };
+
+ dontUnpack = true;
+ dontBuild = true;
+ # Stripping removes the JavaScript payload embedded in the Bun executable.
+ dontStrip = true;
+
+ nativeBuildInputs = lib.optionals stdenvNoCC.hostPlatform.isLinux [ autoPatchelfHook ];
+
+ # Bun's localeCompare uses the system ICU data on macOS.
+ sandboxProfile = lib.optionalString stdenvNoCC.hostPlatform.isDarwin ''
+ (allow file-read* (subpath "/usr/share/icu"))
+ '';
+
+ installPhase = ''
+ runHook preInstall
+
+ install -Dm755 "$src" "$out/bin/twg"
+
+ runHook postInstall
+ '';
+
+ nativeInstallCheckInputs = [ versionCheckHook ];
+ doInstallCheck = true;
+ versionCheckProgramArg = "--version";
+
+ meta = {
+ description = "Command-line interface for Atlassian Teamwork Graph";
+ homepage = "https://github.com/atlassian/twg-cli";
+ license = lib.licenses.unfree;
+ sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
+ mainProgram = "twg";
+ platforms = lib.attrNames sources;
+ };
+})