...
  View open merge request
Commits (7)
let rev = "e8e76bc26a994aee313e571dc4e6701398d17a42";
in
{
url = "https://github.com/commercialhaskell/all-cabal-hashes/archive/${rev}.tar.gz";
sha256 = "16rnyxqmr93ahml0fjfa6hmjpmx8sbpfdr52krd2sd6ic9n5p5ix";
}
......@@ -19,7 +19,7 @@ in
# ghc: path to a GHC source tree
{ ghc ? import ./ghc-prerelease.nix
, haskellOverrides ? (self: super: self)
, 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;
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";
......
{
"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"
......
#! /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"