From 74e4428092a515cf856ae2cf126688988bbfdbd1 Mon Sep 17 00:00:00 2001 From: emaryn Date: Tue, 17 Jun 2025 05:32:51 +0800 Subject: [PATCH] usbkvm: 0.2.0 -> 0.3.0 --- pkgs/by-name/us/usbkvm/package.nix | 53 +++++++++++++++++------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/pkgs/by-name/us/usbkvm/package.nix b/pkgs/by-name/us/usbkvm/package.nix index 24a6b584e2ea..c1a297e434c2 100644 --- a/pkgs/by-name/us/usbkvm/package.nix +++ b/pkgs/by-name/us/usbkvm/package.nix @@ -1,50 +1,71 @@ { + lib, + stdenv, buildGoModule, fetchzip, gst_all_1, gtkmm3, hidapi, - lib, makeWrapper, meson, ninja, pkg-config, python3, - stdenv, udev, wrapGAppsHook3, }: let - version = "0.2.0"; + version = "0.3.0"; src = fetchzip { url = "https://github.com/carrotIndustries/usbkvm/releases/download/v${version}/usbkvm-v${version}.tar.gz"; - sha256 = "sha256-ng6YpaN7sKEBPJcJAm0kcYtT++orweWRx6uOZFnOGG8="; + hash = "sha256-urexPODXU69QfSRHtJVpoDx/6mbPcv6EQ3mR0VRHNiY="; }; ms-tools-lib = buildGoModule { pname = "usbkvm-ms-tools-lib"; - inherit version; + inherit version src; - inherit src; sourceRoot = "${src.name}/ms-tools"; + vendorHash = null; # dependencies are vendored in the release tarball - buildInputs = [ - hidapi - ]; + buildInputs = [ hidapi ]; buildPhase = '' + runHook preBuild + mkdir -p $out/ go build -C lib/ -o $out/ -buildmode=c-archive mslib.go + + runHook postBuild ''; + + meta = { + homepage = "https://github.com/carrotIndustries/ms-tools"; + description = "Program, library and reference designs to develop for MacroSilicon MS2106/MS2109/MS2130 chips"; + license = lib.licenses.mit; + }; }; in stdenv.mkDerivation { pname = "usbkvm"; inherit version src; + # The package includes instructions to build the "mslib.{a,h}" files using a + # Go compiler, but that doesn't work in the Nix sandbox. We patch out this + # build step to instead copy those files from the Nix store: + patches = [ + ./precompiled-mslib.patch + ]; + + postPatch = '' + substituteInPlace meson.build \ + --replace-fail "@MSLIB_A_PRECOMPILED@" "${ms-tools-lib}/mslib.a" \ + --replace-fail "@MSLIB_H_PRECOMPILED@" "${ms-tools-lib}/mslib.h" + ''; + nativeBuildInputs = [ pkg-config python3 @@ -61,18 +82,6 @@ stdenv.mkDerivation { hidapi ]; - # The package includes instructions to build the "mslib.{a,h}" files using a - # Go compiler, but that doesn't work in the Nix sandbox. We patch out this - # build step to instead copy those files from the Nix store: - patches = [ - ./precompiled-mslib.patch - ]; - postPatch = '' - substituteInPlace meson.build \ - --replace-fail "@MSLIB_A_PRECOMPILED@" "${ms-tools-lib}/mslib.a" \ - --replace-fail "@MSLIB_H_PRECOMPILED@" "${ms-tools-lib}/mslib.h" - ''; - # Install udev rules in this package's out path: mesonFlags = [ "-Dudevrulesdir=lib/udev/rules.d" @@ -94,7 +103,7 @@ stdenv.mkDerivation { homepage = "https://github.com/carrotIndustries/usbkvm"; description = "Open-source USB KVM (Keyboard, Video and Mouse) adapter"; changelog = "https://github.com/carrotIndustries/usbkvm/releases/tag/v${version}"; - license = lib.licenses.gpl3; + license = lib.licenses.gpl3Only; maintainers = with lib.maintainers; [ lschuermann ]; mainProgram = "usbkvm"; };