Make clawdbot-gateway build offline + enable Garnix packages

This commit is contained in:
DJTBOT 2026-01-07 10:55:49 +01:00
parent 9c0986749b
commit ff62306bd9
3 changed files with 32 additions and 4 deletions

View File

@ -1,5 +1,5 @@
{
description = "nix-clawdbot: declarative Clawdbot packaging for macOS";
description = "nix-clawdbot: declarative Clawdbot packaging";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@ -35,7 +35,7 @@
clawdbot = flake-utils.lib.mkApp { drv = pkgs.clawdbot-gateway; };
};
checks = pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin {
checks = {
gateway = pkgs.clawdbot-gateway;
};

View File

@ -1,3 +1,4 @@
builds:
include:
- "checks.aarch64-darwin.*"
- "packages.*"
- "checks.*"

View File

@ -7,6 +7,7 @@
, python3
, makeWrapper
, vips
, zstd
, sourceInfo
, gatewaySrc ? null
, pnpmDepsHash ? null
@ -14,6 +15,11 @@
assert gatewaySrc == null || pnpmDepsHash != null;
let
pnpmPlatform = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";
pnpmArch = if stdenv.hostPlatform.isAarch64 then "arm64" else "x64";
in
stdenv.mkDerivation (finalAttrs: {
pname = "clawdbot-gateway";
version = "2.0.0-beta4";
@ -31,10 +37,10 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
nodejs_22
pnpm_10
pnpm_10.configHook
pkg-config
python3
makeWrapper
zstd
];
buildInputs = [ vips ];
@ -42,11 +48,32 @@ stdenv.mkDerivation (finalAttrs: {
env = {
SHARP_FORCE_GLOBAL_LIBVIPS = "1";
npm_config_build_from_source = "true";
npm_config_arch = pnpmArch;
npm_config_platform = pnpmPlatform;
PNPM_CONFIG_MANAGE_PACKAGE_MANAGER_VERSIONS = "false";
};
preBuild = ''
export HOME=$(mktemp -d)
export STORE_PATH=$(mktemp -d)
fetcherVersion=$(cat "${finalAttrs.pnpmDeps}/.fetcher-version" || echo 1)
if [ "$fetcherVersion" -ge 3 ]; then
tar --zstd -xf "${finalAttrs.pnpmDeps}/pnpm-store.tar.zst" -C "$STORE_PATH"
else
cp -Tr "${finalAttrs.pnpmDeps}" "$STORE_PATH"
fi
chmod -R +w "$STORE_PATH"
pnpm config set store-dir "$STORE_PATH"
pnpm config set package-import-method clone-or-copy
'';
buildPhase = ''
runHook preBuild
pnpm install --offline --frozen-lockfile
patchShebangs node_modules/{*,.*}
pnpm build
pnpm ui:build
runHook postBuild