nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 webos,
7 cmake,
8 pkg-config,
9 nixosTests,
10 libusb-compat-0_1,
11}:
12
13stdenv.mkDerivation rec {
14 pname = "novacomd";
15 version = "127";
16
17 src = fetchFromGitHub {
18 owner = "openwebos";
19 repo = "novacomd";
20 rev = "submissions/${version}";
21 sha256 = "1gahc8bvvvs4d6svrsw24iw5r0mhy4a2ars3j2gz6mp6sh42bznl";
22 };
23
24 patches = [
25 (fetchpatch {
26 url = "https://aur.archlinux.org/cgit/aur.git/plain/0001-Use-usb_bulk_-read-write-instead-of-homemade-handler.patch?h=palm-novacom-git";
27 sha256 = "116r6p4l767fqxfvq03sy6v7vxja8pkxlrc5hqby351a40b5dkiv";
28 })
29 (fetchpatch {
30 url = "https://raw.githubusercontent.com/feniksa/webos-overlay/40e2c113fc9426d50bdf37779da57ce4ff06ee6e/net-misc/novacomd/files/0011-Remove-verbose-output.patch";
31 sha256 = "09lmv06ziwkfg19b1h3jsmkm6g1f0nxxq1717dircjx8m45ypjq9";
32 })
33 ];
34
35 nativeBuildInputs = [
36 cmake
37 pkg-config
38 webos.cmake-modules
39 ];
40
41 buildInputs = [ libusb-compat-0_1 ];
42
43 # Workaround build failure on -fno-common toolchains:
44 # ld: src/host/usb-linux.c:82: multiple definition of `t_recovery_queue';
45 # src/host/recovery.c:45: first defined here
46 env.NIX_CFLAGS_COMPILE = "-fcommon";
47
48 cmakeFlags = [ "-DWEBOS_TARGET_MACHINE_IMPL=host" ];
49
50 passthru.tests = { inherit (nixosTests) novacomd; };
51
52 postPatch = ''
53 substituteInPlace CMakeLists.txt \
54 --replace-fail "cmake_minimum_required(VERSION 2.8.7)" "cmake_minimum_required(VERSION 3.10)"
55 '';
56
57 meta = {
58 description = "Daemon for communicating with WebOS devices";
59 mainProgram = "novacomd";
60 license = lib.licenses.asl20;
61 maintainers = [ ];
62 platforms = lib.platforms.linux;
63 };
64}