nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 cmake,
3 fetchFromGitHub,
4 lib,
5 python3,
6 stdenv,
7 unstableGitUpdater,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "canokey-usbip";
12 version = "0-unstable-2024-03-11";
13
14 src = fetchFromGitHub {
15 owner = "canokeys";
16 repo = "canokey-usbip";
17 rev = "cc7087277096f185401b05143f9a028711d43557";
18 hash = "sha256-+7sGW2eGelRQ2TDvgUITbPdcsXo7Pp6Pp+r3RmyQAZM=";
19 fetchSubmodules = true;
20 };
21
22 postPatch = ''
23 sed -i 's/COMMAND git describe.*\(>>.*\)/COMMAND echo ${finalAttrs.src.rev} \1/' canokey-core/CMakeLists.txt
24
25 # CMake 2.8.12 is deprecated and is no longer supported by CMake > 4
26 # https://github.com/NixOS/nixpkgs/issues/445447
27 substituteInPlace canokey-core/canokey-crypto/mbedtls/CMakeLists.txt --replace-fail \
28 "cmake_minimum_required(VERSION 2.8.12)" \
29 "cmake_minimum_required(VERSION 3.10)"
30 '';
31
32 nativeBuildInputs = [
33 cmake
34 python3
35 ];
36
37 env = {
38 NIX_CFLAGS_COMPILE = toString [
39 "-Wno-error=incompatible-pointer-types"
40 (lib.optionalString stdenv.cc.isClang "-Wno-error=documentation")
41 ];
42 };
43
44 postInstall = ''
45 install -D --target-directory=$out/bin canokey-usbip
46 '';
47
48 passthru.updateScript = unstableGitUpdater {
49 hardcodeZeroVersion = true;
50 };
51
52 meta = {
53 description = "CanoKey USB/IP Virt Card";
54 homepage = "https://github.com/canokeys/canokey-usbip";
55 license = lib.licenses.asl20;
56 maintainers = [ lib.maintainers.jmbaur ];
57 mainProgram = "canokey-usbip";
58 platforms = lib.platforms.all;
59 };
60})