git.iko.soy/typeable/nixpkgs
on master help sign in
noisetorch: init at 0.5.1-beta
commita28d5337b24d4ac76474d57b00809d0b302e4a92 authorvitalii <vitalii.voloshyn@gmail.com> dateSun 19 Jul 2020, 23:34 (6 years ago) parent6954abf
5 files changed+107
pkgs/applications/audio/noisetorch/config.patch+13 pkgs/applications/audio/noisetorch/default.nix+42 pkgs/applications/audio/noisetorch/embedlibrnnoise.patch+13 pkgs/applications/audio/noisetorch/version.patch+37 pkgs/top-level/all-packages.nix+2
pkgs/applications/audio/noisetorch/config.patchnew file+13
@@ -0,0 +1,13 @@
1+diff --git a/config.go b/config.go
2+index de16249..fb91ec0 100644
3+--- a/config.go
4++++ b/config.go
5+@@ -20,7 +20,7 @@ const configFile = "config.toml"
6+
7+ func initializeConfigIfNot() {
8+ log.Println("Checking if config needs to be initialized")
9+- conf := config{Threshold: 95, DisplayMonitorSources: false, EnableUpdates: true}
10++ conf := config{Threshold: 95, DisplayMonitorSources: false, EnableUpdates: false}
11+ configdir := configDir()
12+ ok, err := exists(configdir)
13+ if err != nil {
pkgs/applications/audio/noisetorch/default.nixnew file+42
@@ -0,0 +1,42 @@
1+{ stdenv, buildGoModule, fetchFromGitHub, rnnoise-plugin }:
2+
3+buildGoModule rec {
4+ pname = "NoiseTorch";
5+ version = "0.5.2-beta";
6+
7+ src = fetchFromGitHub {
8+ owner = "lawl";
9+ repo = "NoiseTorch";
10+ rev = version;
11+ sha256 = "1q0gfpqczlpybxcjjkiybcy6yc0gnrq8x27r0mpg4pvgwy7mps47";
12+ };
13+
14+ patches = [ ./version.patch ./config.patch ./embedlibrnnoise.patch ];
15+
16+ vendorSha256 = null;
17+
18+ subPackages = [ "." ];
19+
20+ buildInputs = [ rnnoise-plugin ];
21+
22+ preBuild = ''
23+ export RNNOISE_LADSPA_PLUGIN="${rnnoise-plugin}/lib/ladspa/librnnoise_ladspa.so";
24+ go generate;
25+ rm ./scripts/*
26+ '';
27+
28+ postInstall = ''
29+ mkdir -p $out/share/icons/hicolor/256x256/apps/
30+ cp assets/icon/noisetorch.png $out/share/icons/hicolor/256x256/apps/
31+ mkdir -p $out/share/applications/
32+ cp assets/noisetorch.desktop $out/share/applications/
33+ '';
34+
35+ meta = with stdenv.lib; {
36+ description = "Virtual microphone device with noise supression for PulseAudio";
37+ homepage = "https://github.com/lawl/NoiseTorch";
38+ license = licenses.gpl3Plus;
39+ platforms = platforms.linux;
40+ maintainers = with maintainers; [ panaeon ];
41+ };
42+}
pkgs/applications/audio/noisetorch/embedlibrnnoise.patchnew file+13
@@ -0,0 +1,13 @@
1+diff --git a/scripts/embedlibrnnoise.go b/scripts/embedlibrnnoise.go
2+index 43daf80..0b3004b 100644
3+--- a/scripts/embedlibrnnoise.go
4++++ b/scripts/embedlibrnnoise.go
5+@@ -8,7 +8,7 @@ import (
6+ )
7+
8+ func main() {
9+- b, err := ioutil.ReadFile("librnnoise_ladspa/bin/ladspa/librnnoise_ladspa.so")
10++ b, err := ioutil.ReadFile(os.Getenv("RNNOISE_LADSPA_PLUGIN"))
11+ if err != nil {
12+ fmt.Printf("Couldn't read librnnoise_ladspa.so: %v\n", err)
13+ os.Exit(1)
pkgs/applications/audio/noisetorch/version.patchnew file+37
@@ -0,0 +1,37 @@
1+diff --git a/scripts/embedversion.go b/scripts/embedversion.go
2+index ce0a756..60e7a5e 100644
3+--- a/scripts/embedversion.go
4++++ b/scripts/embedversion.go
5+@@ -1,24 +1,18 @@
6+ package main
7+
8+ import (
9+- "os"
10+- "os/exec"
11+- "strings"
12++ "os"
13++ "strings"
14+ )
15+
16+ func main() {
17+- cmd := exec.Command("git", "describe", "--tags")
18+- ret, err := cmd.Output()
19+
20+- if err != nil {
21+- panic("Couldn't read git tags to embed version number")
22+- }
23+- version := strings.TrimSpace(string(ret))
24++ version := strings.TrimSpace(string(os.Getenv("version")))
25+
26+- out, _ := os.Create("version.go")
27+- defer out.Close()
28++ out, _ := os.Create("version.go")
29++ defer out.Close()
30+
31+- out.Write([]byte("package main\n\n//THIS FILE IS AUTOMATICALLY GENERATED BY `go generate` DO NOT EDIT!\n\nvar version=\""))
32+- out.Write([]byte(version))
33+- out.Write([]byte("\"\n"))
34++ out.Write([]byte("package main\n\n//THIS FILE IS AUTOMATICALLY GENERATED BY `go generate` DO NOT EDIT!\n\nvar version=\""))
35++ out.Write([]byte(version))
36++ out.Write([]byte("\"\n"))
37+ }
pkgs/top-level/all-packages.nix+2
@@ -5610,6 +5610,8 @@ in
56105610
56115611 noise-repellent = callPackage ../applications/audio/noise-repellent { };
56125612
5613+ noisetorch = callPackage ../applications/audio/noisetorch { };
5614+
56135615 notary = callPackage ../tools/security/notary { };
56145616
56155617 notify-osd = callPackage ../applications/misc/notify-osd { };