diff --git a/.github/workflows/Cabal-Linux.yml b/.github/workflows/Cabal-Linux.yml index bf44a1a..63a954f 100644 --- a/.github/workflows/Cabal-Linux.yml +++ b/.github/workflows/Cabal-Linux.yml @@ -16,11 +16,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - packageRoots: [ ./ ] ghc: [ "8.10", "8.4" ] - defaults: - run: - working-directory: ${{ matrix.packageRoots }} steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/Nixpkgs-GHCJS-turned-off b/.github/workflows/Nixpkgs-GHCJS-turned-off deleted file mode 100644 index 112a106..0000000 --- a/.github/workflows/Nixpkgs-GHCJS-turned-off +++ /dev/null @@ -1,45 +0,0 @@ -# 2020-08-02: NOTE: GHCJS fails for number of month, and makes GitHub CI "red", because team does not care and not pursue GHCJS build currently - there is no need to test for it. Technically compilation directly to WebAssembly looks much easier task than keeping HQ compilation to JS. WebAssembly compilation https://github.com/tweag/asterius look much more promising. -# 2020-08-02: FIXME: If this is not needed after some time - remove the file. -name: "Nixpkgs, Linux, GHCJS" - -on: - pull_request: - push: - branches: - - master - schedule: - # Every day at 05:45 - - cron: "45 05 * * *" - -env: - useRev: "true" - rev: "nixos-unstable" - cachixAccount: "hnix" - # GitHub secret - CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }} - linkWithGold: "true" - compiler: "ghcjs" - ghcjsTmpLogFile: "/tmp/ghcjsTmpLogFile.log" - ghcjsLogTailLength: "10000" - -jobs: - build10: - name: Build - runs-on: ubuntu-latest - continue-on-error: true - steps: - - name: Git checkout - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Install Nix - uses: cachix/install-nix-action@v10 - - name: Install Cachix - uses: cachix/cachix-action@v6 - with: - name: ${{ env.cachixAccount }} - - name: Determined Nix-build - run: ./build.sh - - name: Print log tail - if: always() - run: tail -n "$ghcjsLogTailLength" "$ghcjsTmpLogFile" && rm "$ghcjsTmpLogFile" diff --git a/.github/workflows/Nixpkgs-Linux-additional.yml b/.github/workflows/Nixpkgs-Linux-additional.yml index 031ec1b..504a2e3 100644 --- a/.github/workflows/Nixpkgs-Linux-additional.yml +++ b/.github/workflows/Nixpkgs-Linux-additional.yml @@ -14,17 +14,8 @@ on: env: - ### - ### NOTE: This configuration uses `build.sh` interface, which uses `default.nix` interface, which exposes the Nixpkgs Haskell Lib interface. - ### - ### Documentation of this settings is mosly in `default.nix`, since most settings it Nixpkgs related - ### and the other part of keys explained in `build.sh`, since those address external procedures aound the builds. - ### Additional documentation is in Nixpkgs Haskell.lib: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix - ### - useRev: "true" rev: "nixos-unstable" cachixAccount: "hnix" - # GitHub secret CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }} linkWithGold: "true" @@ -48,9 +39,33 @@ jobs: uses: cachix/cachix-action@v6 with: name: ${{ env.cachixAccount }} + signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' - name: Determined Nix-build run: ./build.sh + + build30: + name: "NixOS 20.03 stable channel, default GHC (8.8)" + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Git checkout + uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install Nix + uses: cachix/install-nix-action@v10 + - name: Install Cachix + uses: cachix/cachix-action@v6 + with: + name: ${{ env.cachixAccount }} + signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' + - name: Determined Nix-build + env: + rev: "nixos-20.03" + run: ./build.sh + + build50: name: "NixOS-unstable channel, GHC 8.6.5" runs-on: ubuntu-latest @@ -68,5 +83,6 @@ jobs: uses: cachix/cachix-action@v6 with: name: ${{ env.cachixAccount }} + signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' - name: Determined Nix-build run: ./build.sh diff --git a/.github/workflows/Nixpkgs-Linux-main.yml b/.github/workflows/Nixpkgs-Linux-main.yml index 47278ef..11f4ae8 100644 --- a/.github/workflows/Nixpkgs-Linux-main.yml +++ b/.github/workflows/Nixpkgs-Linux-main.yml @@ -22,11 +22,8 @@ env: ### and the other part of keys explained in `build.sh`, since those address external procedures aound the builds. ### Additional documentation is in Nixpkgs Haskell.lib: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix ### - useRev: "true" rev: "nixos-unstable" - # Register and use Cachix account cachixAccount: "hnix" - # GitHub secret CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }} allowInconsistentDependencies: "false" doJailbreak: "false" @@ -76,25 +73,18 @@ jobs: uses: cachix/cachix-action@v6 with: name: ${{ env.cachixAccount }} + signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' - name: Determined Nix-build env: - # nixos-unstable is a nixpkgs-upstable that passed a number of upstream CI and quality checks, it is essentially a current branch while also receives stable updates fitting for our CI checkups with current Nixpkgs. - # Note that Nix nature is purely functional lazy language, it is referentially transparent, reproducible (deterministic) builds, that means that just as in the type system - any the Nix build failures properly cascade through the Nixpkgs tree graph branch, so particular `master` broken checkouts would properly refuse/would not be able to build parts of Nixpkgs tree graph. So the Nix builds are pretty brittle, do not be ashamed to make Nixpkgs builds optional (`continue-on-error: true`), or set them to the latest stable NixOS Nixpkgs release. - useRev: "true" rev: "nixos-unstable" buildStrictly: "true" run: ./build.sh - # NOTE: Example of customization using Nixpkgs Haskell Lib API build20: name: "Quality build, SDist, Optimizations, Benchmark, Haddock, Completions, GHC 8.10.1" runs-on: ubuntu-latest continue-on-error: true - # Matrix of builds for multiple subprojects in a monorepo - strategy: - matrix: - packageRoots: [ ./ ] steps: - name: Git checkout uses: actions/checkout@v2 @@ -106,9 +96,9 @@ jobs: uses: cachix/cachix-action@v6 with: name: ${{ env.cachixAccount }} + signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' - name: Determined Nix-build env: - useRev: "true" rev: "nixos-unstable" compiler: "ghc8101" buildFromSdist: "true" @@ -119,35 +109,9 @@ jobs: enableDeadCodeElimination: "true" doBenchmark: "true" generateOptparseApplicativeCompletions: "true" - # packageRoot for CI builds can be just a paths, since CI uses remote Git repo that is already filtered with local .gitignore's - packageRoot: ${{ matrix.packageRoots }} run: ./build.sh - # NOTE: Build on latest stable NixOS release - build30: - name: "NixOS 20.03 stable channel, default GHC (8.8)" - runs-on: ubuntu-latest - continue-on-error: true - steps: - - name: Git checkout - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Install Nix - uses: cachix/install-nix-action@v10 - - name: Install Cachix - uses: cachix/cachix-action@v6 - with: - name: ${{ env.cachixAccount }} - - name: Determined Nix-build - env: - rev: "nixos-20.03" - run: ./build.sh - - - # NOTE: This would additionally test that the Nix shell customization of the project works. - # By default *this setup provides local hoogle and generates database of the documetation for the project and its dependencies build40: name: "Nix-shell & supplied locall project Hoogle DB" runs-on: ubuntu-latest @@ -163,10 +127,10 @@ jobs: uses: cachix/cachix-action@v6 with: name: ${{ env.cachixAccount }} + signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' - name: Nix-shell run: nix-shell --pure --command 'echo "Evaluated, loaded and entered $IN_NIX_SHELL Nix shell env."' - name: Local Hoogle DB for the project development and tooling run: nix-shell --pure --command 'hoogle True' - # Other samples of tests used in the project see in the directory diff --git a/.github/workflows/Nixpkgs-macOS.yml b/.github/workflows/Nixpkgs-macOS.yml index 715fe8a..aff6eed 100644 --- a/.github/workflows/Nixpkgs-macOS.yml +++ b/.github/workflows/Nixpkgs-macOS.yml @@ -13,16 +13,14 @@ on: env: - useRev: "true" rev: "nixos-unstable" cachixAccount: "hnix" - # GitHub secret CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }} jobs: build10: - name: NixOS-unstable, default GHC (8.8) + name: "NixOS-unstable, default GHC (8.8)" runs-on: macos-latest continue-on-error: true steps: @@ -36,5 +34,6 @@ jobs: uses: cachix/cachix-action@v6 with: name: ${{ env.cachixAccount }} + signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' - name: Determined Nix-build run: ./build.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a398a73..0000000 --- a/.travis.yml +++ /dev/null @@ -1,162 +0,0 @@ -# 2020-05-26: NOTE: Enabling experimental Travis feature of YAML check inside -# Look into: Build #NUM -> Job #NUM.N -> View config -> Build config validation -version: ~> 1.0 - -# NOTE: Please, be aware that Travis YAML & docs & API are hard to make work properly. Travis configuration requires a lot of retries and some compromises. There are many ways that may look like that can be done in that way, but it would not work most of the time, or not work the way that you expect/need it. Travis config works only in certain particular ways. Some things look possible - but they are impossible in Travis. Current configuration is "the best way possible" that was found in ~100-150-200 retries, depending on what one considers a retry. - -# NOTE: Let the official Travis YAML checker help you: https://config.travis-ci.com/explore - -language: nix - -sudo: required # 2020-05-26: This mode is deprecated, but still offers 7.5 GB RAM instead of the default 4GB - -git: - quiet: true # Do not log - depth: 4 # NOTE: "The use of clone depth: 1 often results in a git error - # when a new commit has been pushed to a branch before the CI - # platform started cloning the intended commit." - -# # 2020-05-26: Currently newest macOS image -# osx_image: xcode11.4 # Official Nix installer fails spectacularly on it. - -env: - global: - ### - ### NOTE: This configuration uses `build.sh` interface, which uses `default.nix` interface, which exposes the Nixpkgs Haskell Lib interface. - ### - ### Documentation of this settings is mosly in `default.nix`, since most settings it Nixpkgs related - ### and the other part of keys explained in `build.sh`, since those address external procedures aound the builds. - ### Additional documentation is in Nixpkgs Haskell.lib: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix - ### - # - # - rev=nixos-unstable - # - NIX_PATH="nixpkgs=https://github.com/nixos/nixpkgs/archive/$rev.tar.gz" - - allowInconsistentDependencies='false' - - doJailbreak='false' - - doCheck='true' - - sdistTarball='false' - - buildFromSdist='false' - - buildStrictly='false' - - failOnAllWarnings='false' - - enableDeadCodeElimination='false' - - disableOptimization='true' - - linkWithGold='false' - - enableLibraryProfiling='false' - - enableExecutableProfiling='false' - - doTracing='false' - - enableDWARFDebugging='false' - - doStrip='false' - - enableSharedLibraries='true' - - enableStaticLibraries='false' - - enableSharedExecutables='false' - - justStaticExecutables='false' - - enableSeparateBinOutput='false' - - checkUnusedPackages='false' - - doHaddock='false' - - doHyperlinkSource='false' - - doCoverage='false' - - doBenchmark='false' - - generateOptparseApplicativeCompletions='false' - - executableNamesToShellComplete='[ "hnix" ]' - # - - withHoogle='false' - # - - cachixAccount='hnix' - # NOTE: This is secure CACHIX_SIGNING_KEY=val, it is only available on project internal branches, so Cachix would push only there - - secure: "dm6I+M4+V+C7QMTpcSADdKPE633SvmToXZrTbZ7miNDGmMN+/SfHeN2ybi1+PW6oViMlbPN/7J/aEfiGjSJI8vLk72Y4uCWGmpSb8TXZLu6+whnxtZzzW8+z4tsM4048QJg7CF3N/25U8thRFgs3DqUub1Sf3nG9LrNWdz6ZcDQ=" - # - - ghcjsTmpLogFile='/tmp/ghcjsTmpLogFile.log' - - ghcjsLogTailLength='10000' - -# 2020-05-26: Currently newest Travis dist Ubuntu 18.04 bionic -# {os} x {jobs} + {jobs:include} - {jobs:exclude} = {build matrix} -jobs: - fast_finish: true - include: - - name: Bypass build - env: - - compiler='bypass' - os: linux - dist: bionic - - name: GHC 8.6.5, Linux - env: - - compiler='ghc865' - os: linux - dist: bionic - - name: GHC 8.8.4, macOS - env: - - compiler='ghc884' - os: osx - - name: GHC 8.8.4, Linux - env: - - compiler='ghc884' - os: linux - dist: bionic - - name: GHC 8.10.1, Linux - env: - - compiler='ghc8101' - os: linux - dist: bionic - - name: GHCJS, Linux - env: - - compiler='ghcjs' - os: linux - dist: bionic - allow_failures: - - env: compiler='ghcjs' - - env: compiler='ghc8101' - - env: compiler='ghc884' - - env: compiler='ghc865' - -before_script: - - sudo mkdir -p /etc/nix - - echo "trusted-users = root $USER" | sudo tee -a /etc/nix/nix.conf - # # Linux service restart - - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then sudo systemctl restart nix-daemon.service;fi - # # macOS service restart - - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then sudo launchctl kickstart -k system/org.nixos.nix-daemon; fi - -script: - # Ability to bypass builds - - if [ "${compiler}" = "bypass" ]; then exit; fi - # - # - # Install Cachix client using Nix: - - if [ "${TRAVIS_OS_NAME}" = "linux" ] || [ "${TRAVIS_OS_NAME}" = "osx" ]; then nix-env -iA cachix -f https://cachix.org/api/v1/install; fi - - cachix use "$cachixAccount" - # If key is set - use Cachix push, else - proceed without it - - if [ ! "$CACHIX_SIGNING_KEY" = "" ]; then cachix push "$cachixAccount" --watch-store& fi - # - # - # NOTE: Normal GHC build - - if [ ! "$compiler" = 'ghcjs' ]; then ./build.sh; fi - # - # - # NOTE: GHCJS build - # HACK: Travis terminates GHCJS because of very huge log, - # so `SILENT` mode for it was created - # and travis_wait 50 to wait on no outputs (otherwise Travis terminates build in 10 minutes as stale) - # and `bash` wrapper so Travis parses `travis_wait` => `if; then; fi` line - - travis_wait 50 bash -c 'if [ "$compiler" = "ghcjs" ]; then ./build.sh; fi' - # NOTE: For GHCJS dump the last $ghcjsLogTailLength lines into CI out to see - # Since build runs inside `travis_wait` - it was impossible to output log from it - - if [ "$compiler" = "ghcjs" ]; then tail -n "$ghcjsLogTailLength" "$ghcjsTmpLogFile" && rm "$ghcjsTmpLogFile"; fi - # - # - - -# Track the commits on this repo branches + cron rechecks build -branches: - only: - - master - - pending - -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/b0312b18473340459d3e - # Be silent about CI, until some PR started to pass CI succesfully. - on_success: change - # `master` status in on the front page badge. - on_failure: never - on_start: never diff --git a/build.sh b/build.sh index 9ad3e8a..8826057 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# NOTE: Script for the CI builds, relies on `default.nix` interface, which exposes Nixpkgs Haskell Lib interface +# NOTE: Script to easy import nix-build settings from env, useful for tooling env replication and the CI builds, relies on `default.nix` interface, which exposes Nixpkgs Haskell Lib interface # The most strict error checking requirements set -Eexuo pipefail @@ -13,11 +13,15 @@ set -Eexuo pipefail # NOTE: If vars not imported - init the vars with default values -compiler=${compiler:-'ghc884'} +# Non-set/passed ''/'default' compiler setting means currently default GHC of Nixpkgs ecosystem. +compiler=${compiler:-'default'} + +packageRoot=${packageRoot:-'pkgs.nix-gitignore.gitignoreSource [ ] ./.'} +cabalName=${cabalName:-'hnix'} +rev=${rev:-'default'} # Account in Cachix to use -cachixAccount=${cachixAccount:-'replaceWithProjectNameInCachix'} - +cachixAccount=${cachixAccount:-'hnix'} allowInconsistentDependencies=${allowInconsistentDependencies:-'false'} doJailbreak=${doJailbreak:-'false'} @@ -52,105 +56,27 @@ doCoverage=${doCoverage:-'false'} doBenchmark=${doBenchmark:-'false'} generateOptparseApplicativeCompletions=${generateOptparseApplicativeCompletions:-'false'} # [ "binary1" "binary2" ] - should pass " quotes into Nix interpreter -executableNamesToShellComplete=${executableNamesToShellComplete:-'[ "defaultBinaryName" ]'} +executableNamesToShellComplete=${executableNamesToShellComplete:-'[ "hnix" ]'} withHoogle=${withHoogle:-'false'} -# Log file to dump GHCJS build into -ghcjsTmpLogFile=${ghcjsTmpLogFile:-'/tmp/ghcjsTmpLogFile.log'} -# Length of the GHCJS log tail (<40000) -ghcjsLogTailLength=${ghcjsLogTailLength:-'10000'} # If key not provided (branch is not inside the central repo) - init CACHIX_SIGNING_KEY as empty CACHIX_SIGNING_KEY=${CACHIX_SIGNING_KEY:-""} - -GHCJS_BUILD(){ -# NOTE: Function for GHCJS build that outputs its huge log into a file - - # Run the build into Log (log is too long for Travis) - "$@" &> "$ghcjsTmpLogFile" - -} - -SILENT(){ -# NOTE: Function that silences the build process -# In normal mode outputs only the /nix/store paths - - echo "Log: $ghcjsTmpLogFile" - # Pass into the ghcjsbuild function the build command - if GHCJS_BUILD "$@" - then - - # Output log lines for stdout -> cachix caching - grep '^/nix/store/' "$ghcjsTmpLogFile" - - else - - # Output log lines for stdout -> cachix caching - grep '^/nix/store/' "$ghcjsTmpLogFile" - - # Propagate the error state, fail the CI build - exit 1 - - fi - -} - BUILD_PROJECT(){ IFS=$'\n\t' -if [ "$compiler" = "ghcjs" ] - then - - # GHCJS build - # By itself, GHCJS creates >65000 lines of log that are >4MB in size, so Travis terminates due to log size quota. - # nixbuild --quiet (x5) does not work on GHC JS build - # So there was a need to make it build. - # The solution is to silence the stdout - # But Travis then terminates on 10 min no stdout timeout - # so HACK: SILENT wrapper allows to surpress the huge log, while still preserves the Cachix caching ability in any case of the build - # On build failure outputs the last 10000 lines of log (that should be more then enough), and terminates - SILENT nix-build \ - --arg allowInconsistentDependencies "$allowInconsistentDependencies" \ - --arg doJailbreak "$doJailbreak" \ - --arg doCheck "$doCheck" \ - --arg sdistTarball "$sdistTarball" \ - --arg buildFromSdist "$buildFromSdist" \ - --arg failOnAllWarnings "$failOnAllWarnings" \ - --arg buildStrictly "$buildStrictly" \ - --arg enableDeadCodeElimination "$enableDeadCodeElimination" \ - --arg disableOptimization "$disableOptimization" \ - --arg linkWithGold "$linkWithGold" \ - --arg enableLibraryProfiling "$enableLibraryProfiling" \ - --arg enableExecutableProfiling "$enableExecutableProfiling" \ - --arg doTracing "$doTracing" \ - --arg enableDWARFDebugging "$enableDWARFDebugging" \ - --arg doStrip "$doStrip" \ - --arg doHyperlinkSource "$doHyperlinkSource" \ - --arg enableSharedLibraries "$enableSharedLibraries" \ - --arg enableStaticLibraries "$enableStaticLibraries" \ - --arg enableSharedExecutables "$enableSharedExecutables" \ - --arg justStaticExecutables "$justStaticExecutables" \ - --arg checkUnusedPackages "$checkUnusedPackages" \ - --arg doCoverage "$doCoverage" \ - --arg doHaddock "$doHaddock" \ - --arg doBenchmark "$doBenchmark" \ - --arg generateOptparseApplicativeCompletions "$generateOptparseApplicativeCompletions" \ - --arg executableNamesToShellComplete "$executableNamesToShellComplete" \ - --arg withHoogle "$withHoogle" \ - "$compiler" - - else +if [ ! "$compiler" = "ghcjs" ] + then # Normal GHC build - # GHC sometimes produces logs so big - that Travis terminates builds, so multiple --quiet nix-build \ - --quiet --quiet \ --argstr compiler "$compiler" \ + --argstr rev "$rev" \ --arg allowInconsistentDependencies "$allowInconsistentDependencies" \ --arg doJailbreak "$doJailbreak" \ --arg doCheck "$doCheck" \ diff --git a/default.nix b/default.nix index f98d36d..dd232f8 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,7 @@ { -# Compiler in a form ghc8101 == GHC 8.10.1, just remove spaces and dots -# 2020-07-05: By default using default GHC for Nixpkgs, see https://search.nixos.org/packages?query=ghc&from=0&size=500&channel=unstable for current version (currently ghc883 == GHC 8.8.3) - compiler ? "ghc884" +# Default GHC for Nixpkgs by default, for current default and explicitly supported GHCs https://search.nixos.org/packages?query=ghc&from=0&size=500&channel=unstable, Nixpkgs implicitly supports older minor versions also, until the configuration departs from compatibility with them. +# Compiler in a form ghc8101 <- GHC 8.10.1, just remove spaces and dots + compiler ? "default" # Deafult.nix is a unit package abstraciton that allows to abstract over packages even in monorepos: # Example: pass --arg cabalName --arg packageRoot "./subprojectDir", or map default.nix over a list of tiples for subprojects. @@ -80,7 +80,6 @@ , withHoogle ? true -, useRev ? false # Nix by default updates and uses locally configured nixpkgs-unstable channel # Nixpkgs revision options: # `rev` vals in order of freshness -> cache & stability: @@ -92,16 +91,16 @@ # , nixos-20.03 # Last stable release, gets almost no updates to recipes, gets only required backports # ... # } -, rev ? "nixpkgs-unstable" +, rev ? "default" , pkgs ? if builtins.compareVersions builtins.nixVersion "2.0" < 0 then abort "Requires Nix >= 2.0" else - if useRev + if ((rev == "") || (rev == "default") || (rev == "local")) + then import {} # Do not guard with hash, so the project is able to use current channels (rolling `rev`) of Nixpkgs - then import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz") {} - else import {} + else import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz") {} // { # Try to build dependencies even if they are marked broken. config.allowBroken = true; @@ -112,6 +111,20 @@ let + getDefaultGHC = "ghc${ + ( + # Remove '.' from the string 8.8.4 -> 884 + pkgs.lib.stringAsChars (c: if c == "." then "" else c) + # Get default GHC version, + (pkgs.lib.getVersion pkgs.haskellPackages.ghc) + ) + }"; + + compilerPackage = + if ((compiler == "") || (compiler == "default")) + then getDefaultGHC + else compiler; + # 2020-05-23: NOTE: Currently HNix-store needs no overlay # hnix-store-src = pkgs.fetchFromGitHub { # owner = "haskell-nix"; @@ -122,7 +135,7 @@ let overlay = pkgs.lib.foldr pkgs.lib.composeExtensions (_: _: {}) [ # (import "${hnix-store-src}/overlay.nix") - (self: super: with pkgs.haskell.lib; + (self: super: pkgs.lib.optionalAttrs withHoogle { ghc = super.ghc // { withPackages = super.ghc.withHoogle; }; ghcWithPackages = self.ghc.withPackages; @@ -137,7 +150,7 @@ let else overlay; }; - haskellPackages = pkgs.haskell.packages.${compiler}.override + haskellPackages = pkgs.haskell.packages.${compilerPackage}.override overrideHaskellPackages; # Application of functions from this list to the package in code here happens in the reverse order (from the tail). Some options depend on & override others, so if enabling options caused Nix error or not expected result - change the order, and please do not change this order without proper testing. diff --git a/ghcjs/default.nix b/ghcjs/default.nix deleted file mode 100644 index 8c1b119..0000000 --- a/ghcjs/default.nix +++ /dev/null @@ -1,79 +0,0 @@ -{ rpRef ? "ea3c9a1536a987916502701fb6d319a880fdec96" }: - -let rp = builtins.fetchTarball "https://github.com/reflex-frp/reflex-platform/archive/${rpRef}.tar.gz"; - - hnix-store-src = pkgs: pkgs.fetchFromGitHub { - owner = "haskell-nix"; - repo = "hnix-store"; - rev = "0.1.0.0"; - sha256 = "1z48msfkiys432rkd00fgimjgspp98dci11kgg3v8ddf4mk1s8g0"; - }; - - overlay = pkgs: with pkgs.haskell.lib; self: super: - let guardGhcjs = p: if self.ghc.isGhcjs or false then null else p; - in { - hashing = super.hashing; - haskeline = guardGhcjs super.haskeline; - serialise = doJailbreak super.serialise; - - Glob = guardGhcjs super.Glob; - criterion = guardGhcjs super.criterion; - pretty-show = guardGhcjs super.pretty; - repline = guardGhcjs super.repline; - tasty = guardGhcjs super.tasty; - tasty-hunit = guardGhcjs super.tasty; - tasty-th = guardGhcjs super.tasty; - unix = guardGhcjs super.unix; - - interpolate = self.callCabal2nix "interpolate" (pkgs.fetchFromGitHub { - owner = "sol"; - repo = "interpolate"; - rev = "2d654444365805458e0310d461b3ecd2826977ff"; - sha256 = "01g88j6qv33r6j4yl6yisr9sk3kcvgp81z6qmhr94ka8z45raii9"; - }) {}; - lens-family-th = self.callCabal2nix "lens-family-th" (pkgs.fetchFromGitHub { - owner = "DanBurton"; - repo = "lens-family-th"; - rev = "483be4d5b53cc6253e3926623c3aa9334c53debc"; - sha256 = "099dp4f1wwarvhwgnm4nhymnnwlqgrsgrfd8ch6dwmy6myzv2dij"; - }) {}; - megaparsec = dontCheck (self.callCabal2nix "megaparsec" (pkgs.fetchFromGitHub { - owner = "mrkkrp"; - repo = "megaparsec"; - rev = "7b271a5edc1af59fa435a705349310cfdeaaa7e9"; - sha256 = "0415z18gl8dgms57rxzp870dpz7rcqvy008wrw5r22xw8qq0s13c"; - }) {}); - parser-combinators = self.callCabal2nix "parser-combinators" (pkgs.fetchFromGitHub { - owner = "mrkkrp"; - repo = "parser-combinators"; - rev = "dd6599224fe7eb224477ef8e9269602fb6b79fe0"; - sha256 = "11cpfzlb6vl0r5i7vbhp147cfxds248fm5xq8pwxk92d1f5g9pxm"; - }) {}; - # Should be callHackage, but it gives an error "found zero or more than one cabal file" - # unordered-containers = pkgs.haskellPackages.callHackage "unordered-containers" "0.2.9.0" {}; - unordered-containers = self.callCabal2nix "unordered-containers" (pkgs.fetchFromGitHub { - owner = "tibbe"; - repo = "unordered-containers"; - rev = "0a6b84ec103e28b73458f385ef846a7e2d3ea42f"; - sha256 = "128q8k4py2wr1v0gmyvqvzikk6sksl9aqj0lxzf46763lis8x9my"; - }) {}; - }; -in - (import rp {}).project ({ pkgs, ... }: - { - name = "hnix-ghcjs"; - overrides = pkgs.lib.foldr pkgs.lib.composeExtensions (_: _: {}) - [ - (import "${hnix-store-src pkgs}/overlay.nix") - (overlay pkgs) - ]; - packages = { - hnix = ../.; - }; - - shells = { - # ghc = [ "hnix" ]; - ghcjs = [ "hnix" ]; - }; - - }) diff --git a/ghcjs/nix.conf b/ghcjs/nix.conf deleted file mode 100644 index 1976d0a..0000000 --- a/ghcjs/nix.conf +++ /dev/null @@ -1,2 +0,0 @@ -binary-caches = https://nixcache.reflex-frp.org https://cache.nixos.org/ -binary-cache-public-keys = ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=