diff --git a/.gitmodules b/.gitmodules index 8e7f35a..eb19e0e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "deps/zig-wayland"] path = deps/zig-wayland - url = https://github.com/ifreund/zig-wayland + url = https://github.com/zoriya/zig-wayland [submodule "deps/zig-xkbcommon"] path = deps/zig-xkbcommon url = https://github.com/ifreund/zig-xkbcommon diff --git a/deps/zig-wayland b/deps/zig-wayland index b9c6fcb..045c1f9 160000 --- a/deps/zig-wayland +++ b/deps/zig-wayland @@ -1 +1 @@ -Subproject commit b9c6fcb8cab3a85c5583ef371055cb589b1e7b18 +Subproject commit 045c1f9a4db0aa0bd52774a0fce257341275b30e diff --git a/flake.lock b/flake.lock index 7c560f5..cc000bc 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,118 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "zls-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1694102001, + "narHash": "sha256-vky6VPK1n1od6vXbqzOXnekrQpTL4hbPAwUhT5J9c9E=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "9e21c80adf67ebcb077d75bd5e7d724d21eeafd6", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "langref": { + "flake": false, + "locked": { + "narHash": "sha256-mYdDCBdNEIeMbavdhSo8qXqW+3fqPC8BAich7W3umrI=", + "type": "file", + "url": "https://raw.githubusercontent.com/ziglang/zig/63bd2bff12992aef0ce23ae4b344e9cb5d65f05d/doc/langref.html.in" + }, + "original": { + "type": "file", + "url": "https://raw.githubusercontent.com/ziglang/zig/63bd2bff12992aef0ce23ae4b344e9cb5d65f05d/doc/langref.html.in" + } + }, "nixpkgs": { "locked": { "lastModified": 1703013332, @@ -18,7 +131,24 @@ "root": { "inputs": { "nixpkgs": "nixpkgs", - "wlroots-src": "wlroots-src" + "wlroots-src": "wlroots-src", + "zig-overlay": "zig-overlay", + "zls-overlay": "zls-overlay" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } }, "wlroots-src": { @@ -39,6 +169,75 @@ "repo": "wlroots", "type": "gitlab" } + }, + "zig-overlay": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703204565, + "narHash": "sha256-A2Wpu3z6cj/zV+QzQ11Zzt3nAtqat0Qo2lPX8qsB3Wk=", + "owner": "mitchellh", + "repo": "zig-overlay", + "rev": "b7a0aa41fb33514bc216e2f4a106eeac8dee6775", + "type": "github" + }, + "original": { + "owner": "mitchellh", + "repo": "zig-overlay", + "type": "github" + } + }, + "zig-overlay_2": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "zls-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701390337, + "narHash": "sha256-C+Lyio+GPl3B2IAZ6Nk5hAAE2g6a8bO9vMACUfOLC/g=", + "owner": "mitchellh", + "repo": "zig-overlay", + "rev": "1815ef2d0451b1121a6a91051da84906fcb06f99", + "type": "github" + }, + "original": { + "owner": "mitchellh", + "repo": "zig-overlay", + "type": "github" + } + }, + "zls-overlay": { + "inputs": { + "flake-utils": "flake-utils_2", + "gitignore": "gitignore", + "langref": "langref", + "nixpkgs": [ + "nixpkgs" + ], + "zig-overlay": "zig-overlay_2" + }, + "locked": { + "lastModified": 1703036566, + "narHash": "sha256-GKw+ON8FcUVHxDzA35piev/W/YUvXv5aZ4hmIzNFWuc=", + "owner": "zigtools", + "repo": "zls", + "rev": "adaeabbe1ba888d74309d0a837d4abddc24cf638", + "type": "github" + }, + "original": { + "owner": "zigtools", + "repo": "zls", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index dbc1b6b..11d8277 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,12 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; + zig-overlay.url = "github:mitchellh/zig-overlay"; + zig-overlay.inputs.nixpkgs.follows = "nixpkgs"; + + zls-overlay.url = "github:zigtools/zls"; + zls-overlay.inputs.nixpkgs.follows = "nixpkgs"; + wlroots-src = { type = "gitlab"; host = "gitlab.freedesktop.org"; @@ -17,6 +23,8 @@ self, nixpkgs, wlroots-src, + zig-overlay, + zls-overlay, }: let version = self.shortRev or "dirty"; supportedSystems = ["x86_64-linux"]; @@ -58,7 +66,7 @@ buildInputs = [ - zig + zig-overlay.packages.${system}.master wlroots libGL libevdev @@ -72,7 +80,7 @@ ++ ( if inShell then [ - # TODO: In 'nix develop', provide some developer tools. + zls-overlay.packages.${system}.default ] else [] ); diff --git a/src/main.zig b/src/main.zig index c8a3f67..2c17566 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,24 +1,8 @@ const std = @import("std"); -pub fn main() !void { - // Prints to stderr (it's a shortcut based on `std.io.getStdErr()`) - std.debug.print("All your {s} are belong to us.\n", .{"codebase"}); +const wl = @import("wayland").server.wl; +const wlr = @import("wlroots"); - // stdout is for the actual output of your application, for example if you - // are implementing gzip, then only the compressed bytes should be sent to - // stdout, not any debugging messages. - const stdout_file = std.io.getStdOut().writer(); - var bw = std.io.bufferedWriter(stdout_file); - const stdout = bw.writer(); - - try stdout.print("Run `zig build test` to run the tests.\n", .{}); - - try bw.flush(); // don't forget to flush! -} - -test "simple test" { - var list = std.ArrayList(i32).init(std.testing.allocator); - defer list.deinit(); // try commenting this out and see if zig detects the memory leak! - try list.append(42); - try std.testing.expectEqual(@as(i32, 42), list.pop()); +pub fn main() anyerror!void { + wlr.log.init(.debug, null); }