Merge pull request #1211 from lightpanda-io/zigdom-nix

`zigdom` building on NixOS
This commit is contained in:
Karl Seguin
2025-11-17 23:30:48 +08:00
committed by GitHub
3 changed files with 60 additions and 10 deletions

View File

@@ -87,7 +87,7 @@ pub fn build(b: *Build) !void {
.sanitize_c = enable_csan, .sanitize_c = enable_csan,
.sanitize_thread = enable_tsan, .sanitize_thread = enable_tsan,
.imports = &.{ .imports = &.{
.{.name = "lightpanda", .module = lightpanda_module}, .{ .name = "lightpanda", .module = lightpanda_module },
}, },
}), }),
}); });
@@ -105,6 +105,7 @@ pub fn build(b: *Build) !void {
// test // test
const tests = b.addTest(.{ const tests = b.addTest(.{
.root_module = lightpanda_module, .root_module = lightpanda_module,
.use_llvm = true,
.test_runner = .{ .path = b.path("src/test_runner.zig"), .mode = .simple }, .test_runner = .{ .path = b.path("src/test_runner.zig"), .mode = .simple },
}); });
const run_tests = b.addRunArtifact(tests); const run_tests = b.addRunArtifact(tests);
@@ -125,7 +126,7 @@ pub fn build(b: *Build) !void {
.sanitize_c = enable_csan, .sanitize_c = enable_csan,
.sanitize_thread = enable_tsan, .sanitize_thread = enable_tsan,
.imports = &.{ .imports = &.{
.{.name = "lightpanda", .module = lightpanda_module}, .{ .name = "lightpanda", .module = lightpanda_module },
}, },
}), }),
}); });
@@ -151,7 +152,7 @@ pub fn build(b: *Build) !void {
.sanitize_c = enable_csan, .sanitize_c = enable_csan,
.sanitize_thread = enable_tsan, .sanitize_thread = enable_tsan,
.imports = &.{ .imports = &.{
.{.name = "lightpanda", .module = lightpanda_module}, .{ .name = "lightpanda", .module = lightpanda_module },
}, },
}), }),
}); });
@@ -658,6 +659,8 @@ fn buildCurl(b: *Build, m: *Build.Module) !void {
curl.addIncludePath(b.path(root ++ "lib")); curl.addIncludePath(b.path(root ++ "lib"));
curl.addIncludePath(b.path(root ++ "include")); curl.addIncludePath(b.path(root ++ "include"));
curl.addIncludePath(b.path("vendor/zlib"));
curl.addCSourceFiles(.{ curl.addCSourceFiles(.{
.flags = &.{}, .flags = &.{},
.files = &.{ .files = &.{

51
flake.lock generated
View File

@@ -1,5 +1,26 @@
{ {
"nodes": { "nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1763016383,
"narHash": "sha256-eYmo7FNvm3q08iROzwIi8i9dWuUbJJl3uLR3OLnSmdI=",
"owner": "nix-community",
"repo": "fenix",
"rev": "0fad5c0e5c531358e7174cd666af4608f08bc3ba",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -75,11 +96,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1756822655, "lastModified": 1763043403,
"narHash": "sha256-xQAk8xLy7srAkR5NMZFsQFioL02iTHuuEIs3ohGpgdk=", "narHash": "sha256-DgCTbHdIpzbXSlQlOZEWj8oPt2lrRMlSk03oIstvkVQ=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4bdac60bfe32c41103ae500ddf894c258291dd61", "rev": "75e04ecd084f93d4105ce68c07dac7656291fe2e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -91,12 +112,30 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"fenix": "fenix",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"zigPkgs": "zigPkgs", "zigPkgs": "zigPkgs",
"zlsPkg": "zlsPkg" "zlsPkg": "zlsPkg"
} }
}, },
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1762860488,
"narHash": "sha256-rMfWMCOo/pPefM2We0iMBLi2kLBAnYoB9thi4qS7uk4=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "2efc80078029894eec0699f62ec8d5c1a56af763",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"systems": { "systems": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
@@ -136,11 +175,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1756555914, "lastModified": 1762907712,
"narHash": "sha256-7yoSPIVEuL+3Wzf6e7NHuW3zmruHizRrYhGerjRHTLI=", "narHash": "sha256-VNW/+VYIg6N4b9Iq+F0YZmm22n74IdFS7hsPLblWuOY=",
"owner": "mitchellh", "owner": "mitchellh",
"repo": "zig-overlay", "repo": "zig-overlay",
"rev": "d0df3a2fd0f11134409d6d5ea0e510e5e477f7d6", "rev": "d16453ee78765e49527c56d23386cead799b6b53",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -11,6 +11,11 @@
zlsPkg.inputs.zig-overlay.follows = "zigPkgs"; zlsPkg.inputs.zig-overlay.follows = "zigPkgs";
zlsPkg.inputs.nixpkgs.follows = "nixpkgs"; zlsPkg.inputs.nixpkgs.follows = "nixpkgs";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
@@ -19,6 +24,7 @@
nixpkgs, nixpkgs,
zigPkgs, zigPkgs,
zlsPkg, zlsPkg,
fenix,
flake-utils, flake-utils,
... ...
}: }:
@@ -36,6 +42,8 @@
inherit system overlays; inherit system overlays;
}; };
rustToolchain = fenix.packages.${system}.stable.toolchain;
# We need crtbeginS.o for building. # We need crtbeginS.o for building.
crtFiles = pkgs.runCommand "crt-files" { } '' crtFiles = pkgs.runCommand "crt-files" { } ''
mkdir -p $out/lib mkdir -p $out/lib
@@ -51,6 +59,7 @@
# Build Tools # Build Tools
zigpkgs."0.15.2" zigpkgs."0.15.2"
zls zls
rustToolchain
python3 python3
pkg-config pkg-config
cmake cmake
@@ -66,7 +75,6 @@
glib.dev glib.dev
glibc.dev glibc.dev
zlib zlib
zlib.dev
]; ];
}; };
in in