push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,697 @@
# TODO(@Ericson2314): Remove `pkgs` param, which is only used for
# `buildStackProject`, `justStaticExecutables` and `checkUnusedPackages`
{ pkgs, lib }:
rec {
/*
This function takes a file like `hackage-packages.nix` and constructs
a full package set out of that.
*/
makePackageSet = import ../make-package-set.nix;
/*
The function overrideCabal lets you alter the arguments to the
mkDerivation function.
Example:
First, note how the aeson package is constructed in hackage-packages.nix:
"aeson" = callPackage ({ mkDerivation, attoparsec, <snip>
}:
mkDerivation {
pname = "aeson";
<snip>
homepage = "https://github.com/bos/aeson";
})
The mkDerivation function of haskellPackages will take care of putting
the homepage in the right place, in meta.
> haskellPackages.aeson.meta.homepage
"https://github.com/bos/aeson"
> x = haskell.lib.compose.overrideCabal (old: { homepage = old.homepage + "#readme"; }) haskellPackages.aeson
> x.meta.homepage
"https://github.com/bos/aeson#readme"
*/
overrideCabal =
f: drv:
(drv.override (
args:
args
// {
mkDerivation = drv: (args.mkDerivation drv).override f;
}
))
// {
overrideScope = scope: overrideCabal f (drv.overrideScope scope);
};
# : Map Name (Either Path VersionNumber) -> HaskellPackageOverrideSet
# Given a set whose values are either paths or version strings, produces
# a package override set (i.e. (self: super: { etc. })) that sets
# the packages named in the input set to the corresponding versions
packageSourceOverrides =
overrides: self: super:
pkgs.lib.mapAttrs (
name: src:
let
isPath = x: builtins.substring 0 1 (toString x) == "/";
generateExprs = if isPath src then self.callCabal2nix else self.callHackage;
in
generateExprs name src { }
) overrides;
/*
doCoverage modifies a haskell package to enable the generation
and installation of a coverage report.
See https://wiki.haskell.org/Haskell_program_coverage
*/
doCoverage = overrideCabal (drv: {
doCoverage = true;
});
/*
dontCoverage modifies a haskell package to disable the generation
and installation of a coverage report.
*/
dontCoverage = overrideCabal (drv: {
doCoverage = false;
});
/*
doHaddock modifies a haskell package to enable the generation and
installation of API documentation from code comments using the
haddock tool.
*/
doHaddock = overrideCabal (drv: {
doHaddock = true;
});
/*
dontHaddock modifies a haskell package to disable the generation and
installation of API documentation from code comments using the
haddock tool.
*/
dontHaddock = overrideCabal (drv: {
doHaddock = false;
});
/*
doJailbreak enables the removal of version bounds from the cabal
file. You may want to avoid this function.
This is useful when a package reports that it can not be built
due to version mismatches. In some cases, removing the version
bounds entirely is an easy way to make a package build, but at
the risk of breaking software in non-obvious ways now or in the
future.
Instead of jailbreaking, you can patch the cabal file.
Note that jailbreaking at this time, doesn't lift bounds on
conditional branches.
https://github.com/peti/jailbreak-cabal/issues/7 has further details.
*/
doJailbreak = overrideCabal (drv: {
jailbreak = true;
});
/*
dontJailbreak restores the use of the version bounds the check
the use of dependencies in the package description.
*/
dontJailbreak = overrideCabal (drv: {
jailbreak = false;
});
/*
doCheck enables dependency checking, compilation and execution
of test suites listed in the package description file.
*/
doCheck = overrideCabal (drv: {
doCheck = true;
});
/*
dontCheck disables dependency checking, compilation and execution
of test suites listed in the package description file.
*/
dontCheck = overrideCabal (drv: {
doCheck = false;
});
/*
The dontCheckIf variant sets doCheck = false if the condition
applies. In any other case the previously set/default value is used.
This prevents accidentally re-enabling tests in a later override.
*/
dontCheckIf = condition: if condition then dontCheck else lib.id;
/*
doBenchmark enables dependency checking and compilation
for benchmarks listed in the package description file.
Benchmarks are, however, not executed at the moment.
*/
doBenchmark = overrideCabal (drv: {
doBenchmark = true;
});
/*
dontBenchmark disables dependency checking, compilation and execution
for benchmarks listed in the package description file.
*/
dontBenchmark = overrideCabal (drv: {
doBenchmark = false;
});
/*
doDistribute enables the distribution of binaries for the package
via hydra.
*/
doDistribute = overrideCabal (drv: {
# lib.platforms.all is the default value for platforms (since GHC can cross-compile)
hydraPlatforms = lib.subtractLists (drv.badPlatforms or [ ]) (drv.platforms or lib.platforms.all);
});
/*
dontDistribute disables the distribution of binaries for the package
via hydra.
*/
dontDistribute = overrideCabal (drv: {
hydraPlatforms = [ ];
});
/*
appendConfigureFlag adds a single argument that will be passed to the
cabal configure command, after the arguments that have been defined
in the initial declaration or previous overrides.
Example:
> haskell.lib.compose.appendConfigureFlag "--profiling-detail=all-functions" haskellPackages.servant
*/
appendConfigureFlag = x: appendConfigureFlags [ x ];
appendConfigureFlags =
xs:
overrideCabal (drv: {
configureFlags = (drv.configureFlags or [ ]) ++ xs;
});
appendBuildFlag =
x:
overrideCabal (drv: {
buildFlags = (drv.buildFlags or [ ]) ++ [ x ];
});
appendBuildFlags =
xs:
overrideCabal (drv: {
buildFlags = (drv.buildFlags or [ ]) ++ xs;
});
/*
removeConfigureFlag drv x is a Haskell package like drv, but with
all cabal configure arguments that are equal to x removed.
> haskell.lib.compose.removeConfigureFlag "--verbose" haskellPackages.servant
*/
removeConfigureFlag =
x:
overrideCabal (drv: {
configureFlags = lib.remove x (drv.configureFlags or [ ]);
});
addBuildTool = x: addBuildTools [ x ];
addBuildTools =
xs:
overrideCabal (drv: {
buildTools = (drv.buildTools or [ ]) ++ xs;
});
addExtraLibrary = x: addExtraLibraries [ x ];
addExtraLibraries =
xs:
overrideCabal (drv: {
extraLibraries = (drv.extraLibraries or [ ]) ++ xs;
});
addBuildDepend = x: addBuildDepends [ x ];
addBuildDepends =
xs:
overrideCabal (drv: {
buildDepends = (drv.buildDepends or [ ]) ++ xs;
});
addTestToolDepend = x: addTestToolDepends [ x ];
addTestToolDepends =
xs:
overrideCabal (drv: {
testToolDepends = (drv.testToolDepends or [ ]) ++ xs;
});
addPkgconfigDepend = x: addPkgconfigDepends [ x ];
addPkgconfigDepends =
xs:
overrideCabal (drv: {
pkg-configDepends = (drv.pkg-configDepends or [ ]) ++ xs;
});
addSetupDepend = x: addSetupDepends [ x ];
addSetupDepends =
xs:
overrideCabal (drv: {
setupHaskellDepends = (drv.setupHaskellDepends or [ ]) ++ xs;
});
enableCabalFlag = x: drv: appendConfigureFlag "-f${x}" (removeConfigureFlag "-f-${x}" drv);
disableCabalFlag = x: drv: appendConfigureFlag "-f-${x}" (removeConfigureFlag "-f${x}" drv);
markBroken = overrideCabal (drv: {
broken = true;
hydraPlatforms = [ ];
});
unmarkBroken = overrideCabal (drv: {
broken = false;
});
markBrokenVersion =
version: drv:
assert drv.version == version;
markBroken drv;
markUnbroken = overrideCabal (drv: {
broken = false;
});
/*
disableParallelBuilding drops the -j<n> option from the GHC
command line for the given package. This can be useful in rare
situations where parallel building of a package causes GHC to
fail for some reason.
*/
disableParallelBuilding = overrideCabal (drv: {
enableParallelBuilding = false;
});
enableLibraryProfiling = overrideCabal (drv: {
enableLibraryProfiling = true;
});
disableLibraryProfiling = overrideCabal (drv: {
enableLibraryProfiling = false;
});
enableExecutableProfiling = overrideCabal (drv: {
enableExecutableProfiling = true;
});
disableExecutableProfiling = overrideCabal (drv: {
enableExecutableProfiling = false;
});
enableSharedExecutables = overrideCabal (drv: {
enableSharedExecutables = true;
});
disableSharedExecutables = overrideCabal (drv: {
enableSharedExecutables = false;
});
enableSharedLibraries = overrideCabal (drv: {
enableSharedLibraries = true;
});
disableSharedLibraries = overrideCabal (drv: {
enableSharedLibraries = false;
});
enableDeadCodeElimination = overrideCabal (drv: {
enableDeadCodeElimination = true;
});
disableDeadCodeElimination = overrideCabal (drv: {
enableDeadCodeElimination = false;
});
enableStaticLibraries = overrideCabal (drv: {
enableStaticLibraries = true;
});
disableStaticLibraries = overrideCabal (drv: {
enableStaticLibraries = false;
});
enableSeparateBinOutput = overrideCabal (drv: {
enableSeparateBinOutput = true;
});
appendPatch = x: appendPatches [ x ];
appendPatches =
xs:
overrideCabal (drv: {
patches = (drv.patches or [ ]) ++ xs;
});
/*
Set a specific build target instead of compiling all targets in the package.
For example, imagine we have a .cabal file with a library, and 2 executables "dev" and "server".
We can build only "server" and not wait on the compilation of "dev" by using setBuildTarget as follows:
> setBuildTarget "server" (callCabal2nix "thePackageName" thePackageSrc {})
*/
setBuildTargets =
xs:
overrideCabal (drv: {
buildTarget = lib.concatStringsSep " " xs;
});
setBuildTarget = x: setBuildTargets [ x ];
doHyperlinkSource = overrideCabal (drv: {
hyperlinkSource = true;
});
dontHyperlinkSource = overrideCabal (drv: {
hyperlinkSource = false;
});
disableHardening =
flags:
overrideCabal (drv: {
hardeningDisable = flags;
});
/*
Let Nix strip the binary files.
This removes debugging symbols.
*/
doStrip = overrideCabal (drv: {
dontStrip = false;
});
/*
Stop Nix from stripping the binary files.
This keeps debugging symbols.
*/
dontStrip = overrideCabal (drv: {
dontStrip = true;
});
/*
Useful for debugging segfaults with gdb.
This includes dontStrip.
*/
enableDWARFDebugging =
drv:
# -g: enables debugging symbols
# --disable-*-stripping: tell GHC not to strip resulting binaries
# dontStrip: see above
appendConfigureFlag "--ghc-options=-g --disable-executable-stripping --disable-library-stripping" (
dontStrip drv
);
/*
Create a source distribution tarball like those found on hackage,
instead of building the package.
*/
sdistTarball =
pkg:
lib.overrideDerivation pkg (drv: {
name = "${drv.pname}-source-${drv.version}";
# Since we disable the haddock phase, we also need to override the
# outputs since the separate doc output will not be produced.
outputs = [ "out" ];
buildPhase = "./Setup sdist";
haddockPhase = ":";
checkPhase = ":";
installPhase = "install -D dist/${drv.pname}-*.tar.gz $out/${drv.pname}-${drv.version}.tar.gz";
fixupPhase = ":";
});
/*
Create a documentation tarball suitable for uploading to Hackage instead
of building the package.
*/
documentationTarball =
pkg:
pkgs.lib.overrideDerivation pkg (drv: {
name = "${drv.name}-docs";
# Like sdistTarball, disable the "doc" output here.
outputs = [ "out" ];
buildPhase = ''
runHook preHaddock
./Setup haddock --for-hackage
runHook postHaddock
'';
haddockPhase = ":";
checkPhase = ":";
installPhase = ''
runHook preInstall
mkdir -p "$out"
tar --format=ustar \
-czf "$out/${drv.name}-docs.tar.gz" \
-C dist/doc/html "${drv.name}-docs"
runHook postInstall
'';
});
/*
Use the gold linker. It is a linker for ELF that is designed
"to run as fast as possible on modern systems"
*/
linkWithGold = appendConfigureFlag "--ghc-option=-optl-fuse-ld=gold --ld-option=-fuse-ld=gold --with-ld=ld.gold";
/*
link executables statically against haskell libs to reduce
closure size
*/
justStaticExecutables = overrideCabal (drv: {
enableSharedExecutables = false;
enableLibraryProfiling = drv.enableExecutableProfiling or false;
isLibrary = false;
doHaddock = false;
postFixup = drv.postFixup or "" + ''
# Remove every directory which could have links to other store paths.
rm -rf $out/lib $out/nix-support $out/share/doc
'';
disallowGhcReference = true;
});
/*
Build a source distribution tarball instead of using the source files
directly. The effect is that the package is built as if it were published
on hackage. This can be used as a test for the source distribution,
assuming the build fails when packaging mistakes are in the cabal file.
A faster implementation using `cabal-install` is available as
`buildFromCabalSdist` in your Haskell package set.
*/
buildFromSdist =
pkg:
overrideCabal (drv: {
src = "${sdistTarball pkg}/${pkg.pname}-${pkg.version}.tar.gz";
# Revising and jailbreaking the cabal file has been handled in sdistTarball
revision = null;
editedCabalFile = null;
jailbreak = false;
}) pkg;
/*
Build the package in a strict way to uncover potential problems.
This includes buildFromSdist and failOnAllWarnings.
*/
buildStrictly = pkg: buildFromSdist (failOnAllWarnings pkg);
# Disable core optimizations, significantly speeds up build time
disableOptimization = appendConfigureFlag "--disable-optimization";
/*
Turn on most of the compiler warnings and fail the build if any
of them occur.
*/
failOnAllWarnings = appendConfigureFlag "--ghc-option=-Wall --ghc-option=-Werror";
/*
Add a post-build check to verify that dependencies declared in
the cabal file are actually used.
The first attrset argument can be used to configure the strictness
of this check and a list of ignored package names that would otherwise
cause false alarms.
*/
checkUnusedPackages =
{
ignoreEmptyImports ? false,
ignoreMainModule ? false,
ignorePackages ? [ ],
}:
drv:
overrideCabal (_drv: {
postBuild =
let
args = lib.concatStringsSep " " (
lib.optional ignoreEmptyImports "--ignore-empty-imports"
++ lib.optional ignoreMainModule "--ignore-main-module"
++ map (pkg: "--ignore-package ${pkg}") ignorePackages
);
in
"${pkgs.haskellPackages.packunused}/bin/packunused" + lib.optionalString (args != "") " ${args}";
}) (appendConfigureFlag "--ghc-option=-ddump-minimal-imports" drv);
buildStackProject = pkgs.callPackage ../generic-stack-builder.nix { };
/*
Add a dummy command to trigger a build despite an equivalent
earlier build that is present in the store or cache.
*/
triggerRebuild =
i:
overrideCabal (drv: {
postUnpack = drv.postUnpack or "" + ''
# trigger rebuild ${toString i}
'';
});
/*
Override the sources for the package and optionally the version.
This also takes of removing editedCabalFile.
*/
overrideSrc =
{
src,
version ? null,
}:
drv:
overrideCabal (_: {
inherit src;
version = if version == null then drv.version else version;
editedCabalFile = null;
}) drv;
# Get all of the build inputs of a haskell package, divided by category.
getBuildInputs = p: p.getBuildInputs;
# Extract the haskell build inputs of a haskell package.
# This is useful to build environments for developing on that
# package.
getHaskellBuildInputs = p: (getBuildInputs p).haskellBuildInputs;
# Under normal evaluation, simply return the original package. Under
# nix-shell evaluation, return a nix-shell optimized environment.
shellAware = p: if lib.inNixShell then p.env else p;
# Utility to convert a directory full of `cabal2nix`-generated files into a
# package override set
#
# packagesFromDirectory : { directory : Directory, ... } -> HaskellPackageOverrideSet
packagesFromDirectory =
{ directory, ... }:
self: super:
let
haskellPaths = lib.filter (lib.hasSuffix ".nix") (builtins.attrNames (builtins.readDir directory));
toKeyVal = file: {
name = builtins.replaceStrings [ ".nix" ] [ "" ] file;
value = self.callPackage (directory + "/${file}") { };
};
in
builtins.listToAttrs (map toKeyVal haskellPaths);
/*
INTERNAL function retained for backwards compatibility, use
haskell.packages.*.generateOptparseApplicativeCompletions instead!
*/
__generateOptparseApplicativeCompletion =
exeName:
overrideCabal (drv: {
postInstall = (drv.postInstall or "") + ''
bashCompDir="''${!outputBin}/share/bash-completion/completions"
zshCompDir="''${!outputBin}/share/zsh/vendor-completions"
fishCompDir="''${!outputBin}/share/fish/vendor_completions.d"
mkdir -p "$bashCompDir" "$zshCompDir" "$fishCompDir"
"''${!outputBin}/bin/${exeName}" --bash-completion-script "''${!outputBin}/bin/${exeName}" >"$bashCompDir/${exeName}"
"''${!outputBin}/bin/${exeName}" --zsh-completion-script "''${!outputBin}/bin/${exeName}" >"$zshCompDir/_${exeName}"
"''${!outputBin}/bin/${exeName}" --fish-completion-script "''${!outputBin}/bin/${exeName}" >"$fishCompDir/${exeName}.fish"
# Sanity check
grep -F ${exeName} <$bashCompDir/${exeName} >/dev/null || {
echo 'Could not find ${exeName} in completion script.'
exit 1
}
'';
});
/*
Retained for backwards compatibility.
Use haskell.packages.*.generateOptparseApplicativeCompletions
which is cross aware instead.
*/
generateOptparseApplicativeCompletions =
commands: pkg:
lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2211)
"haskellLib.generateOptparseApplicativeCompletions is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions. Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!"
(pkgs.lib.foldr __generateOptparseApplicativeCompletion pkg commands);
/*
Retained for backwards compatibility.
Use haskell.packages.*.generateOptparseApplicativeCompletions
which is cross aware instead.
*/
generateOptparseApplicativeCompletion =
command: pkg:
lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2211)
"haskellLib.generateOptparseApplicativeCompletion is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions (plural!). Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!"
(__generateOptparseApplicativeCompletion command pkg);
# Don't fail at configure time if there are multiple versions of the
# same package in the (recursive) dependencies of the package being
# built. Will delay failures, if any, to compile time.
allowInconsistentDependencies = overrideCabal (drv: {
allowInconsistentDependencies = true;
});
# Work around a Cabal bug requiring pkg-config --static --libs to work even
# when linking dynamically, affecting Cabal 3.8 and 3.9.
# https://github.com/haskell/cabal/issues/8455
#
# For this, we treat the runtime system/pkg-config dependencies of a Haskell
# derivation as if they were propagated from their dependencies which allows
# pkg-config --static to work in most cases.
#
# Warning: This function may change or be removed at any time, e.g. if we find
# a different workaround, upstream fixes the bug or we patch Cabal.
__CabalEagerPkgConfigWorkaround =
let
# Take list of derivations and return list of the transitive dependency
# closure, only taking into account buildInputs. Loosely based on
# closePropagationFast.
propagatedPlainBuildInputs =
drvs:
map (i: i.val) (
builtins.genericClosure {
startSet = map (drv: {
key = drv.outPath;
val = drv;
}) drvs;
operator =
{ val, ... }:
if !lib.isDerivation val then
[ ]
else
builtins.concatMap (
drv:
if !lib.isDerivation drv then
[ ]
else
[
{
key = drv.outPath;
val = drv;
}
]
) (val.buildInputs or [ ] ++ val.propagatedBuildInputs or [ ]);
}
);
in
overrideCabal (old: {
benchmarkPkgconfigDepends = propagatedPlainBuildInputs old.benchmarkPkgconfigDepends or [ ];
executablePkgconfigDepends = propagatedPlainBuildInputs old.executablePkgconfigDepends or [ ];
libraryPkgconfigDepends = propagatedPlainBuildInputs old.libraryPkgconfigDepends or [ ];
testPkgconfigDepends = propagatedPlainBuildInputs old.testPkgconfigDepends or [ ];
});
}

