From 2a02e017a4917f8a5b54a6a271bb41683b701ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Sun, 30 May 2021 19:09:42 +0200 Subject: [PATCH 1/2] add nixOS instructions to README --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index aab3617fa8e..2e4f7119ad4 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,14 @@ With the following environment variable set: export LIBCLANG_PATH=$(llvm-config --prefix)/lib64 ``` +#### On nixOS Linux + +```sh +nix-shell etc/shell.nix +``` + +You will need to run this in every shell before running mach. + #### On Windows (MSVC) 1. Install Python 3.9 for Windows (https://www.python.org/downloads/release/python-392/). The Windows x86-64 MSI installer is fine. This is required in order to build the JavaScript engine, SpiderMonkey. From 9d0b06ac54f9c5d14d29935f2f01e6287487edb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Sun, 30 May 2021 19:09:31 +0200 Subject: [PATCH 2/2] add etc/shell.nix for nix/nixOS --- etc/shell.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 etc/shell.nix diff --git a/etc/shell.nix b/etc/shell.nix new file mode 100644 index 00000000000..578166b0228 --- /dev/null +++ b/etc/shell.nix @@ -0,0 +1,40 @@ +# This provides a shell with all the necesarry packages required to run mach and build servo +# NOTE: This does not work offline or for nix-build + +with import {}; + +clangStdenv.mkDerivation rec { + name = "servo-env"; + + buildInputs = [ + # Native dependencies + fontconfig freetype openssl libunwind + xlibs.libxcb x11 + + gst_all_1.gstreamer + gst_all_1.gst-plugins-base + gst_all_1.gst-plugins-bad + + rustup + + # Build utilities + cmake dbus gcc git pkgconfig which llvm autoconf213 perl yasm m4 + (python3.withPackages (ps: with ps; [virtualenv pip dbus])) + ]; + + LIBCLANG_PATH = llvmPackages.clang-unwrapped.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"; + + shellHook = '' + # Fix missing libraries errors (those libraries aren't linked against, so we need to dynamically supply them) + export LD_LIBRARY_PATH=${lib.makeLibraryPath [ xorg.libXcursor xorg.libXrandr xorg.libXi ]} + # Fix invalid option errors during linking + # https://github.com/mozilla/nixpkgs-mozilla/commit/c72ff151a3e25f14182569679ed4cd22ef352328 + unset AS + ''; +}