Code change:
<del> { stdenv, lib, fetchFromGitHub, autoreconfHook }: </del> <ins> { stdenv, lib, fetchurl, fetchzip, autoreconfHook, writeScript, fetchpatch , modelUrl ? "", modelHash ? "" # Allow overriding the model URL and hash }: </ins> <del> stdenv.mkDerivation (rec { </del> <ins> let modelVersionJSON = lib.importJSON ./model-version.json; # Copy from https://gitlab.xiph.org/xiph/rnnoise/-/raw/v${version}/model_version default_model_version = modelVersionJSON.version; # Either use the default model or the one provided by package override model_url = if (modelUrl == "") then "https://media.xiph.org/rnnoise/models/rnnoise_data-${default_model_version}.tar.gz" else modelUrl; model_hash = if (modelHash == "") then modelVersionJSON.hash else modelHash; in stdenv.mkDerivation (finalAttrs: { </ins> pname = "rnnoise"; <del> version = "2021-01-22"; </del> <ins> version = "0.2"; src = fetchzip { urls = [ "https://gitlab.xiph.org/xiph/rnnoise/-/archive/v${finalAttrs.version}/rnnoise-v${finalAttrs.version}.tar.gz" "https://github.com/xiph/rnnoise/archive/v${finalAttrs.version}.tar.gz" ]; hash = "sha256-Qaf+0iOprq7ILRWNRkBjsniByctRa/lFVqiU5ZInF/Q="; }; patches = [ # remove when updating (fetchpatch { url = "https://github.com/xiph/rnnoise/commit/372f7b4b76cde4ca1ec4605353dd17898a99de38.patch"; hash = "sha256-Dzikb59hjVxd1XIEj/Je4evxtGORkaNcqE+zxOJMSvs="; }) ]; </ins> <del> src = fetchFromGitHub { owner = "xiph"; repo = "rnnoise"; rev = "1cbdbcf1283499bbb2230a6b0f126eb9b236defd"; sha256 = "1y0rzgmvy8bf9a431garpm2w177s6ajgf79y5ymw4yb0pik57rwb"; </del> <ins> model = fetchurl { url = model_url; hash = model_hash; </ins> }; <ins> postPatch = '' tar xvomf ${finalAttrs.model} ''; </ins> nativeBuildInputs = [ autoreconfHook ]; postInstall = '' install -Dt $out/bin examples/.libs/rnnoise_demo ''; <del> meta = with lib; { </del> <ins> passthru.updateScript = writeScript "update-rnnoise.sh" '' #!/usr/bin/env nix-shell #!nix-shell -i bash -p curl jq common-updater-scripts nix nix-prefetch findutils moreutils prefetch-sri() { nix-prefetch-url "$1" | xargs nix hash to-sri --type sha256 } res="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"}  -sL "https://api.github.com/repos/xiph/rnnoise/tags?per_page=1")" version="$(echo $res | jq '.[0].name | split("v") | .[1]' --raw-output)" update-source-version ${finalAttrs.pname} "$version" --ignore-same-hash model_version=$(curl -sL "https://raw.githubusercontent.com/xiph/rnnoise/v$version/model_version") model_url="https://media.xiph.org/rnnoise/models/rnnoise_data-$model_version.tar.gz" model_hash="$(prefetch-sri $model_url)" modelJson=pkgs/development/libraries/rnnoise/model-version.json jq --arg version "$model_version"  --arg hash "$model_hash"  '.version = $version | .hash = $hash'  "$modelJson" | sponge "$modelJson" ''; meta = { </ins> description = "Recurrent neural network for audio noise reduction"; homepage = "https://people.xiph.org/~jm/demo/rnnoise/"; <del> license = licenses.bsd3; maintainers = [ maintainers.nh2 ]; </del> <ins> license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ nh2 ]; </ins> mainProgram = "rnnoise_demo"; <del> platforms = platforms.all; </del> <ins> platforms = lib.platforms.all; </ins> }; })

Related discussion:
text: Package name: rnnoise Latest released version: 0.2 <!-- Search your package here: --- Current version on the unstable channel: 2021-01-22 Current version on the stable/release channel: 2021-01-22 <!-- Type the name of your package and try to find an open pull request for the package If you find an open pull request, you can review it! There's a high chance that you'll have the new version right away while helping the community! --- Notify maintainers Note for maintainers: Please tag this issue in your PR. Tried building with but it got a missing file. There’s also warning about not using SSE3/AVX/AVX2, but Nix only supports the bottom of the barrel, common x86 instructions, but I usually compile this one out with some flags. Add a :+1: [reaction] to [issues you find important]. [reaction]: [issues you find important]: [^1] or offering a non-proprietary, non-US-corporate-controlled mirror for this free software project. I wish to delete this Microsoft account in the future, but I need more projects like this to support alternative methods to send patches & contribute.
The missing file is downloaded as part of the '' It looks like they a step to the build process.
Perhaps it can be fetched using fetchurl/fetchpatch?
You're correct. The relevant file is retrieved in the script . It fetches a single file from the URL , where the version is extracted from the file , currently set to . Hence, we can emulate the download script and execute something similar to:
Alternatively you could use instead of a separate model + . While we are at it, we should be using the main repository instead just Microsoft GitHub which is explicitly listed as a mirror, not the primary code forge. Something like Referencing both mirrors would be more resilient for when one of these platforms goes down.
Made a PR , but still having trouble designing a .