diff options
author | John Titor <50095635+JohnRTitor@users.noreply.github.com> | 2024-04-28 02:03:09 +0530 |
---|---|---|
committer | John Titor <50095635+JohnRTitor@users.noreply.github.com> | 2024-04-28 02:08:53 +0530 |
commit | 6d0941464923786d6405d952ad62bf6023de8c21 (patch) | |
tree | 5bdba7930dd302408dd6a9378c146461b1ee7386 | |
parent | 0112397f8593d58449f19aedb9bc05f1ec78a838 (diff) |
rnnoise: allow overriding the modelUrl and hash
-rw-r--r-- | pkgs/development/libraries/rnnoise/default.nix | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/pkgs/development/libraries/rnnoise/default.nix b/pkgs/development/libraries/rnnoise/default.nix index 7d0df9002ef0d..fa8449edeb300 100644 --- a/pkgs/development/libraries/rnnoise/default.nix +++ b/pkgs/development/libraries/rnnoise/default.nix @@ -1,12 +1,16 @@ -{ stdenv, lib, fetchurl, fetchzip, autoreconfHook, writeScript }: +{ stdenv, lib, fetchurl, fetchzip, autoreconfHook, writeScript +, modelUrl ? "", modelHash ? "" # Allow overriding the model URL and hash +}: -let +let modelVersionJSON = lib.importJSON ./model-version.json; - # Copy from https://gitlab.xiph.org/xiph/rnnoise/-/raw/v${finalAttrs.version}/model_version + # Copy from https://gitlab.xiph.org/xiph/rnnoise/-/raw/v${version}/model_version default_model_version = modelVersionJSON.version; - default_model_url = "https://media.xiph.org/rnnoise/models/rnnoise_data-${default_model_version}.tar.gz"; - default_model_hash = modelVersionJSON.hash; + + # 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: { pname = "rnnoise"; @@ -21,8 +25,8 @@ in stdenv.mkDerivation (finalAttrs: { }; model = fetchurl { - url = default_model_url; - hash = default_model_hash; + url = model_url; + hash = model_hash; }; postPatch = '' |