feat(nix-hm): add flake for deepfilternet

This commit is contained in:
Price Hiller 2024-02-04 22:26:19 -06:00
parent e7b1790efe
commit 92e41d2010
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8
2 changed files with 156 additions and 0 deletions

View File

@ -0,0 +1,79 @@
{
"nodes": {
"deepfilternet-src": {
"flake": false,
"locked": {
"lastModified": 1693481377,
"narHash": "sha256-5bYbfO1kmduNm9YV5niaaPvRIDRmPt4QOX7eKpK+sWY=",
"owner": "Rikorose",
"repo": "DeepFilterNet",
"rev": "978576aa8400552a4ce9730838c635aa30db5e61",
"type": "github"
},
"original": {
"owner": "Rikorose",
"repo": "DeepFilterNet",
"rev": "978576aa8400552a4ce9730838c635aa30db5e61",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1706925685,
"narHash": "sha256-hVInjWMmgH4yZgA4ZtbgJM1qEAel72SYhP5nOWX4UIM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "79a13f1437e149dc7be2d1290c74d378dad60814",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"deepfilternet-src": "deepfilternet-src",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@ -0,0 +1,77 @@
{
description = "Flake for deepfilternet, a noise supression algorithm.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
deepfilternet-src = {
flake = false;
url =
"github:Rikorose/DeepFilterNet?rev=978576aa8400552a4ce9730838c635aa30db5e61";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, deepfilternet-src }:
flake-utils.lib.eachDefaultSystem (system:
let
lib = nixpkgs.lib;
pkgs = nixpkgs.legacyPackages.${system};
rust-toolchain = pkgs.symlinkJoin {
name = "rust-toolchain";
paths = with pkgs; [ rustc cargo ];
};
in rec {
packages.default = pkgs.rustPlatform.buildRustPackage rec {
pname = "deepfilternet";
version = "0.5.6";
src = "${deepfilternet-src}";
cargoLock = {
lockFile = "${deepfilternet-src}/Cargo.lock";
allowBuiltinFetchGit = true;
};
buildInputs = with pkgs; [ ladspaH ];
buildAndTestSubdir = "ladspa";
postInstall = ''
mkdir $out/lib/ladspa
mv $out/lib/libdeep_filter_ladspa.so $out/lib/ladspa/libdeep_filter_ladspa.so
'';
meta = {
description = "Noise supression using deep filtering";
homepage = "https://github.com/Rikorose/DeepFilterNet";
license = with lib.licenses; [ mit asl20 ];
changelog =
"https://github.com/Rikorose/DeepFilterNet/releases/tag/${src.rev}";
};
};
}) // {
overlays.default = final: prev: {
deepfilternet = self.packages.${final.system}.default;
easyeffects = let
pkgs = final.pkgs;
lib = pkgs.lib;
in prev.easyeffects.overrideAttrs (oldAttrs: {
buildInputs = with pkgs; [ deepfilternet ] ++ oldAttrs.buildInputs;
preFixup = let
lv2Plugins = with pkgs; [
calf # compressor exciter, bass enhancer and others
lsp-plugins # delay, limiter, multiband compressor
mda_lv2 # loudness
zam-plugins # maximizer
];
ladspaPlugins = with pkgs; [
deepfilternet
rubberband # pitch shifting
];
in ''
gappsWrapperArgs+=(
--set LV2_PATH "${lib.makeSearchPath "lib/lv2" lv2Plugins}"
--set LADSPA_PATH "${
lib.makeSearchPath "lib/ladspa" ladspaPlugins
}"
)
'';
});
};
};
}