Build inside of source directory produced by cabal sdist (#543)

This ensures that we don't accidentally forget to package data files
when uploading to Hackage to prevent build failures
This commit is contained in:
Gabriel Gonzalez 2018-08-12 09:17:28 -05:00 committed by GitHub
parent 7c1dff1605
commit 5ac99844fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 72 deletions

View File

@ -4,6 +4,24 @@ let
readDirectory = import ./nix/readDirectory.nix;
overlayShared = pkgsNew: pkgsOld: {
dhall-sdist =
let
predicate = path: type:
let
base = baseNameOf path;
in
!( pkgsNew.lib.hasSuffix ".nix" base
|| base == "dist"
|| base == "result"
|| base == ".git"
);
src = builtins.filterSource predicate ./.;
in
pkgsNew.callPackage (import ./nix/dhall-sdist.nix src) { };
haskellPackages = pkgsOld.haskellPackages.override (old: {
overrides =
let
@ -11,35 +29,17 @@ let
haskellPackagesNew: haskellPackagesOld: {
dhall =
pkgsNew.haskell.lib.failOnAllWarnings
(pkgsNew.haskell.lib.overrideCabal
haskellPackagesOld.dhall
(old: {
src =
let
predicate = path: type:
let
base = baseNameOf path;
in
!( pkgsNew.lib.hasSuffix ".nix" base
|| base == "dist"
|| base == "result"
|| base == ".git"
);
in
builtins.filterSource
predicate
old.src;
}
)
(haskellPackagesNew.callCabal2nix
"dhall"
pkgsNew.dhall-sdist
{ }
);
prettyprinter =
pkgs.haskell.lib.dontCheck haskellPackagesOld.prettyprinter;
prettyprinter =
pkgs.haskell.lib.dontCheck haskellPackagesOld.prettyprinter;
serialise =
pkgs.haskell.lib.dontCheck haskellPackagesOld.serialise;
serialise =
pkgs.haskell.lib.dontCheck haskellPackagesOld.serialise;
};
in
@ -54,15 +54,27 @@ let
);
};
nixpkgs = fetchNixpkgs {
rev = "2c07921cff84dfb0b9e0f6c2d10ee2bfee6a85ac";
sha256 = "09cfdbrzy3wfpqd3nkahv0jqfynpxy4kpcxq0gab0pq9a8bia6sg";
outputSha256 = "1sxh54zxqy54vrak203qci4128z9mxnzfr5bb5pl6xdrdkcdpqrn";
overlayDynamic = pkgsNew: pkgsOld: {
haskellPackages = pkgsOld.haskellPackages.override {
overrides = haskellPackagesNew: haskellPackagesOld: {
hpack =
haskellPackagesOld.hpack_0_29_6;
};
};
};
pkgs = import nixpkgs { config = {}; overlays = [ overlayShared ]; };
nixpkgs = fetchNixpkgs {
rev = "1d4de0d552ae9aa66a5b8dee5fb0650a4372d148";
sha256 = "09qx58dp1kbj7cpzp8ahbqfbbab1frb12sh1qng87rybcaz0dz01";
outputSha256 = "0xpqc1fhkvvv5dv1zmas2j1q27mi7j7dgyjcdh82mlgl1q63i660";
};
pkgs = import nixpkgs {
config = {};
overlays = [ overlayShared overlayDynamic ];
};
overlayStaticLinux = pkgsNew: pkgsOld: {
cabal_patched_src = pkgsNew.fetchFromGitHub {

12
nix/dhall-sdist.nix Normal file
View File

@ -0,0 +1,12 @@
src:
{ cabal-install, coreutils, runCommand }:
runCommand "dhall-sdist" {} ''
${coreutils}/bin/mkdir $out
${coreutils}/bin/cp --recursive ${src} src
cd src
${coreutils}/bin/chmod --recursive u+w .
${coreutils}/bin/mkdir dist
HOME=$PWD ${cabal-install}/bin/cabal sdist --output-directory=$out
''

View File

@ -1,39 +0,0 @@
{ mkDerivation, ansi-terminal, base, bytestring, case-insensitive
, cborg, containers, contravariant, criterion, cryptonite, deepseq
, Diff, directory, doctest, exceptions, filepath, hashable
, haskeline, http-client, http-client-tls
, insert-ordered-containers, lens-family-core, megaparsec, memory
, mockery, mtl, optparse-applicative, parsers, prettyprinter
, prettyprinter-ansi-terminal, QuickCheck, quickcheck-instances
, repline, scientific, serialise, stdenv, tasty, tasty-hunit
, tasty-quickcheck, template-haskell, text, transformers
, unordered-containers, vector
}:
mkDerivation {
pname = "dhall";
version = "1.16.1";
src = ./..;
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
ansi-terminal base bytestring case-insensitive cborg containers
contravariant cryptonite Diff directory exceptions filepath
haskeline http-client http-client-tls insert-ordered-containers
lens-family-core megaparsec memory mtl optparse-applicative parsers
prettyprinter prettyprinter-ansi-terminal repline scientific
serialise template-haskell text transformers unordered-containers
vector
];
executableHaskellDepends = [ base ];
testHaskellDepends = [
base containers deepseq directory doctest filepath hashable
insert-ordered-containers mockery prettyprinter QuickCheck
quickcheck-instances serialise tasty tasty-hunit tasty-quickcheck
text vector
];
benchmarkHaskellDepends = [
base containers criterion directory text
];
description = "A configuration language guaranteed to terminate";
license = stdenv.lib.licenses.bsd3;
}