Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nix support #94

Merged
merged 8 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 34 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ But if you are interested, feel free to help test it.

# Usage

The current demo works best on macOS at the moment, since it tries to customize its traffic light buttons to be seamless in the window.

However, We plan to focus on Windows as main target support.

## Prerequisites
## Getting Started

### Windows

Expand All @@ -26,6 +22,14 @@ scoop install git python llvm cmake curl
pip install mako
```

> You can also use chocolatey to install if you prefer it.

- Build & run:

```sh
cargo run
```

### MacOS

- Install [Xcode](https://developer.apple.com/xcode/)
Expand All @@ -36,8 +40,29 @@ brew install cmake pkg-config harfbuzz
pip install mako
```

- Build & run:

```sh
cargo run
```

### Linux


#### Nix

- For NixOS:

```sh
nix-shell shell.nix --run 'cargo r'
```

- For non-NixOS distributions:

```sh
nix-shell shell.nix --run 'nixGL cargo r'
```

#### Debian-based Distributions

```sh
Expand All @@ -57,21 +82,13 @@ python3-mako

For others, please follow the instructions in [Servo book](https://book.servo.org/hacking/setting-up-your-environment.html#tools-for-linux) to bootstrap first.

## Build

- Run demo

```sh
cargo run
```

## Nightly Release

Nightly releases built with CrabNebula Cloud can be found at [releases](https://web.crabnebula.cloud/verso/verso-nightly/releases).

## Future Work

- Add more window and servo features to make it feel more like a general web browser.
- Improve development experience.
- Multi webviews and multi browsing contexts in the same window.
- Enable `Gstreamer` feature and remove `brew install harfbuzz` in README.
- Multiwindow support.
- Enable multiprocess mode.
- Enable sandobx in all platforms.
- Enable `Gstreamer` feature and remove `brew install harfbuzz` in README.
60 changes: 60 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
with import <nixpkgs> { };
let
nixgl = import (fetchTarball "https://github.com/nix-community/nixGL/archive/489d6b095ab9d289fe11af0219a9ff00fe87c7c5.tar.gz") { enable32bits = false; };
pkgs_gnumake_4_3 = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/6adf48f53d819a7b6e15672817fa1e78e5f4e84f.tar.gz") { };
llvmPackages = llvmPackages_14; # servo/servo#31059
stdenv = stdenvAdapters.useMoldLinker llvmPackages.stdenv;
in
stdenv.mkDerivation {
name = "verso-env";

buildInputs = [
fontconfig
freetype
libunwind
xorg.libxcb
xorg.libX11
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-ugly
rustup
taplo
llvmPackages.bintools
llvmPackages.llvm
llvmPackages.libclang
udev
cmake
dbus
gcc
git
pkg-config
which
llvm
perl
yasm
m4
pkgs_gnumake_4_3.gnumake # servo/mozjs#375
libGL
mold
wayland
nixgl.auto.nixGLDefault
(python3.withPackages (ps: with ps; [pip dbus mako]))
];
LD_LIBRARY_PATH = lib.makeLibraryPath [
zlib
xorg.libXcursor
xorg.libXrandr
xorg.libXi
libxkbcommon
vulkan-loader
wayland
libGL
nixgl.auto.nixGLDefault
];
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
# Allow cargo to download crates
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
# Enable colored cargo and rustc output
TERMINFO = "${ncurses.out}/share/terminfo";
}