summary refs log tree commit diff stats
path: root/rust/qmk-hid-com/src_c/package.nix
blob: 17f84dbd5236de7f43eb18ab8fd73fdc07c61cf3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
  stdenv,
  lib,
  # deps
  meson,
  pkg-config,
  ninja,
  wayland-scanner,
  wayland,
  hidapi,
}:
stdenv.mkDerivation {
  pname = "qmk-unicode-type";
  version = "1.0.0";

  src = lib.cleanSourceWith {
    src = lib.cleanSource ./.;
    filter = name: type:
      (type == "directory")
      || (builtins.elem (builtins.baseNameOf name) [
        "virtual-keyboard-unstable-v1.xml"
      ])
      || (lib.strings.hasSuffix ".c" (builtins.baseNameOf name))
      || (lib.strings.hasSuffix ".h" (builtins.baseNameOf name))
      || (lib.strings.hasSuffix ".build" (builtins.baseNameOf name));
  };

  env = {
  };
  mesonFlags = lib.mapAttrsToList lib.mesonOption {
    debug = "false";
    optimization = "3";
    strip = "true";
    warning_level = "everything";
    werror = "true";
    b_lundef = "true";
    b_lto = "true";
    b_ndebug = "false";
    b_pgo = "generate";
    b_staticpic = "true";
    b_pie = "false";
    c_std = "gnu2x";
  };
  # ar with gcc plugins for lto objects
  preConfigure = ''
    CC="gcc";
    AR="gcc-ar";
    RANLIB="gcc-ranlib" ;
    export CC AR RANLIB
  '';

  strictDeps = true;
  nativeBuildInputs = [
    meson
    pkg-config
    ninja
    wayland-scanner
  ];
  buildInputs = [
    wayland
    hidapi
  ];
}