From 6954abfa1267c01ad6b33f49de24e57df1425797 Mon Sep 17 00:00:00 2001 From: vitalii Date: Sun, 19 Jul 2020 23:34:54 +0800 Subject: [PATCH 1/2] rnnoise-plugin: init at 0.9 --- .../libraries/rnnoise-plugin/default.nix | 25 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 27 insertions(+) create mode 100644 pkgs/development/libraries/rnnoise-plugin/default.nix diff --git a/pkgs/development/libraries/rnnoise-plugin/default.nix b/pkgs/development/libraries/rnnoise-plugin/default.nix new file mode 100644 index 00000000000000..efc8857e235e37 --- /dev/null +++ b/pkgs/development/libraries/rnnoise-plugin/default.nix @@ -0,0 +1,25 @@ +{ stdenv, SDL2, fetchFromGitHub, cmake }: + +stdenv.mkDerivation rec { + pname = "rnnoise-plugin"; + version = "0.9"; + + src = fetchFromGitHub { + owner = "werman"; + repo = "noise-suppression-for-voice"; + rev = "v${version}"; + sha256 = "18bq5b50xw3d4r1ildinafpg3isb9y216430h4mm9wr3ir7h76a7"; + }; + + buildInputs = [ cmake ]; + + cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" ]; + + meta = with stdenv.lib; { + description = "A real-time noise suppression plugin for voice based on Xiph's RNNoise"; + homepage = "https://github.com/werman/noise-suppression-for-voice"; + license = licenses.gpl3; + platforms = platforms.all; + maintainers = with maintainers; [ panaeon ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5e397bf155628d..ad556bc9aca72a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6446,6 +6446,8 @@ in rnnoise = callPackage ../development/libraries/rnnoise { }; + rnnoise-plugin = callPackage ../development/libraries/rnnoise-plugin {}; + rnv = callPackage ../tools/text/xml/rnv { }; rosie = callPackage ../tools/text/rosie { }; From a28d5337b24d4ac76474d57b00809d0b302e4a92 Mon Sep 17 00:00:00 2001 From: vitalii Date: Sun, 19 Jul 2020 23:34:54 +0800 Subject: [PATCH 2/2] noisetorch: init at 0.5.1-beta --- .../audio/noisetorch/config.patch | 13 ++++++ .../applications/audio/noisetorch/default.nix | 42 +++++++++++++++++++ .../audio/noisetorch/embedlibrnnoise.patch | 13 ++++++ .../audio/noisetorch/version.patch | 37 ++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 5 files changed, 107 insertions(+) create mode 100644 pkgs/applications/audio/noisetorch/config.patch create mode 100644 pkgs/applications/audio/noisetorch/default.nix create mode 100644 pkgs/applications/audio/noisetorch/embedlibrnnoise.patch create mode 100644 pkgs/applications/audio/noisetorch/version.patch diff --git a/pkgs/applications/audio/noisetorch/config.patch b/pkgs/applications/audio/noisetorch/config.patch new file mode 100644 index 00000000000000..f6e258862db673 --- /dev/null +++ b/pkgs/applications/audio/noisetorch/config.patch @@ -0,0 +1,13 @@ +diff --git a/config.go b/config.go +index de16249..fb91ec0 100644 +--- a/config.go ++++ b/config.go +@@ -20,7 +20,7 @@ const configFile = "config.toml" + + func initializeConfigIfNot() { + log.Println("Checking if config needs to be initialized") +- conf := config{Threshold: 95, DisplayMonitorSources: false, EnableUpdates: true} ++ conf := config{Threshold: 95, DisplayMonitorSources: false, EnableUpdates: false} + configdir := configDir() + ok, err := exists(configdir) + if err != nil { diff --git a/pkgs/applications/audio/noisetorch/default.nix b/pkgs/applications/audio/noisetorch/default.nix new file mode 100644 index 00000000000000..310c0f99b105a3 --- /dev/null +++ b/pkgs/applications/audio/noisetorch/default.nix @@ -0,0 +1,42 @@ +{ stdenv, buildGoModule, fetchFromGitHub, rnnoise-plugin }: + +buildGoModule rec { + pname = "NoiseTorch"; + version = "0.5.2-beta"; + + src = fetchFromGitHub { + owner = "lawl"; + repo = "NoiseTorch"; + rev = version; + sha256 = "1q0gfpqczlpybxcjjkiybcy6yc0gnrq8x27r0mpg4pvgwy7mps47"; + }; + + patches = [ ./version.patch ./config.patch ./embedlibrnnoise.patch ]; + + vendorSha256 = null; + + subPackages = [ "." ]; + + buildInputs = [ rnnoise-plugin ]; + + preBuild = '' + export RNNOISE_LADSPA_PLUGIN="${rnnoise-plugin}/lib/ladspa/librnnoise_ladspa.so"; + go generate; + rm ./scripts/* + ''; + + postInstall = '' + mkdir -p $out/share/icons/hicolor/256x256/apps/ + cp assets/icon/noisetorch.png $out/share/icons/hicolor/256x256/apps/ + mkdir -p $out/share/applications/ + cp assets/noisetorch.desktop $out/share/applications/ + ''; + + meta = with stdenv.lib; { + description = "Virtual microphone device with noise supression for PulseAudio"; + homepage = "https://github.com/lawl/NoiseTorch"; + license = licenses.gpl3Plus; + platforms = platforms.linux; + maintainers = with maintainers; [ panaeon ]; + }; +} diff --git a/pkgs/applications/audio/noisetorch/embedlibrnnoise.patch b/pkgs/applications/audio/noisetorch/embedlibrnnoise.patch new file mode 100644 index 00000000000000..b1782efb8b3555 --- /dev/null +++ b/pkgs/applications/audio/noisetorch/embedlibrnnoise.patch @@ -0,0 +1,13 @@ +diff --git a/scripts/embedlibrnnoise.go b/scripts/embedlibrnnoise.go +index 43daf80..0b3004b 100644 +--- a/scripts/embedlibrnnoise.go ++++ b/scripts/embedlibrnnoise.go +@@ -8,7 +8,7 @@ import ( + ) + + func main() { +- b, err := ioutil.ReadFile("librnnoise_ladspa/bin/ladspa/librnnoise_ladspa.so") ++ b, err := ioutil.ReadFile(os.Getenv("RNNOISE_LADSPA_PLUGIN")) + if err != nil { + fmt.Printf("Couldn't read librnnoise_ladspa.so: %v\n", err) + os.Exit(1) diff --git a/pkgs/applications/audio/noisetorch/version.patch b/pkgs/applications/audio/noisetorch/version.patch new file mode 100644 index 00000000000000..20c51863744ada --- /dev/null +++ b/pkgs/applications/audio/noisetorch/version.patch @@ -0,0 +1,37 @@ +diff --git a/scripts/embedversion.go b/scripts/embedversion.go +index ce0a756..60e7a5e 100644 +--- a/scripts/embedversion.go ++++ b/scripts/embedversion.go +@@ -1,24 +1,18 @@ + package main + + import ( +- "os" +- "os/exec" +- "strings" ++ "os" ++ "strings" + ) + + func main() { +- cmd := exec.Command("git", "describe", "--tags") +- ret, err := cmd.Output() + +- if err != nil { +- panic("Couldn't read git tags to embed version number") +- } +- version := strings.TrimSpace(string(ret)) ++ version := strings.TrimSpace(string(os.Getenv("version"))) + +- out, _ := os.Create("version.go") +- defer out.Close() ++ out, _ := os.Create("version.go") ++ defer out.Close() + +- out.Write([]byte("package main\n\n//THIS FILE IS AUTOMATICALLY GENERATED BY `go generate` DO NOT EDIT!\n\nvar version=\"")) +- out.Write([]byte(version)) +- out.Write([]byte("\"\n")) ++ out.Write([]byte("package main\n\n//THIS FILE IS AUTOMATICALLY GENERATED BY `go generate` DO NOT EDIT!\n\nvar version=\"")) ++ out.Write([]byte(version)) ++ out.Write([]byte("\"\n")) + } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ad556bc9aca72a..3ffe4388c57522 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5610,6 +5610,8 @@ in noise-repellent = callPackage ../applications/audio/noise-repellent { }; + noisetorch = callPackage ../applications/audio/noisetorch { }; + notary = callPackage ../tools/security/notary { }; notify-osd = callPackage ../applications/misc/notify-osd { };