begin with package.nix

This commit is contained in:
Muki Kiboigo committed 2026-10-26 10:26:33 -07:00
1 parent 938f4964c2
commit 6708d875a2
2 files changed
+71

No files matched your search

+16
View File
@@ -20,6 +20,11 @@
inputs.nixpkgs.follows = "nixpkgs";
};
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
@@ -29,6 +34,7 @@
zig-flake,
zls,
fenix,
crane,
flake-utils,
...
}:
@@ -47,6 +53,7 @@
};
rustToolchain = fenix.packages.${system}.stable.toolchain;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
# We need crtbeginS.o for building.
crtFiles = pkgs.runCommand "crt-files" { } ''
@@ -82,9 +89,18 @@
];
};
lightpanda = pkgs.callPackage ./nix/package.nix {
inherit rustToolchain;
};
in
{
devShells.default = fhs.env;
packages = {
inherit lightpanda;
default = lightpanda;
};
}
);
}
+55
View File
@@ -0,0 +1,55 @@
{
lib,
stdenv,
zig-flake,
zig,
rustToolchain,
src,
version,
}:
let
v8Archives = {
aarch64-darwin = {
platform = "macos_aarch64";
hash = "sha256-AOXAPuMHof5uA+F3EdXyqzy3jTc1vJvFLJT4txzLBhg=";
};
x86_64-darwin = {
platform = "macos_x86_64";
hash = "sha256-q7y6djJ7ddXWWKNZId56cD2fSI+Ih7a+NI9ZhNQjOwQ=";
};
aarch64-linux = {
platform = "linux_aarch64";
hash = "sha256-Bk0Hna4tfLov6iKTYErpZLnqj3Q7eEeqfymPyvrUtjU=";
};
x86_64-linux = {
platform = "linux_x86_64";
hash = "sha256-qKymFSy10+obJhBH3104QTdq2Oo2DX6VqC9k3HhBdXQ=";
};
};
v8Archive = v8Archives.${stdenv.hostPlatform.system};
zigV8Tag = "v0.5.7";
v8Version = "14.9.207.35";
v8 = lib.fetchurl {
url = "https://github.com/lightpanda-io/zig-v8-fork/releases/download/${zigV8Tag}/libc_v8_${v8Version}_${v8Archive.platform}.a";
hash = v8Archive.hash;
};
zigDeps = stdenv.mkDerivation {
name = "lightpanda-zig-deps";
};
in
stdenv.mkDerivation {
pname = "lightpanda";
version = "${version}-nix";
meta = {
description = "Headless browser designed for AI and automation";
homepage = "https://lightpanda.io";
license = lib.licenses.agpl3Only;
mainProgram = "lightpanda";
platforms = builtins.attrNames v8Archives;
};
}