nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 106 lines 2.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 replaceVars, 6 meson, 7 ninja, 8 pkg-config, 9 buildPackages, 10 withIntrospection ? 11 lib.meta.availableOn stdenv.hostPlatform gobject-introspection 12 && stdenv.hostPlatform.emulatorAvailable buildPackages, 13 gobject-introspection, 14 gi-docgen, 15 python3, 16 glib, 17 libusb1, 18 json-glib, 19 vala, 20 hwdata, 21 umockdev, 22}: 23 24let 25 pythonEnv = python3.pythonOnBuildForHost.withPackages ( 26 ps: with ps; [ 27 setuptools 28 ] 29 ); 30in 31stdenv.mkDerivation rec { 32 pname = "gusb"; 33 version = "0.4.9"; 34 35 outputs = [ 36 "bin" 37 "out" 38 "dev" 39 ] 40 ++ lib.optionals withIntrospection [ "devdoc" ]; 41 42 src = fetchFromGitHub { 43 owner = "hughsie"; 44 repo = "libgusb"; 45 tag = version; 46 hash = "sha256-piIPNLc3deToyQaajXFvM+CKh9ni8mb0P3kb+2RoJOs="; 47 }; 48 49 patches = [ 50 (replaceVars ./fix-python-path.patch { 51 python = "${pythonEnv}/bin/python3"; 52 }) 53 ]; 54 55 strictDeps = true; 56 57 depsBuildBuild = [ 58 pkg-config 59 ]; 60 61 nativeBuildInputs = [ 62 meson 63 ninja 64 pkg-config 65 ] 66 ++ lib.optionals withIntrospection [ 67 gobject-introspection 68 gi-docgen 69 vala 70 ]; 71 72 # all required in gusb.pc 73 propagatedBuildInputs = [ 74 glib 75 libusb1 76 json-glib 77 ]; 78 79 mesonFlags = [ 80 (lib.mesonBool "docs" withIntrospection) 81 (lib.mesonBool "introspection" withIntrospection) 82 (lib.mesonBool "tests" doCheck) 83 (lib.mesonBool "vapi" withIntrospection) 84 (lib.mesonOption "usb_ids" "${hwdata}/share/hwdata/usb.ids") 85 ]; 86 87 checkInputs = [ 88 umockdev 89 ]; 90 91 doCheck = false; # tests try to access USB 92 93 postFixup = '' 94 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. 95 moveToOutput "share/doc" "$devdoc" 96 ''; 97 98 meta = { 99 description = "GLib libusb wrapper"; 100 mainProgram = "gusbcmd"; 101 homepage = "https://github.com/hughsie/libgusb"; 102 license = lib.licenses.lgpl21; 103 maintainers = [ lib.maintainers.marcweber ]; 104 platforms = lib.platforms.unix; 105 }; 106}