...
 
Commits (9)
dist-newstyle
packages
cabal.project.local
\ No newline at end of file
cabal.project.local
result*
let rev = "e8e76bc26a994aee313e571dc4e6701398d17a42";
in
{
url = "https://github.com/commercialhaskell/all-cabal-hashes/archive/${rev}.tar.gz";
sha256 = "16rnyxqmr93ahml0fjfa6hmjpmx8sbpfdr52krd2sd6ic9n5p5ix";
}
......@@ -18,8 +18,8 @@ let
in
# ghc: path to a GHC source tree
{ ghc ? import ./ghc-prerelease.nix
, haskellOverrides ? (self: super: self)
{ ghc ? (import scripts/ghc-from.nix { pkgs = import "${baseNixpkgs}" {}; }).latest
, haskellOverrides ? (self: super: {})
}:
let
......@@ -28,14 +28,31 @@ let
};
overrides = self: super: rec {
all-cabal-hashes = self.fetchurl (import ./all-cabal-hashes.nix);
# Use scripts/update-cabal-hashes.sh to update this
all-cabal-hashes =
let
versions = builtins.fromJSON (builtins.readFile ./scripts/cabal-hashes.json);
fetch = { owner, repo, rev, sha256, ... }: self.fetchurl {
inherit sha256;
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
};
in fetch versions;
# Should this be self?
ghcHEAD = ghc super;
ghcHEAD = ghc;
bootstrapHaskellPackages = self.haskell.packages.ghc865;
haskellPackages =
let patchesOverrides = self.callPackage patches {};
patches = self.callPackage (import ./scripts/overrides.nix) { patches = ./patches; };
let patchesOverrides = self.callPackage patches {
extraDepends = import scripts/extra-depends.nix {
pkgs = self;
hsPkgs = haskellPackages;
};
};
patches = self.callPackage (import ./scripts/overrides.nix) {
patches = ./patches;
};
overrides =
self.lib.composeExtensions
haskellOverrides
......@@ -83,11 +100,13 @@ let
doctest = haskellPackages.callHackage "doctest" "0.16.0" {};
http-api-data = haskellPackages.callPackage ./http-api-data.nix {};
jailbreak-cabal = buildHaskellPackages.jailbreak-cabal;
cabal2nix = buildHaskellPackages.cabal2nix;
# These are things we don't want to build with HEAD
inherit (bootstrapHaskellPackages) jailbreak-cabal cabal2nix Unixutils;
};
};
in baseHaskellPackages.extend overrides;
in baseHaskellPackages.override (old: {
overrides = self.lib.composeExtensions (old.overrides or (_: _: {})) overrides;
});
headHackageScripts = self.stdenv.mkDerivation {
name = "head-hackage-scripts";
......
# Build a compiler from a GHC source tree.
#
# ghcTree: path to a GHC source tree
{ ghcTree }: pkgs:
let
base = pkgs.callPackage "${pkgs.path}/pkgs/development/compilers/ghc/head.nix" rec {
bootPkgs = pkgs.haskell.packages.ghc843;
inherit (bootPkgs) alex happy hscolour;
buildLlvmPackages = pkgs.buildPackages.llvmPackages_6;
llvmPackages = pkgs.llvmPackages_6;
version = "8.6.0";
};
in base.overrideAttrs (oldAttrs: {
src = with pkgs.lib; cleanSourceWith {
src = ghcTree;
filter = name: type: cleanSourceFilter name type
&& ! hasSuffix "are-validating.mk" name
&& ! hasSuffix "_build" name;
};
})
# Specify the precise commit of GHC that we are going to use by default
nixpkgs:
let spec =
{
version = "8.6.1.20180716";
src =
nixpkgs.fetchgit {
url = "git://git.haskell.org/ghc.git";
rev = "ghc-8.6.1-alpha2";
sha256 = "03y824yfy1xh2cznq5q75sql8pb0lxyw9ry82jgms9jampky98x6";
};
};
in
(nixpkgs.haskell.compiler.ghcHEAD.override
{ version = spec.version
; bootPkgs = nixpkgs.haskell.packages.ghc822; }).overrideAttrs(oldAttrs:
{ src = spec.src; })
......@@ -9,21 +9,10 @@
}:
let
ghc-from = import ./ghc-from.nix { pkgs = nixpkgs; };
# GHC from the given bindist.
ghc =
let
commit = "027df18eb894ef622f67b2f487a851dc534403e3";
src = fetchTarball {
url = "https://github.com/bgamari/ghc-artefact-nix/archive/${commit}.tar.gz";
sha256 = "0ijdpqsg8b7hz89hpgmpzfvg70y6yfq4wrqgngvqlfri5hy9fmg3";
};
in nixpkgs.callPackage "${src}/artifact.nix" {} {
ncursesVersion = "6";
bindistTarball =
if builtins.typeOf bindistTarball == "path"
then bindistTarball
else builtins.fetchurl bindistTarball;
};
ghc = ghc-from.bindist { inherit bindistTarball; };
# Build configuration.
nixpkgs = import ../. {
......
{
"owner": "commercialhaskell",
"repo": "all-cabal-hashes",
"branch": "hackage",
"message": "Update from Hackage at 2019-07-29T18:23:42Z",
"rev": "8cb9e194879225aab2a35838b4ab4b53f85d8eb8",
"sha256": "1krylhakvipxy2yiiswy2jq0f1giczx3y9gy335kq5r84brpar3v"
}
{ pkgs, hsPkgs }:
{
zlib = { inherit (pkgs) zlib; };
}
......@@ -29,19 +29,14 @@ generateOverrides prefix patchDir = do
mkOverride :: (PackageName, [([Int], String)]) -> String
mkOverride (display -> pName, patches) =
unlines $
[unwords [pName, "= if", superPname, "== null then", superPname]]
++ packages ++
[ "else", superPname, ";"]
unlines [ unwords $ [ pName, "=" ] ++ packages ++ [";"] ]
where
superPname = "super." ++ pName
quotes s = "\"" ++ s ++ "\""
packages :: [String]
packages = map mkPackages (sortBy (comparing fst) patches)
mkPackages (version, patch) =
unwords ["else if", superPname ++ ".version == "
, quotes (intercalate "." (map show version))
," then (", patch, ")"]
unwords ["(", patch, ")"]
override :: FilePath -> FilePath -> FilePath -> String -> PatchType -> String
override prefix patchDir extlessPath nixexpr ptype =
......@@ -53,9 +48,12 @@ generateOverride prefix patchDir (patchExtless, patchTypes) = do
pid <- maybe (fail ("invalid patch file name: " ++ show patchExtless)) return pid'
let pname = display (packageName pid)
version = versionNumbers (packageVersion pid)
return . (packageName pid,) . (version,) $
versionStr = intercalate "." (map show version)
str x = "\""++x++"\""
baseDrv = "(super.callHackage "++str pname++" "++str versionStr++" (extraDepends."++pname++" or {}))"
return . (packageName pid,) . (version,) $
"haskell.lib.doJailbreak (dontRevise "
++ foldl' (override prefix patchDir patchExtless) ("super."++pname) patchTypes ++ ")"
++ foldl' (override prefix patchDir patchExtless) baseDrv patchTypes ++ ")"
patchFunction :: PatchType -> String
patchFunction = \case
......@@ -85,7 +83,7 @@ main = do
[prefix, dir] -> return (prefix, dir)
_ -> fail "Usage: generate-nix-overrides [<prefix>, patchdir]"
overrides <- generateOverrides prefix patchDir
putStrLn "{haskell}:"
putStrLn "{ haskell, extraDepends ? {} }:"
putStrLn "let dontRevise = pkg: haskell.lib.overrideCabal pkg (old: { editedCabalFile = null; }); in"
putStrLn "let setCabalFile = pkg: file: haskell.lib.overrideCabal pkg (old: { postPatch = ''cp ${file} ${old.pname}.cabal''; }); in"
putStrLn "self: super: {\n"
......
{ pkgs }:
rec {
# Use GHC from a fedora27 binary distribution tarball via ghc-artefact-nix.
bindist = { bindistTarball }:
let
commit = "027df18eb894ef622f67b2f487a851dc534403e3";
src = fetchTarball {
url = "https://github.com/bgamari/ghc-artefact-nix/archive/${commit}.tar.gz";
sha256 = "0ijdpqsg8b7hz89hpgmpzfvg70y6yfq4wrqgngvqlfri5hy9fmg3";
};
in pkgs.callPackage "${src}/artifact.nix" {} {
ncursesVersion = "6";
inherit bindistTarball;
};
# Use GHC built from a local GHC source tree.
#
# ghcTree: path to a GHC source tree
source = { ghcTree }:
let
base = pkgs.callPackage "${pkgs.path}/pkgs/development/compilers/ghc/head.nix" rec {
bootPkgs = pkgs.haskell.packages.ghc843;
inherit (bootPkgs) alex happy hscolour;
buildLlvmPackages = pkgs.buildPackages.llvmPackages_6;
llvmPackages = pkgs.llvmPackages_6;
version = "8.6.0";
};
in base.overrideAttrs (oldAttrs: {
src = with pkgs.lib; cleanSourceWith {
src = ghcTree;
filter = name: type: cleanSourceFilter name type
&& ! hasSuffix "are-validating.mk" name
&& ! hasSuffix "_build" name;
};
});
# Use GHC from a released binary distribution on downloads.haskell.org
release = { tarballPath, sha256 }:
bindist {
bindistTarball = pkgs.fetchurl {
url = "https://downloads.haskell.org/ghc/${tarballPath}";
inherit sha256;
};
};
###############################
# Official Releases
###############################
v8_8_1-rc1 = release {
tarballPath = "8.8.1-rc1/ghc-8.8.0.20190721-x86_64-fedora27-linux.tar.xz";
sha256 = "0hvclcplv7j8g4634cm61qgw4a23kk2njp7fpm5rbzhd8px2fdc7";
};
latest = v8_8_1-rc1;
}
#! /usr/bin/env nix-shell
#! nix-shell -i bash
#! nix-shell -p curl jq nix
set -eufo pipefail
FILE=scripts/cabal-hashes.json
OWNER=$(jq -r '.owner' < "$FILE")
REPO=$(jq -r '.repo' < "$FILE")
BRANCH=$(jq -r '.branch' < "$FILE")
JSON=$(curl "https://api.github.com/repos/$OWNER/$REPO/branches/$BRANCH")
REV=$(echo "$JSON" | jq -r '.commit.sha')
MESSAGE=$(echo "$JSON" | jq -r '.commit.commit.message')
SHA256=$(nix-prefetch-url "https://github.com/$OWNER/$REPO/archive/$REV.tar.gz")
TJQ=$(jq '{owner: $owner, repo: $repo, branch: $branch, message: $message, rev: $rev, sha256: $sha256}' \
--arg owner "$OWNER" \
--arg repo "$REPO" \
--arg branch "$BRANCH" \
--arg message "$MESSAGE" \
--arg rev "$REV" \
--arg sha256 "$SHA256" \
< "$FILE")
[[ $? == 0 ]] && echo "${TJQ}" >| "$FILE"