From 507d17e2c801d1ce66bddc2c9cfc01670a3176cb Mon Sep 17 00:00:00 2001 From: legendofmiracles Date: Sat, 19 Jun 2021 05:08:37 -0600 Subject: [PATCH] noisetorch: 0.10.1 -> 0.11.3 --- .../applications/audio/noisetorch/default.nix | 29 ++++++--------- .../audio/noisetorch/version.patch | 37 ------------------- 2 files changed, 11 insertions(+), 55 deletions(-) delete mode 100644 pkgs/applications/audio/noisetorch/version.patch diff --git a/pkgs/applications/audio/noisetorch/default.nix b/pkgs/applications/audio/noisetorch/default.nix index 6f63bf542f4..05e17bf7c98 100644 --- a/pkgs/applications/audio/noisetorch/default.nix +++ b/pkgs/applications/audio/noisetorch/default.nix @@ -1,42 +1,35 @@ -{ lib, buildGoModule, fetchFromGitHub, rnnoise-plugin }: +{ lib, buildGoModule, fetchFromGitHub, copyDesktopItems }: buildGoModule rec { pname = "NoiseTorch"; - version = "0.10.1"; + version = "0.11.3"; src = fetchFromGitHub { owner = "lawl"; repo = "NoiseTorch"; rev = version; - sha256 = "1a4g112h83m55pga8kq2a1wzxpycj59v4bygyjfyi1s09q1y97qg"; + sha256 = "0rjs6hbi7dvd179lzjmvqy4rv4pbc9amgzb8jfky4yc0zh8xf5z5"; }; - patches = [ - # Get version from environment instead of git tags - ./version.patch - ]; - vendorSha256 = null; doCheck = false; + ldflags = [ "-X main.version=${version}" "-X main.distribution=nix" ]; + subPackages = [ "." ]; - buildInputs = [ rnnoise-plugin ]; - - postPatch = "substituteInPlace main.go --replace 'librnnoise_ladspa/bin/ladspa/librnnoise_ladspa.so' '$RNNOISE_LADSPA_PLUGIN'"; + nativeBuildInputs = [ copyDesktopItems ]; preBuild = '' - export RNNOISE_LADSPA_PLUGIN="${rnnoise-plugin}/lib/ladspa/librnnoise_ladspa.so"; - go generate; + make -C c/ladspa/ + 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/ + install -D ./assets/icon/noisetorch.png $out/share/icons/hicolor/256x256/apps/noisetorch.png + copyDesktopItems assets/noisetorch.desktop $out/share/applications/ ''; meta = with lib; { @@ -44,6 +37,6 @@ buildGoModule rec { homepage = "https://github.com/lawl/NoiseTorch"; license = licenses.gpl3Plus; platforms = platforms.linux; - maintainers = with maintainers; [ panaeon ]; + maintainers = with maintainers; [ panaeon legendofmiracles ]; }; } diff --git a/pkgs/applications/audio/noisetorch/version.patch b/pkgs/applications/audio/noisetorch/version.patch deleted file mode 100644 index 20c51863744..00000000000 --- a/pkgs/applications/audio/noisetorch/version.patch +++ /dev/null @@ -1,37 +0,0 @@ -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")) - }