diff --git a/build.zig b/build.zig index dd5d444..410e517 100644 --- a/build.zig +++ b/build.zig @@ -19,9 +19,11 @@ pub fn build(b: *std.Build) void { .name = "zremap", // In this case the main source file is merely a path, however, in more), // complicated build scripts, this could be a generated file. - .root_source_file = b.path("src/main.zig"), - .target = target, - .optimize = optimize, + .root_module = b.createModule(.{ + .root_source_file = b.path("src/main.zig"), + .target = target, + .optimize = optimize, + }), }); exe.linkLibC(); exe.linkSystemLibrary("evdev"); @@ -57,9 +59,11 @@ pub fn build(b: *std.Build) void { // Creates a step for unit testing. This only builds the test executable // but does not run it. const unit_tests = b.addTest(.{ - .root_source_file = b.path("src/main.zig"), - .target = target, - .optimize = optimize, + .root_module = b.createModule(.{ + .root_source_file = b.path("src/main.zig"), + .target = target, + .optimize = optimize, + }), }); const run_unit_tests = b.addRunArtifact(unit_tests); diff --git a/flake.nix b/flake.nix index 9bd4b49..0e3a103 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,7 @@ pkg-config ]; buildPhase = '' - NIX_CFLAGS_COMPILE="-static -isystem $(pkg-config --variable=includedir libevdev)/libevdev-1.0 $NIX_CFLAGS_COMPILE" + NIX_CFLAGS_COMPILE=" -isystem $(pkg-config --variable=includedir libevdev)/libevdev-1.0 $NIX_CFLAGS_COMPILE" ''; }; diff --git a/src/main.zig b/src/main.zig index 8cdb469..6730ec8 100644 --- a/src/main.zig +++ b/src/main.zig @@ -47,10 +47,10 @@ fn uinputWriteKey(uinput_dev: *c.libevdev_uinput, key: u16) !void { const pressKey = c.input_event{ .type = c.EV_KEY, .code = key, .value = 1, .time = undefined }; const releaseKey = c.input_event{ .type = c.EV_KEY, .code = key, .value = 0, .time = undefined }; const sync = c.input_event{ .type = c.EV_SYN, .code = c.SYN_REPORT, .value = 0, .time = undefined }; - std.time.sleep(20000); + std.Thread.sleep(20 * std.time.ns_per_ms); try uinputWrite(uinput_dev, &pressKey); try uinputWrite(uinput_dev, &sync); - std.time.sleep(20000); + std.Thread.sleep(20 * std.time.ns_per_ms); try uinputWrite(uinput_dev, &releaseKey); }