Skip to content

Instantly share code, notes, and snippets.

@sorpaas
Created March 9, 2016 03:07
Show Gist options
  • Save sorpaas/3e733bb500dfd0a4e97a to your computer and use it in GitHub Desktop.
Save sorpaas/3e733bb500dfd0a4e97a to your computer and use it in GitHub Desktop.
Nearly Worked Servo Hacking Environment for NixOS
# Copyright (C) 2015 Siddhanathan Shanmugam
# License: GPLv3 (see LICENSE)
# Maintainer: siddhanathan@gmail.com
#
# Dockerfile for hacking on Servo
#
FROM ubuntu:15.10
MAINTAINER Siddhanathan Shanmugam
RUN apt-get update
# Servo requirements
RUN apt-get install -y curl freeglut3-dev autoconf \
libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev \
gperf g++ build-essential cmake python-virtualenv python-pip \
libssl-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev \
libglu1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev
# Useful tools
RUN apt-get install -y sudo git python-dev vim autotools-dev
# Drivers, this part still doesn't work
RUN apt-get install -y i965-va-driver
RUN useradd -m -d /home/servo -s /bin/bash servo
RUN echo "servo ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/servo \
&& chmod 0440 /etc/sudoers.d/servo
ENV HOME /home/servo
ENV SHELL /bin/bash
WORKDIR /home/servo
USER servo
with import <nixpkgs> {};
assert stdenv.isLinux;
with pkgs;
let build = {name, url, sha256, exes} :
stdenv.mkDerivation rec {
inherit name;
src = fetchurl {
inherit url sha256;
};
dontStrip = true;
installPhase = ''
mv ${name} $out
rm $out/manifest.in
'';
prePatch=''
if [ "$name" == "rustc" ]; then
mv rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/ rustc/lib/rustlib/
fi
'';
preFixup = let
rpath = stdenv.lib.concatStringsSep ":" [
"$out/lib"
(stdenv.lib.makeLibraryPath [ zlib ])
''${stdenv.cc.cc}/lib64''
];
in
''
for executable in ${stdenv.lib.concatMapStringsSep " " (s: "$out/bin/" + s) exes}; do
patchelf --interpreter "${stdenv.glibc}/lib/${stdenv.cc.dynamicLinker}" \
--set-rpath "${rpath}" \
"$executable"
done
for library in $out/lib/*.so $cargo/lib/*.so; do
patchelf --set-rpath "${rpath}" "$library"
done
'';
};
rustcNightly = build {
name = "rustc";
url = https://static.rust-lang.org/dist/2016-03-05/rust-nightly-x86_64-unknown-linux-gnu.tar.gz;
sha256 = "e83c82cbc29dc0a71aec6152ed647b1c8e9938ed2439935e7c5c66ce54095aac";
exes = ["rustc" "rustdoc"];
};
cargoNightly = build {
name = "cargo";
url = https://static.rust-lang.org/cargo-dist/2016-03-05/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz;
sha256 = "077bd76be7b34820e09579cd3d65cad95cb8c0d3bf6250f8a7342b49275aa53c";
exes = ["cargo"];
};
in stdenv.mkDerivation {
name = "servo-build-env";
buildInputs = [
curlFull
gitAndTools.gitFull
gnumake
cmake
binutils-raw
fontconfig
readline
mesa
file
xorg.libX11
xorg.libXmu
rustcNightly
cargoNightly
pkgconfig
python27
python27Packages.virtualenv
python27Packages.pip
];
SSL_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment