tabby icon indicating copy to clipboard operation
tabby copied to clipboard

packaging: plz consider adding feature "vendored" to tabby dep "utoipa-swagger-ui"

Open LucaFulchir opened this issue 7 months ago • 1 comments

I am a user of tabby on NixOS, I manage my own package to stay more up to date.

Things worked fine for v0.28, but today I tried upgrading my package to v0.29.

Since Nix packages try to be reproducible and track all hashes of the dependencies and builds, they split the part where the dependencies are downloaded from the actual build.

However now utoipa-swagger-ui tries to download things during the build phase, because crates/tabby/Cargo.toml does not have vendored in the features for utoipa-swagger-ui.
This fails because in nix the build phase does not have internet access on purpose.

This can definitely be patched before building&packaging, but if it does not give you problems please consider adding the feature to allow for easier packaging.

Note that I have no idea how tabby or utoipa-swagger-ui work inside, so I don't know the ramifications of the choice.

LucaFulchir avatar Jun 04 '25 15:06 LucaFulchir

Ran into this issue today as well. Current workaround in case it helps anyone else:

let
  overlayRustPackage = {
    final,
    prev,
    old,
    new ? old,
    override,
  }: {
    ${new} = final.callPackage prev.${old}.override {
      rustPlatform =
        final.rustPlatform
        // {
          buildRustPackage = args:
            final.rustPlatform.buildRustPackage (
              args
              // (override args)
            );
        };
    };
  };
in {
  overlays = [
    (final: prev:
      overlayRustPackage {
        inherit final prev;
        old = "tabby";
        override = args: rec {
          version = "0.30.1";
          src = prev.fetchFromGitHub {
            owner = "TabbyML";
            repo = "tabby";
            tag = "v${version}";
            hash = "sha256-ZkTskQ8JwL/83id2cXdnaYTdOdujJhY4XujoVaVb1Xw=";
            fetchSubmodules = true;
          };
          cargoHash = "sha256-4rJsaTJGH9sOkCdWt2ERjc90Zob1u8Uwmso2AHSkzro=";
          VERGEN_BUILD_DATE = "2025-07-28";
          VERGEN_BUILD_TIMESTAMP = 0;
          VERGEN_GIT_SHA = src.tag;
          SWAGGER_UI_DOWNLOAD_URL = let
            swaggerUi = prev.fetchurl {
              url = "https://github.com/swagger-api/swagger-ui/archive/refs/tags/v5.17.14.zip";
              hash = "sha256-SBJE0IEgl7Efuu73n3HZQrFxYX+cn5UU5jrL4T5xzNw=";
            };
          in "file://${swaggerUi}";
        };
      })
  ];
}

johnnywalker avatar Jul 28 '25 20:07 johnnywalker