update to zig 0.14.0

This commit is contained in:
Jeffrey C. Ollie 2024-12-08 15:04:44 -06:00
parent b009ce9ee1
commit 0f956dbc24
Signed by: jeff
GPG key ID: 6F86035A6D97044E
3 changed files with 106 additions and 11 deletions

View file

@ -1,15 +1,49 @@
{ {
"nodes": { "nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1731533236,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -20,11 +54,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1720542800, "lastModified": 1733581040,
"narHash": "sha256-ZgnNHuKV6h2+fQ5LuqnUaqZey1Lqqt5dTUAiAnqH0QQ=", "narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "feb2849fdeb70028c70d73b848214b00d324a497", "rev": "22c3f2cf41a0e70184334a958e6b124fb0ce3e01",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -33,10 +67,27 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs_2": {
"locked": {
"lastModified": 1708161998,
"narHash": "sha256-6KnemmUorCvlcAvGziFosAVkrlWZGIc6UNT9GUYr0jQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "84d981bae8b5e783b3b548de505b22880559515f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"zig": "zig"
} }
}, },
"systems": { "systems": {
@ -53,6 +104,41 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"zig": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1733487143,
"narHash": "sha256-o4jsVKtInTA0CqwUUdcAxCYAgNLLNo30mLzz3qVc0eY=",
"owner": "mitchellh",
"repo": "zig-overlay",
"rev": "40e32dd7e083eab4340acd17de47f13d883f257f",
"type": "github"
},
"original": {
"owner": "mitchellh",
"repo": "zig-overlay",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -5,6 +5,9 @@
nixpkgs = { nixpkgs = {
url = "nixpkgs/nixos-unstable"; url = "nixpkgs/nixos-unstable";
}; };
zig = {
url = "github:mitchellh/zig-overlay";
};
flake-utils = { flake-utils = {
url = "github:numtide/flake-utils"; url = "github:numtide/flake-utils";
}; };
@ -13,8 +16,9 @@
outputs = { outputs = {
nixpkgs, nixpkgs,
flake-utils, flake-utils,
zig,
... ...
} @ inputs: let }: let
in in
flake-utils.lib.eachDefaultSystem ( flake-utils.lib.eachDefaultSystem (
system: let system: let
@ -25,7 +29,7 @@
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
nativeBuildInputs = [ nativeBuildInputs = [
pkgs.hidapi pkgs.hidapi
pkgs.zig_0_13 zig.packages.${system}.master
]; ];
buildInputs = [ buildInputs = [
pkgs.hidapi pkgs.hidapi

View file

@ -4,6 +4,11 @@ const hidapi = @cImport({
@cInclude("hidapi/hidapi.h"); @cInclude("hidapi/hidapi.h");
}); });
const Errors = error{
HidApiInitError,
HidApiExitError,
};
const MAX_REPORT_DESCRIPTOR_SIZE = hidapi.HID_API_MAX_REPORT_DESCRIPTOR_SIZE; const MAX_REPORT_DESCRIPTOR_SIZE = hidapi.HID_API_MAX_REPORT_DESCRIPTOR_SIZE;
const HidBusType = enum(hidapi.hid_bus_type) { const HidBusType = enum(hidapi.hid_bus_type) {
@ -15,12 +20,12 @@ const HidBusType = enum(hidapi.hid_bus_type) {
_, _,
}; };
pub fn init() !void { pub fn init() error.HidApiInitError!void {
const ret = hidapi.hid_init(); const ret = hidapi.hid_init();
if (ret != 0) return error.HidApiInitError; if (ret != 0) return error.HidApiInitError;
} }
pub fn exit() !void { pub fn exit() error.HidApiExitError!void {
const ret = hidapi.hid_exit(); const ret = hidapi.hid_exit();
if (ret != 0) return error.HidApiExitError; if (ret != 0) return error.HidApiExitError;
} }