View File

@@ -0,0 +1,380 @@
# TODO(@Ericson2314): Remove `pkgs` param, which is only used for
# `buildStackProject`, `justStaticExecutables` and `checkUnusedPackages`
{ pkgs, lib }:
rec {
/*
The same functionality as this haskell.lib, except that the derivation
being overridden is always the last parameter. This permits more natural
composition of several overrides, i.e. without having to nestle one call
between the function name and argument of another. haskell.lib.compose is
preferred for any new code.
*/
compose = import ./compose.nix { inherit pkgs lib; };
/*
This function takes a file like `hackage-packages.nix` and constructs
a full package set out of that.
*/
makePackageSet = compose.makePackageSet;
/*
The function overrideCabal lets you alter the arguments to the
mkDerivation function.
Example:
First, note how the aeson package is constructed in hackage-packages.nix:
"aeson" = callPackage ({ mkDerivation, attoparsec, <snip>
}:
mkDerivation {
pname = "aeson";
<snip>
homepage = "https://github.com/bos/aeson";
})
The mkDerivation function of haskellPackages will take care of putting
the homepage in the right place, in meta.
> haskellPackages.aeson.meta.homepage
"https://github.com/bos/aeson"
> x = haskell.lib.overrideCabal haskellPackages.aeson (old: { homepage = old.homepage + "#readme"; })
> x.meta.homepage
"https://github.com/bos/aeson#readme"
*/
overrideCabal = drv: f: compose.overrideCabal f drv;
# : Map Name (Either Path VersionNumber) -> HaskellPackageOverrideSet
# Given a set whose values are either paths or version strings, produces
# a package override set (i.e. (self: super: { etc. })) that sets
# the packages named in the input set to the corresponding versions
packageSourceOverrides = compose.packageSourceOverrides;
/*
doCoverage modifies a haskell package to enable the generation
and installation of a coverage report.
See https://wiki.haskell.org/Haskell_program_coverage
*/
doCoverage = compose.doCoverage;
/*
dontCoverage modifies a haskell package to disable the generation
and installation of a coverage report.
*/
dontCoverage = compose.dontCoverage;
/*
doHaddock modifies a haskell package to enable the generation and
installation of API documentation from code comments using the
haddock tool.
*/
doHaddock = compose.doHaddock;
/*
dontHaddock modifies a haskell package to disable the generation and
installation of API documentation from code comments using the
haddock tool.
*/
dontHaddock = compose.dontHaddock;
/*
doJailbreak enables the removal of version bounds from the cabal
file. You may want to avoid this function.
This is useful when a package reports that it can not be built
due to version mismatches. In some cases, removing the version
bounds entirely is an easy way to make a package build, but at
the risk of breaking software in non-obvious ways now or in the
future.
Instead of jailbreaking, you can patch the cabal file.
Note that jailbreaking at this time, doesn't lift bounds on
conditional branches.
https://github.com/peti/jailbreak-cabal/issues/7 has further details.
*/
doJailbreak = compose.doJailbreak;
/*
dontJailbreak restores the use of the version bounds the check
the use of dependencies in the package description.
*/
dontJailbreak = compose.dontJailbreak;
/*
doCheck enables dependency checking, compilation and execution
of test suites listed in the package description file.
*/
doCheck = compose.doCheck;
/*
dontCheck disables dependency checking, compilation and execution
of test suites listed in the package description file.
*/
dontCheck = compose.dontCheck;
/*
The dontCheckIf variant sets doCheck = false if the condition
applies. In any other case the previously set/default value is used.
This prevents accidentally re-enabling tests in a later override.
*/
dontCheckIf = drv: condition: compose.dontCheckIf condition drv;
/*
doBenchmark enables dependency checking, compilation and execution
for benchmarks listed in the package description file.
*/
doBenchmark = compose.doBenchmark;
/*
dontBenchmark disables dependency checking, compilation and execution
for benchmarks listed in the package description file.
*/
dontBenchmark = compose.dontBenchmark;
/*
doDistribute enables the distribution of binaries for the package
via hydra.
*/
doDistribute = compose.doDistribute;
/*
dontDistribute disables the distribution of binaries for the package
via hydra.
*/
dontDistribute = compose.dontDistribute;
/*
appendConfigureFlag adds a single argument that will be passed to the
cabal configure command, after the arguments that have been defined
in the initial declaration or previous overrides.
Example:
> haskell.lib.appendConfigureFlag haskellPackages.servant "--profiling-detail=all-functions"
*/
appendConfigureFlag = drv: x: compose.appendConfigureFlag x drv;
appendConfigureFlags = drv: xs: compose.appendConfigureFlags xs drv;
appendBuildFlag = drv: x: compose.appendBuildFlag x drv;
appendBuildFlags = drv: xs: compose.appendBuildFlags xs drv;
/*
removeConfigureFlag drv x is a Haskell package like drv, but with
all cabal configure arguments that are equal to x removed.
> haskell.lib.removeConfigureFlag haskellPackages.servant "--verbose"
*/
removeConfigureFlag = drv: x: compose.removeConfigureFlag x drv;
addBuildTool = drv: x: compose.addBuildTool x drv;
addBuildTools = drv: xs: compose.addBuildTools xs drv;
addExtraLibrary = drv: x: compose.addExtraLibrary x drv;
addExtraLibraries = drv: xs: compose.addExtraLibraries xs drv;
addBuildDepend = drv: x: compose.addBuildDepend x drv;
addBuildDepends = drv: xs: compose.addBuildDepends xs drv;
addTestToolDepend = drv: x: compose.addTestToolDepend x drv;
addTestToolDepends = drv: xs: compose.addTestToolDepends xs drv;
addPkgconfigDepend = drv: x: compose.addPkgconfigDepend x drv;
addPkgconfigDepends = drv: xs: compose.addPkgconfigDepends xs drv;
addSetupDepend = drv: x: compose.addSetupDepend x drv;
addSetupDepends = drv: xs: compose.addSetupDepends xs drv;
enableCabalFlag = drv: x: compose.enableCabalFlag x drv;
disableCabalFlag = drv: x: compose.disableCabalFlag x drv;
markBroken = compose.markBroken;
unmarkBroken = compose.unmarkBroken;
markBrokenVersion = compose.markBrokenVersion;
markUnbroken = compose.markUnbroken;
disableParallelBuilding = compose.disableParallelBuilding;
enableLibraryProfiling = compose.enableLibraryProfiling;
disableLibraryProfiling = compose.disableLibraryProfiling;
enableExecutableProfiling = compose.enableExecutableProfiling;
disableExecutableProfiling = compose.disableExecutableProfiling;
enableSharedExecutables = compose.enableSharedExecutables;
disableSharedExecutables = compose.disableSharedExecutables;
enableSharedLibraries = compose.enableSharedLibraries;
disableSharedLibraries = compose.disableSharedLibraries;
enableDeadCodeElimination = compose.enableDeadCodeElimination;
disableDeadCodeElimination = compose.disableDeadCodeElimination;
enableStaticLibraries = compose.enableStaticLibraries;
disableStaticLibraries = compose.disableStaticLibraries;
enableSeparateBinOutput = compose.enableSeparateBinOutput;
appendPatch = drv: x: compose.appendPatch x drv;
appendPatches = drv: xs: compose.appendPatches xs drv;
/*
Set a specific build target instead of compiling all targets in the package.
For example, imagine we have a .cabal file with a library, and 2 executables "dev" and "server".
We can build only "server" and not wait on the compilation of "dev" by using setBuildTarget as follows:
setBuildTarget (callCabal2nix "thePackageName" thePackageSrc {}) "server"
*/
setBuildTargets = drv: xs: compose.setBuildTargets xs drv;
setBuildTarget = drv: x: compose.setBuildTarget x drv;
doHyperlinkSource = compose.doHyperlinkSource;
dontHyperlinkSource = compose.dontHyperlinkSource;
disableHardening = drv: flags: compose.disableHardening flags drv;
/*
Let Nix strip the binary files.
This removes debugging symbols.
*/
doStrip = compose.doStrip;
/*
Stop Nix from stripping the binary files.
This keeps debugging symbols.
*/
dontStrip = compose.dontStrip;
/*
Useful for debugging segfaults with gdb.
This includes dontStrip.
*/
enableDWARFDebugging = compose.enableDWARFDebugging;
/*
Create a source distribution tarball like those found on hackage,
instead of building the package.
*/
sdistTarball = compose.sdistTarball;
/*
Create a documentation tarball suitable for uploading to Hackage instead
of building the package.
*/
documentationTarball = compose.documentationTarball;
/*
Use the gold linker. It is a linker for ELF that is designed
"to run as fast as possible on modern systems"
*/
linkWithGold = compose.linkWithGold;
/*
link executables statically against haskell libs to reduce
closure size
*/
justStaticExecutables = compose.justStaticExecutables;
/*
Build a source distribution tarball instead of using the source files
directly. The effect is that the package is built as if it were published
on hackage. This can be used as a test for the source distribution,
assuming the build fails when packaging mistakes are in the cabal file.
*/
buildFromSdist = compose.buildFromSdist;
/*
Build the package in a strict way to uncover potential problems.
This includes buildFromSdist and failOnAllWarnings.
*/
buildStrictly = compose.buildStrictly;
# Disable core optimizations, significantly speeds up build time
disableOptimization = compose.disableOptimization;
/*
Turn on most of the compiler warnings and fail the build if any
of them occur.
*/
failOnAllWarnings = compose.failOnAllWarnings;
/*
Add a post-build check to verify that dependencies declared in
the cabal file are actually used.
The first attrset argument can be used to configure the strictness
of this check and a list of ignored package names that would otherwise
cause false alarms.
*/
checkUnusedPackages = compose.checkUnusedPackages;
buildStackProject = compose.buildStackProject;
/*
Add a dummy command to trigger a build despite an equivalent
earlier build that is present in the store or cache.
*/
triggerRebuild = drv: i: compose.triggerRebuild i drv;
/*
Override the sources for the package and optionally the version.
This also takes of removing editedCabalFile.
*/
overrideSrc = drv: src: compose.overrideSrc src drv;
# Get all of the build inputs of a haskell package, divided by category.
getBuildInputs = compose.getBuildInputs;
# Extract the haskell build inputs of a haskell package.
# This is useful to build environments for developing on that
# package.
getHaskellBuildInputs = compose.getHaskellBuildInputs;
# Under normal evaluation, simply return the original package. Under
# nix-shell evaluation, return a nix-shell optimized environment.
shellAware = compose.shellAware;
# Utility to convert a directory full of `cabal2nix`-generated files into a
# package override set
#
# packagesFromDirectory : { directory : Directory, ... } -> HaskellPackageOverrideSet
packagesFromDirectory = compose.packagesFromDirectory;
addOptparseApplicativeCompletionScripts =
exeName: pkg:
lib.warn "addOptparseApplicativeCompletionScripts is deprecated in favor of haskellPackages.generateOptparseApplicativeCompletions. Please change ${pkg.name} to use the latter and make sure it uses its matching haskell.packages set!" (
compose.__generateOptparseApplicativeCompletion exeName pkg
);
/*
Modify a Haskell package to add shell completion scripts for the
given executable produced by it. These completion scripts will be
picked up automatically if the resulting derivation is installed,
e.g. by `nix-env -i`.
Invocation:
generateOptparseApplicativeCompletions command pkg
command: name of an executable
pkg: Haskell package that builds the executables
*/
generateOptparseApplicativeCompletion = compose.generateOptparseApplicativeCompletion;
/*
Modify a Haskell package to add shell completion scripts for the
given executables produced by it. These completion scripts will be
picked up automatically if the resulting derivation is installed,
e.g. by `nix-env -i`.
Invocation:
generateOptparseApplicativeCompletions commands pkg
commands: name of an executable
pkg: Haskell package that builds the executables
*/
generateOptparseApplicativeCompletions = compose.generateOptparseApplicativeCompletions;
# Don't fail at configure time if there are multiple versions of the
# same package in the (recursive) dependencies of the package being
# built. Will delay failures, if any, to compile time.
allowInconsistentDependencies = compose.allowInconsistentDependencies;
}