Switch to nightly zig and zls to fix zig-wayland issue

This commit is contained in:
2023-12-22 20:52:52 +01:00
parent edf2859249
commit df86ec5188
5 changed files with 216 additions and 25 deletions

2
.gitmodules vendored
View File

@@ -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

201
flake.lock generated
View File

@@ -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",

View File

@@ -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 []
);

View File

@@ -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);
}