Skip to content

Lightpanda: the headless browser designed for AI and automation

begin with package.nix

Muki Kiboigo6708d875a225
diff --git a/flake.nix b/flake.nix
index 382fc6e21..33ea13c56 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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;
+ };
}
);
}
diff --git a/nix/package.nix b/nix/package.nix
new file mode 100644
index 000000000..1ae02cdd4
--- /dev/null
+++ b/nix/package.nix
@@ -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;
+ };
+}