This commit is contained in:
death916 2025-05-15 04:06:44 -07:00
parent e87ec79145
commit d6d4fbd65f

View file

@ -17,19 +17,18 @@ stdenv.mkDerivation rec {
"tmuxai_Linux_arm64.tar.gz"
else throw "Unsupported platform for tmuxai precompiled binary: ${stdenv.hostPlatform.system}";
# These MUST be the SRI formatted hashes obtained from nix-prefetch-url
srcHash = if stdenv.isLinux && stdenv.hostPlatform.isx86_64 then
"sha256-kWs5Cig9QV+dMD/XBcwWJALtBx1hbb52IOpoO0nCik4="
"sha256-kWs5Cig9QV+dMD/XBcwWJALtBx1hbb52IOpoO0nCik4=" # Example SRI for Linux amd64
else if stdenv.isLinux && stdenv.hostPlatform.isAarch64 then
"sha256-kWs5Cig9QV+dMD/XBcwWJALtBx1hbb52IOpoO0nCik4="
"sha256-WHcM8fmbrfBjXn+a0F+Md3lJVfSApSjpPoBq80VRUs=" # Example SRI for Linux arm64
else throw "Unsupported platform for tmuxai precompiled binary hash: ${stdenv.hostPlatform.system}";
# Define `srcFetching` for clarity, to be used in `sourceProvenance`
srcFetching = fetchurl {
url = "https://github.com/alvinunreal/tmuxai/releases/download/v${version}/${srcFilename}";
hash = srcHash;
};
# `src` attribute is still needed by mkDerivation for the actual source path
src = srcFetching;
sourceRoot = ".";
@ -75,25 +74,12 @@ stdenv.mkDerivation rec {
license = licenses.asl20;
maintainers = with maintainers; [ "death916" ];
platforms = platforms.linux ++ platforms.darwin;
# Correctly specify source provenance for a pre-compiled binary
sourceProvenance = [
(sourceTypes.binaryNativeCode // {
# We need to provide the 'urls' and 'sha256' (or 'hash') attributes
# that sourceTypes.binaryNativeCode might expect for its own validation,
# or that check-meta might look for.
# We can take these directly from our `srcFetching` attributes.
urls = srcFetching.urls or null; # fetchurl provides `urls` as a list
# The hash from fetchurl is already in the correct format.
# `fetchurl` result has `outputHash` and `outputHashAlgo`.
# `check-meta` often looks for `sha256` or `hash`.
# Let's provide what `srcFetching` has.
hash = srcFetching.outputHash; # Or just `srcFetching.hash` if that's how you defined it.
# `fetchurl` sets `outputHash` and `outputHashAlgo`.
# It might also look for `name` if not an actual derivation.
# Let's use the `name` from `srcFetching` which is usually the filename part of the URL.
urls = srcFetching.urls or null;
hash = srcFetching.outputHash;
name = srcFetching.name;
})
]; # <--- CORRECTED
];
};
}