Commit c00d2f59 authored by Ben Gamari's avatar Ben Gamari 🐢

hadrian: Drop nix build script

It's currently too out-of-date to build current hadrian and is arguably
completely broken anyways (see #15794).
parent f5bff4bc
FROM i386/debian:jessie
ENV LANG C.UTF-8
RUN echo 'deb http://ppa.launchpad.net/hvr/ghc/ubuntu trusty main' > /etc/apt/sources.list.d/ghc.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F6F88286
RUN apt-get update -qq
# Core build utilities
RUN apt-get install -qy zlib1g-dev libtinfo-dev libsqlite3-0 libsqlite3-dev \
ca-certificates g++ git make automake autoconf gcc \
perl python3 texinfo xz-utils lbzip2 patch openssh-client sudo \
jq wget curl
# Documentation tools
RUN apt-get install -qy python3-sphinx texlive-xetex texlive-latex-extra
# Core build utilities
RUN apt-get install -qy libgmp-dev:i386
# Get i386 GHC bindist for 32 bit CI builds.
RUN cd /tmp && curl https://downloads.haskell.org/~ghc/8.4.2/ghc-8.4.2-i386-deb8-linux.tar.xz | tar -Jx
RUN cd /tmp/ghc-8.4.2 && setarch i386 ./configure --prefix=/opt/ghc-i386/8.4.2 CFLAGS=-m32 --target=i386-unknown-linux --build=i386-unknown-linux --host=i386-unknown-linux
RUN cd /tmp/ghc-8.4.2 && make install
RUN rm -rf /tmp/ghc-8.4.2
ENV PATH /opt/ghc-i386/8.4.2/bin:$PATH
# Get Cabal
RUN cd /tmp && \
curl https://www.haskell.org/cabal/release/cabal-install-2.2.0.0/cabal-install-2.2.0.0-i386-unknown-linux.tar.gz | tar -zx && \
mv cabal /usr/local/bin/cabal
# Create a normal user.
RUN adduser ghc --gecos "GHC builds" --disabled-password
RUN echo "ghc ALL = NOPASSWD : ALL" > /etc/sudoers.d/ghc
USER ghc
# Build Haskell tools
RUN cabal update && \
cabal install hscolour happy alex
ENV PATH /home/ghc/.cabal/bin:$PATH
WORKDIR /home/ghc/
CMD ["bash"]
#!/usr/bin/env nix-shell
#! nix-shell -i bash shell.nix
# This script sets up the build environment by invoking nix-shell shell.nix
# and then runs the hadrian executable.
function rl {
TARGET_FILE="$1"
cd "$(dirname "$TARGET_FILE")"
TARGET_FILE="$(basename "$TARGET_FILE")"
# Iterate down a (possible) chain of symlinks
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE="$(readlink "$TARGET_FILE")"
cd "$(dirname "$TARGET_FILE")"
TARGET_FILE="$(basename "$TARGET_FILE")"
done
# Compute the canonicalized name by finding the physical path
# for the directory we're in and appending the target file.
PHYS_DIR="$(pwd -P)"
RESULT="$PHYS_DIR/$TARGET_FILE"
echo "$RESULT"
}
absoluteRoot="$(dirname "$(rl "$0")")"
echo $absoluteRoot
cd "$absoluteRoot"
hadrian \
--lint \
--directory="$absoluteRoot/.." \
"$@"
# Invoking nix-shell sets up an environment where we can build ghc
# by only invoking hadrian.
{ _nixpkgs ? import <nixpkgs> {} }:
let
nixpkgs = import (_nixpkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "e7a327da5cffdf5e77e1924906a4f0983591bd3e";
sha256 = "1xzil4mayhggg2miwspbk12nihlszg0y4n6i4qacrxql5n75f0hr";
}){ overlays = [cabalHashes]; };
cabalHashes = sel: super: {
all-cabal-hashes = super.fetchurl {
url = "https://github.com/commercialhaskell/all-cabal-hashes/archive/b2b93ae610f5f1b51d22b191f972dc3dec8f94c6.tar.gz";
sha256 = "0bffclpqbw62xff36qlzxghr042mhv0m06k5ml4298w6fv7ly1xw";
};
};
haskellPackages = nixpkgs.haskell.packages.ghc822;
removeBuild = path: type:
let baseName = baseNameOf (toString path);
in
! (baseName == "_build"
|| baseName == "dist"
|| baseName == "dist-newstyle"
|| baseName == ".stack-work"
|| baseName == "config.log"
|| baseName == "config.status"
|| baseName == "shell.nix"
|| nixpkgs.lib.hasSuffix ".sh" baseName
|| !(nixpkgs.lib.cleanSourceFilter path type)) ;
filterSrc = path: builtins.filterSource removeBuild path;
hadrianPackages = nixpkgs.haskell.packages.ghc822.override {
overrides = self: super: let
localPackage = name: path: self.callCabal2nix name (filterSrc path) {};
in {
hadrian = localPackage "hadrian" ./. ;
happy = nixpkgs.haskell.lib.dontCheck (super.happy);
shake = self.callHackage "shake" "0.16.2" {};
extra = self.callHackage "extra" "1.6.4" {};
QuickCheck = self.callHackage "QuickCheck" "2.10" {};
Cabal = localPackage "Cabal" ./../libraries/Cabal/Cabal ;
filepath = localPackage "filepath" ./../libraries/filepath ;
text = localPackage "text" ./../libraries/text ;
hpc = localPackage"hpc" ./../libraries/hpc ;
parsec = localPackage "parsec" ./../libraries/parsec ;
HUnit = nixpkgs.haskell.lib.dontCheck (self.callHackage "HUnit" "1.3.1.2" {});
process = localPackage "process" ./../libraries/process ;
directory = localPackage "directory" ./../libraries/directory ;
}; };
cabalPackages = nixpkgs.haskell.packages.ghc822.override {
overrides = self: super: let
localPackage = name: path: self.callCabal2nix name (filterSrc path) {};
in {
Cabal = localPackage "Cabal" ./../../cabal/Cabal ;
cabal-install = self.callPackage ./../../cabal/cabal-install.nix {};
}; };
in
nixpkgs.lib.overrideDerivation nixpkgs.haskell.packages.ghcHEAD.ghc
(drv: {
name = "ghc-dev";
nativeBuildInputs = drv.nativeBuildInputs ++
[ hadrianPackages.hadrian
nixpkgs.arcanist
nixpkgs.git
nixpkgs.gmp.dev nixpkgs.gmp.out
nixpkgs.ncurses.dev nixpkgs.ncurses.out
nixpkgs.python3Packages.sphinx
nixpkgs.texlive.combined.scheme-basic
(nixpkgs.haskell.packages.ghc822.ghcWithPackages
(ps: [ps.html ps.regex-compat ps.dump-core]))
#cabalPackages.cabal-install
];
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment