From b5158decda218c38b7c3d79747e6fb1586e1c1bd Mon Sep 17 00:00:00 2001
From: zendo <linzway@qq.com>
Date: Mon, 30 Jan 2023 00:31:33 +0800
Subject: [PATCH] go-musicfox: init at 3.6.1

---
 .../audio/go-musicfox/default.nix             | 50 +++++++++++++++++++
 pkgs/top-level/all-packages.nix               |  2 +
 2 files changed, 52 insertions(+)
 create mode 100644 pkgs/applications/audio/go-musicfox/default.nix

diff --git a/pkgs/applications/audio/go-musicfox/default.nix b/pkgs/applications/audio/go-musicfox/default.nix
new file mode 100644
index 000000000000..cf5ac3f8c52e
--- /dev/null
+++ b/pkgs/applications/audio/go-musicfox/default.nix
@@ -0,0 +1,50 @@
+{ lib
+, fetchFromGitHub
+, buildGoModule
+, clangStdenv
+, pkg-config
+, alsa-lib
+, flac
+}:
+
+# gcc only supports objc on darwin
+buildGoModule.override { stdenv = clangStdenv; } rec {
+  pname = "go-musicfox";
+  version = "3.6.1";
+
+  src = fetchFromGitHub {
+    owner = "anhoder";
+    repo = pname;
+    rev = "v${version}";
+    hash = "sha256-iinEo+HrcNM3gx1iUqe1duRd45PrYgVybRt9NKphwuY=";
+  };
+
+  deleteVendor = true;
+
+  vendorHash = "sha256-DbdAEvcspTYMYMvc5IBEUtQAJMW8JZpNi0UA/DvzGFo=";
+
+  subPackages = [ "cmd/musicfox.go" ];
+
+  ldflags = [
+    "-s"
+    "-w"
+    "-X go-musicfox/pkg/constants.AppVersion=${version}"
+  ];
+
+  nativeBuildInputs = [
+    pkg-config
+  ];
+
+  buildInputs = [
+    alsa-lib
+    flac
+  ];
+
+  meta = with lib; {
+    description = "Terminal netease cloud music client written in Go";
+    homepage = "https://github.com/anhoder/go-musicfox";
+    license = licenses.mit;
+    mainProgram = "musicfox";
+    maintainers = with maintainers; [ zendo ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e80b17093aeb..3753ac199375 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -28977,6 +28977,8 @@ with pkgs;
 
   go-motion = callPackage ../development/tools/go-motion { };
 
+  go-musicfox = callPackage ../applications/audio/go-musicfox { };
+
   gpg-mdp = callPackage ../applications/misc/gpg-mdp { };
 
   greenfoot = callPackage ../applications/editors/greenfoot {