usbkvm: 0.2.0 -> 0.3.0

This commit is contained in:
emaryn
2025-06-17 05:32:51 +08:00
parent 00d1337e29
commit 74e4428092
+31 -22
View File
@@ -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";
};