summary refs log tree commit diff stats
path: root/rust/qmk-hid-com/src_c/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'rust/qmk-hid-com/src_c/package.nix')
-rw-r--r--rust/qmk-hid-com/src_c/package.nix63
1 files changed, 63 insertions, 0 deletions
diff --git a/rust/qmk-hid-com/src_c/package.nix b/rust/qmk-hid-com/src_c/package.nix
new file mode 100644
index 0000000..17f84db
--- /dev/null
+++ b/rust/qmk-hid-com/src_c/package.nix
@@ -0,0 +1,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
+  ];
+}