From b597748fa5cdb1656a5e291c83e6d8f6e007f0de Mon Sep 17 00:00:00 2001 From: Anton-Latukha Date: Wed, 24 Jun 2020 03:05:05 +0300 Subject: [PATCH] CI: {build.sh,default.nix}: upd settings structure, upd descriptions M build.sh M default.nix --- build.sh | 12 +++++++++--- default.nix | 11 +++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index 4047b7e..5c9f117 100755 --- a/build.sh +++ b/build.sh @@ -6,10 +6,11 @@ set -Eexuo pipefail ### NOTE: Section handles imports from env, these are settings for Nixpkgs. +# Settings expose most of the Nixpkgs Haskell.lib API: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix # Some of these options implicitly switch the dependent options. -# NOTE: If var not imported - set to the default value +# NOTE: If vars not imported - set to the default value compiler=${compiler:-'ghc8101'} # NOTE: Nix by default uses nixpkgs-unstable channel # Setup for Nixpkgs revision: @@ -29,24 +30,25 @@ export NIX_PATH # NOTE: Project name, used by cachix project=${project:-'defaultProjectName'} -# This settings expose most of the Nixpkgs Haskell.lib API: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix # 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=${allowInconsistentDependencies:-'false'} - # Escape the version bounds from the cabal file. You may want to avoid this function. doJailbreak=${doJailbreak:-'false'} # Nix dependency checking, compilation and execution of test suites listed in the package description file. doCheck=${doCheck:-'true'} + # Just produce a SDist src tarball sdistTarball=${sdistTarball:-'false'} # Produce SDist tarball and build project from it # The strict packaging process as used on Hackage. Tests consistency of the Cabal file. buildFromSdist=${buildFromSdist:-'false'} + # Turn all warn into err with {-Wall,-Werror} failOnAllWarnings=${failOnAllWarnings:-'false'} # `failOnAllWarnings` + `buildFromSdist` buildStrictly=${buildStrictly:-'false'} + # 2020-06-02: NOTE: enableDeadCodeElimination = true: On GHC =< 8.8.3 macOS build falls due to https://gitlab.haskell.org/ghc/ghc/issues/17283 enableDeadCodeElimination=${enableDeadCodeElimination:-'false'} # Disabled GHC code optimizations make build/tolling/dev loops faster. Works for Haskel IDE Engine and GHCID @@ -54,6 +56,7 @@ enableDeadCodeElimination=${enableDeadCodeElimination:-'false'} disableOptimization=${disableOptimization:-'true'} # Use faster `gold` ELF linker from GNU binutils instead of older&slower but more versatile GNU linker. Is not available by default since macOS does not have it. linkWithGold=${linkWithGold:-'false'} + # Provide an inventory of performance events and timings for the execution. Provides informaiton in an absolute sense. Nothing is timestamped. enableLibraryProfiling=${enableLibraryProfiling:-'false'} enableExecutableProfiling=${enableExecutableProfiling:-'false'} @@ -63,6 +66,7 @@ doTracing=${doTracing:-'false'} enableDWARFDebugging=${enableDWARFDebugging:-'false'} # Strip results from all debugging symbols doStrip=${doStrip:-'false'} + # Nixpkgs expects shared libraries enableSharedLibraries=${enableSharedLibraries:-'true'} # Ability to make static libraries @@ -72,6 +76,7 @@ enableSharedExecutables=${enableSharedExecutables:-'false'} # link executables statically against haskell libs to reduce closure size justStaticExecutables=${justStaticExecutables:-'false'} enableSeparateBinOutput=${enableSeparateBinOutput:-'false'} + # Add a post-build check to verify that dependencies declared in the .cabal file are actually used. # checkUnusedPackages: is `failOnAllWarnings` + `cabal sdist` to ensure all needed files are listed in the Cabal file. Currently uses `packunused` or GHC 8.8 internals, later switches into GHC internal feature. Adds a post-build check to verify that dependencies declared in the cabal file are actually used. checkUnusedPackages=${checkUnusedPackages:-'false'} @@ -88,6 +93,7 @@ generateOptparseApplicativeCompletions=${generateOptparseApplicativeCompletions: # [ "binary1" "binary2" ] - should pass " quotes into Nix interpreter executableNamesToShellComplete=${executableNamesToShellComplete:-'[ "defaultBinaryName" ]'} + # Include Hoogle into derivation withHoogle=${withHoogle:-'false'} diff --git a/default.nix b/default.nix index 713752c..ff905bf 100644 --- a/default.nix +++ b/default.nix @@ -12,19 +12,23 @@ , doJailbreak ? false # Nix dependency checking, compilation and execution of test suites listed in the package description file. , doCheck ? true + # Just produce a SDist src tarball , sdistTarball ? false # Produce SDist tarball and build project from it , buildFromSdist ? true + , failOnAllWarnings ? false # `failOnAllWarnings` + `buildFromSdist` , buildStrictly ? false + # 2020-06-02: NOTE: enableDeadCodeElimination = true: On GHC =< 8.8.3 macOS build falls due to https://gitlab.haskell.org/ghc/ghc/issues/17283 , enableDeadCodeElimination ? false # Disable GHC code optimizations for faster dev loops. Enable optimizations for production use or benchmarks. , disableOptimization ? true # Use faster `gold` ELF linker from GNU binutils instead of older&slower but more versatile GNU linker. Is not available by default since macOS does not have it. , linkWithGold ? false + # Provide an inventory of performance events and timings for the execution. Provides informaiton in an absolute sense. Nothing is timestamped. , enableLibraryProfiling ? false , enableExecutableProfiling ? false @@ -34,8 +38,7 @@ , enableDWARFDebugging ? true # Strip results from all debugging symbols , doStrip ? false -# Generate hyperlinked source code for documentation using HsColour, and have Haddock documentation link to it. -, doHyperlinkSource ? false + # Nixpkgs expects shared libraries , enableSharedLibraries ? true # Ability to make static libraries @@ -45,10 +48,13 @@ # link executables statically against haskell libs to reduce closure size , justStaticExecutables ? false , enableSeparateBinOutput ? false + # Add a post-build check to verify that dependencies declared in the .cabal file are actually used. , checkUnusedPackages ? false # Generation and installation of haddock API documentation , doHaddock ? false +# Generate hyperlinked source code for documentation using HsColour, and have Haddock documentation link to it. +, doHyperlinkSource ? false # Generation and installation of a coverage report. See https://wiki.haskell.org/Haskell_program_coverage , doCoverage ? false # doBenchmark: Dependency checking + compilation and execution for benchmarks listed in the package description file. @@ -57,6 +63,7 @@ , generateOptparseApplicativeCompletions ? false , executableNamesToShellComplete ? [ "hnix" ] + , withHoogle ? true