Skip to content

Commit

Permalink
Add nix support (#94)
Browse files Browse the repository at this point in the history
* Add nix support

* Update shell.nix

* Add nixGL

* Format shell.nix

* Update README

* build(nix): add mako python package

---------

Co-authored-by: Wu Yuwei <Wu Yu Wei>
Co-authored-by: Jason Tsai <[email protected]>
  • Loading branch information
wusyong and pewsheen authored Jul 30, 2024
1 parent 89968ba commit 74addf1
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 17 deletions.
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";
}

0 comments on commit 74addf1

Please sign in to comment.