Document not found (404)
+This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +diff --git a/.envrc b/.envrc deleted file mode 100644 index 3550a30f2d..0000000000 --- a/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 3f71524c43..0000000000 --- a/.gitattributes +++ /dev/null @@ -1,7 +0,0 @@ -# GitHub Linguist annotations. -# Hide stuff that is generated by nix-tools plan-to-nix - -nix-tools/.plan.nix/*.nix linguist-generated=true -nix-tools/pkgs.nix linguist-generated=true -.stack-to-nix.cache linguist-generated=true -materialized/**/* linguist-generated=true diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index cd2bbfb4b9..0000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: bug -assignees: '' - ---- - -This template is a guide only, feel free add or omit sections as appropriate. - -**Describe the bug** - -A clear and concise description of what the bug is, including: - -* Build system (eg. `x86_64-linux` or `aarch64-darwin`). -* GHC version. -* Haskell.nix version (or commit) used. - -**Steps To Reproduce** - -Steps for reproducing (try to minimise the size of the code base if possible). - -Bonus points if it is in a PR to add a test case. - -**Expected behavior** - -A clear and concise description of what you expected to happen. - -**Additional context** - -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 8c6206f743..0000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: enhancement -assignees: '' - ---- - -This template is a guide only, feel free add or omit sections as appropriate. - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 5830224b00..0000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 120 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 60 -# Issues with these labels will never be considered stale -exemptLabels: - - "help wanted" - - pinned - - preserved - - security -# Label to use when marking an issue as stale -staleLabel: wontfix -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml deleted file mode 100644 index 92253a9531..0000000000 --- a/.github/workflows/lints.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: "Lints" - -on: - workflow_dispatch: - pull_request: - branches: - - master - - push: - branches: - - master - -defaults: - run: - shell: bash - -# do we really want nixos-unstable? -env: - NIX_PATH: "nixpkgs=channel:nixos-unstable" - REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -jobs: - deadnix: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - run: | - nix run github:astro/deadnix -- --edit --no-lambda-pattern-names --exclude materialized - TMPFILE=$(mktemp) - git diff >"${TMPFILE}" - git stash -u && git stash drop - nix-shell -p reviewdog --run "reviewdog -f=diff -f.diff.strip=1 -reporter=github-pr-review < \"${TMPFILE}\"" diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml deleted file mode 100644 index 2c3c022684..0000000000 --- a/.github/workflows/pipeline.yml +++ /dev/null @@ -1,246 +0,0 @@ -name: "Run tests with ghc967" - -on: - pull_request: - branches: - - master - - push: - branches: - - master - -defaults: - run: - shell: bash - -# do we really want nixos-unstable? -env: - NIX_PATH: "nixpkgs=channel:nixos-unstable" - -jobs: - nix-build: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Running the nix-build tests..." - run: "./test/tests.sh ghc967 nix-build" - - unit-tests: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Running the unit tests..." - run: "./test/tests.sh ghc967 unit-tests" - - runghc: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Checking that a nix-shell works for runghc..." - run: "./test/tests.sh ghc967 runghc" - - cabal: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Checking that a nix-shell works for cabal..." - run: "./test/tests.sh ghc967 cabal" - - cabal-doExactConfig: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Checking that a nix-shell works for cabal (doExactConfig component)..." - run: "./test/tests.sh ghc967 cabal-doExactConfig" - - tests-benchmarks: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Checking that a nix-shell works for a project with test-suite build-tools and benchmarks..." - run: "./test/tests.sh ghc967 tests-benchmarks" - - multi-target: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Checking that a nix-shell works for a multi-target project..." - run: "./test/tests.sh ghc967 multi-target" - - shellFor-single-package: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Checking shellFor works for a cabal project, multiple packages..." - run: "./test/tests.sh ghc967 shellFor-single-package" - - shellFor-multiple-package: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Checking shellFor works for a cabal project, single package...y" - run: "./test/tests.sh ghc967 shellFor-multiple-package" - - shellFor-hoogle: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Checking shellFor works for a cabal project, single package..." - run: "./test/tests.sh ghc967 shellFor-hoogle" - - shellFor-not-depends: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Checking shellFor does not depend on given packages...y" - run: "./test/tests.sh ghc967 shellFor-not-depends" - - maintainer-scripts: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Checking the maintainer scripts...y" - run: "./test/tests.sh ghc967 maintainer-scripts" - - plan-extra-hackages: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Checking that plan construction works with extra Hackages..." - run: "./test/tests.sh ghc967 plan-extra-hackages" - - build-extra-hackages: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: Checking that package with extra Hackages can be build..." - run: "./test/tests.sh ghc967 build-extra-hackages" - - hix: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Run tests with ghc967: End-2-end test of hix project initialization and flakes development shell ..." - run: "./test/tests.sh ghc967 hix" - -# template: -# runs-on: [self-hosted, linux] -# steps: -# - uses: actions/checkout@v4 -# - name: "Run tests with ghc967: End-2-end test of hix project initialization and flakes development shell ..." -# run: "./test/tests.sh ghc967 template" - - docs: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Test examples in documentation ..." - run: "./test/tests.sh ghc967 docs" - - hydra-ifdLevel-0-and-1: - runs-on: [self-hosted, linux] - timeout-minutes: 20 - steps: - - uses: actions/checkout@v4 - - name: "Check that jobset will evaluate in Hydra at ifdLevel 0 and 1" - run: | - nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh - sed -i 's/runningHydraEvalTest = false;/runningHydraEvalTest = true;/' flake.nix - sed -i 's/ifdLevel = 3;/ifdLevel = 0;/' flake.nix - ./check-hydra.sh - sed -i 's/ifdLevel = 0;/ifdLevel = 1;/' flake.nix - ./check-hydra.sh - - hydra-ifdLevel-2: - runs-on: [self-hosted, linux] - timeout-minutes: 20 - steps: - - uses: actions/checkout@v4 - - name: "Check that jobset will evaluate in Hydra at ifdLevel 2" - run: | - nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh - sed -i 's/runningHydraEvalTest = false;/runningHydraEvalTest = true;/' flake.nix - sed -i 's/ifdLevel = 3;/ifdLevel = 2;/' flake.nix - ./check-hydra.sh - - hydra-ifdLevel-3: - runs-on: [self-hosted, linux] - timeout-minutes: 30 - steps: - - uses: actions/checkout@v4 - - name: "Check that jobset will evaluate in Hydra at ifdLevel 3" - run: | - nix-build build.nix -A maintainer-scripts.check-hydra -o check-hydra.sh - sed -i 's/runningHydraEvalTest = false;/runningHydraEvalTest = true;/' flake.nix - ./check-hydra.sh - - closure-size: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Check closure size with ghc967" - run: | - nix-build build.nix -A maintainer-scripts.check-closure-size --argstr compiler-nix-name ghc967 -o check-closure-size.sh - echo "+++ Closure size (MB)" - ./check-closure-size.sh - - update-docs: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Update docs" - run: | - nix-build build.nix -A maintainer-scripts.update-docs -o update-docs.sh - ./update-docs.sh - - check-materialization-concurrency: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Make sure materialize function does not limit concurrency" - run: | - nix-build build.nix -A maintainer-scripts.check-materialization-concurrency -o check-materialization-concurrency.sh - ./check-materialization-concurrency.sh - - check-path-support: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Make sure non store paths like can be used as src" - run: | - nix-build build.nix -A maintainer-scripts.check-path-support --argstr compiler-nix-name ghc967 -o check-path-support.sh - ./check-path-support.sh - - haskell-nix-roots-do-not-require-IFDs: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Check that the haskell.nix roots do not require IFDs" - run: nix build .#roots.x86_64-linux --accept-flake-config --option allow-import-from-derivation false - - hydra-without-remote-builders-ghc967: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Check that evaluation of hydra jobs works without using remote builders for GHC 9.6.7" - run: nix path-info --derivation .#requiredJobs.x86_64-darwin.required-unstable-ghc967-native --show-trace --builders '' - - hydra-without-remote-builders-ghc9102: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Check that evaluation of hydra jobs works without using remote builders for GHC 9.10.2" - run: nix path-info --derivation .#requiredJobs.x86_64-darwin.required-unstable-ghc9102-native --show-trace --builders '' - - hix-cabal: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - name: "Check hix -- run github:haskell/cabal/3.10#cabal-install:exe:cabal -- --version" - run: "HIX_DIR=$(mktemp -d) nix run .#hix --accept-flake-config -- run github:haskell/cabal/3.10#cabal-install:exe:cabal --accept-flake-config --override-input haskellNix . -- --version" - - check-nix-tools: - runs-on: [self-hosted, linux] - steps: - - uses: actions/checkout@v4 - - run: nix build ./nix-tools#checks.x86_64-linux.truncate-index --accept-flake-config diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 5d4dee5467..0000000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: "Publish a flake to flakestry" -on: - push: - tags: - # This pattern matches tags in the format YYYY.MM.DD - # It expects a four-digit year, followed by a two-digit month and day - - "[0-9]{4}.[0-9]{2}.[0-9]{2}" - workflow_dispatch: - inputs: - tag: - description: "The existing tag to publish" - type: "string" - required: true -jobs: - publish-flake: - runs-on: ubuntu-latest - permissions: - id-token: "write" - contents: "read" - steps: - - uses: flakestry/flakestry-publish@main - with: - version: "${{ inputs.tag || github.ref_name }}" diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml deleted file mode 100644 index f5743fceed..0000000000 --- a/.github/workflows/tag.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: "Weekly Date Tag" - -on: - schedule: - - cron: '0 0 * * 0' - -jobs: - tag-repo: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Create and push tag using current date - run: | - TAG_DATE=$(date -u "+%Y.%m.%d") - if git rev-parse "$TAG_DATE" >/dev/null 2>&1; then - echo "Tag $TAG_DATE already exists. Skipping tag creation." - else - git config user.name "github-actions" - git config user.email "github-actions@github.com" - git tag $TAG_DATE - git push origin $TAG_DATE - fi diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml deleted file mode 100644 index bc07ff9287..0000000000 --- a/.github/workflows/update-docs.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Updload Docs - -on: - push: - branches: - - master - -env: - GH_TOKEN: ${{ github.token }} - -jobs: - upload-docs: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Nix with good defaults - uses: input-output-hk/install-nix-action@v20 - with: - extra_nix_config: | - trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk= - substituters = https://cache.nixos.org/ https://cache.iog.io/ https://cache.zw3rk.com - nix_path: nixpkgs=channel:nixos-unstable - - - name: Update docs - run: | - nix-build build.nix -A maintainer-scripts.update-docs -o update-docs.sh - ./update-docs.sh - - - name: Upload docs - run: | - git config --global user.name 'Auto Update Bot' - git config --global user.email 'no-reply@iohk.io' - git push origin gh-pages diff --git a/.github/workflows/updates.yml b/.github/workflows/updates.yml deleted file mode 100644 index d96f78a975..0000000000 --- a/.github/workflows/updates.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: "Update pins for hackage.nix and stackage.nix" - -on: - workflow_dispatch: - schedule: - - cron: "30 0 * * *" - -jobs: - update-pins: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v15 - with: - nix_path: nixpkgs=channel:nixos-unstable - extra_nix_config: | - trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= - substituters = https://cache.iog.io https://cache.zw3rk.com https://cache.nixos.org/ - - name: "Update pins" - run: | - nix flake update hackage - nix flake update hackage-for-stackage - nix flake update stackage - - name: Commit and push changes - run: | - git config --local user.email "devops+nix-tools@iohk.io" - git config --local user.name "IOHK" - git add . - git commit -m "Update Hackage and Stackage" - git push \ No newline at end of file diff --git a/.github/workflows/upload-artifacts.yml b/.github/workflows/upload-artifacts.yml deleted file mode 100644 index fd7c804b46..0000000000 --- a/.github/workflows/upload-artifacts.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Update Static Nix Tools - -on: - push: - branches: - - main - tags: - - "nix-tools-*" - pull_request: - -env: - FLAKE_REF: github:${{ github.repository }}?ref=${{ github.head_ref || github.ref }} - GH_TOKEN: ${{ github.token }} - -jobs: - wait-for-hydra: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Nix with good defaults - uses: input-output-hk/install-nix-action@v20 - with: - extra_nix_config: | - trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk= - substituters = https://cache.nixos.org/ https://cache.iog.io/ https://cache.zw3rk.com - nix_path: nixpkgs=channel:nixos-unstable - - - name: Display flake metadata - id: flake-metadata - run: | - echo $PWD - ls -lah . - nix flake metadata ${{ env.FLAKE_REF }} - nix flake metadata ${{ env.FLAKE_REF }} --json | jq -r '"LOCKED_URL=\(.url)"' >> "$GITHUB_OUTPUT" - - - name: Wait for nix-tools meta job - uses: input-output-hk/actions/wait-for-hydra@angerman/support-prs - with: - check: 'nix-tools' - - - name: "Pull nix-tools" - run: | - ls -lah . - cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip . - cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip . - cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-linux.nix-tools.static.zipped.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip . - cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64-no-ifd --no-link --print-out-paths)/*.zip . - - - name: Configure Git - if: startsWith(github.ref, 'refs/tags/') - run: | - git config --global user.name 'Auto Update Bot' - git config --global user.email 'no-reply@iohk.io' - - - name: "Compute nix-tools-static.nix" - if: startsWith(github.ref, 'refs/tags/') - run: | - git fetch --all - git switch --force static-nix-tools - ( - echo "pkgs: let baseurl = \"https://github.com/input-output-hk/haskell.nix/releases/download/${GITHUB_REF_NAME}/\"; in {" - for arch in aarch64-darwin x86_64-darwin aarch64-linux x86_64-linux; do - echo " ${arch} = pkgs.fetchurl { " - echo " name = \"${arch}-nix-tools-static\";" - echo " url = \"\${baseurl}${arch}-nix-tools-static.zip\";" - echo " sha256 = \"$(nix-hash --sri --type sha256 --flat ${arch}-nix-tools-static.zip)\";" - echo " };" - done - echo "}" - ) > nix-tools-static.nix - cat nix-tools-static.nix - - - - name: Push to nix branch - if: startsWith(github.ref, 'refs/tags/') - run: | - git add nix-tools-static.nix - git commit -m "update nix-tools-static.nix" - git push origin static-nix-tools - - - name: Release - uses: input-output-hk/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - *-nix-tools-static.zip diff --git a/.github/workflows/windows-secp256k1.yml b/.github/workflows/windows-secp256k1.yml deleted file mode 100644 index 4d92d4d7ad..0000000000 --- a/.github/workflows/windows-secp256k1.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: "Test secp256k1 on windows" -on: workflow_dispatch -jobs: - tests: - runs-on: windows-latest - defaults: - run: - shell: bash - steps: - - uses: haskell/actions/setup@v1 - id: setup-haskell - with: - ghc-version: 8.10.7 - cabal-version: 3.6.2.0 - - name: Install pkgconfiglite - run: choco install -y pkgconfiglite - - name: Install libsecp256k1 - run: | - curl -Ls \ - --connect-timeout 5 \ - --max-time 10 \ - --retry 5 \ - --retry-delay 0 \ - --retry-max-time 40 \ - https://hydra.iohk.io/job/Cardano/haskell-nix/windows-secp256k1/latest/download/1 -o secp256k1.zip - mkdir secp256k1 - cd secp256k1 - unzip ../secp256k1.zip - cd .. - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH;$(readlink -f secp256k1/lib/pkgconfig | sed 's|^/d|D:|g' | tr / '\\')" - echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" - echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV - export SECP256K1_PATH="$(readlink -f secp256k1/bin | sed 's|^/d|D:|g' | tr / '\\')" - echo "SECP256K1_PATH=$SECP256K1_PATH" - echo "$SECP256K1_PATH" >> $GITHUB_PATH - - name: Cabal update - run: cabal update - - name: Build and run haskell-secp256k1 tests - run: | - cabal unpack secp256k1-haskell - cd secp256k1-haskell-* - cabal build --enable-tests - cabal test diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 07977b1ae0..0000000000 --- a/.gitignore +++ /dev/null @@ -1,105 +0,0 @@ -# The output of "mdbook build" -/book/ -/docs/reference/modules.md -/docs/**/index.html - -# Nix build results -result* -/nt - -# https://github.com/nix-community/nix-direnv -.direnv - -# Created by https://www.gitignore.io/api/haskell,emacs,vim - -### Emacs ### -# -*- mode: gitignore; -*- -*~ -\#*\# -/.emacs.desktop -/.emacs.desktop.lock -*.elc -auto-save-list -tramp -.\#* - -# Org-mode -.org-id-locations -*_archive - -# flymake-mode -*_flymake.* - -# eshell files -/eshell/history -/eshell/lastdir - -# elpa packages -/elpa/ - -# reftex files -*.rel - -# AUCTeX auto folder -/auto/ - -# cask packages -.cask/ -dist/ - -# Flycheck -flycheck_*.el - -# server auth directory -/server/ - -# projectiles files -.projectile - -# directory configuration -.dir-locals.el - -### Haskell ### -dist -dist-* -cabal-dev -*.o -*.hi -*.chi -*.chs.h -*.dyn_o -*.dyn_hi -.hpc -.hsenv -.cabal-sandbox/ -cabal.sandbox.config -*.prof -*.aux -*.hp -*.eventlog -.stack-work/ -cabal.project.local~ -.HTF/ -.ghc.environment.* - -### Vim ### -# Swap -[._]*.s[a-v][a-z] -[._]*.sw[a-p] -[._]s[a-rt-v][a-z] -[._]ss[a-gi-z] -[._]sw[a-p] - -# Session -Session.vim - -# Temporary -.netrwhist -# Auto-generated tag files -tags -# Persistent undo -[._]*.un~ - - -# End of https://www.gitignore.io/api/haskell,emacs,vim -nix-tools-src-new.json diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000000..f17311098f --- /dev/null +++ b/.nojekyll @@ -0,0 +1 @@ +This file makes sure that Github Pages doesn't process mdBook's output. diff --git a/404.html b/404.html new file mode 100644 index 0000000000..e1fefd9657 --- /dev/null +++ b/404.html @@ -0,0 +1,211 @@ + + +
+ + +Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+There are multiple components that play a part in the haskell.nix
+infrastructure. These are nix-tools
, haskell.nix
, hackage.nix
,
+and stackage.nix
.
.-------------. .-------------.
+.- nix-tools ------. | haskell.nix | .- | hackage.nix |
+| .--------------. | .----------------. '-------------' | '-------------'
+| | stack-to-nix |---> | stack-pkgs.nix |-. | | |
+| '--------------' | '----------------' | v | v
+| .-------------. | .----------. '--> .----------. <-' .--------------.
+| | plan-to-nix |----> | plan.nix |------.---> | pkgs.nix | <--- | stackage.nix |
+| '-------------' | '----------' | '----------' '--------------'
+| .--------------. | .--------------. | |
+| | cabal-to-nix |---> | $package.nix |--' v
+| '--------------' | '--------------' .-------------.
+'------------------' | default.nix |
+ '-------------'
+ |
+ v
+ .-------------.
+ | release.nix |
+ '-------------'
+
+haskell.nix diagram
+nix-tools is a Haskell package that provides the following tools:
+cabal-to-nix
: a .cabal
to .nix
transformer that retains
+conditional expressions.
stack-to-nix
: a stack.yaml
to .nix
transformer that will read
+in a stack.yaml
expression an generate a pkgs.nix
file suited for
+use with haskell.nix
.
plan-to-nix
: a plan.json
to .nix
transformer that will read in
+a plan.json
file and generate a pkgs.nix
file suited for use
+with haskell.nix
.
as well as a few other tools used to generate hackage.nix
and stackage.nix
.
Haskell.nix is the runtime system for this Haskell infrastructure.
+It contains the component builder, as well as the system package and
+license mapping. Without haskell.nix the expressions generated by
+either of the nix-tools
tools make little sense on their own.
hackage.nix provides all cabal expressions from hackage as nix +expressions. It is periodically updated to keep in sync with the set +of packages available on hackage.
+stackage.nix is similar to hackage.nix but provides all stackage +snapshots (lts, and nightly) as nix expressions. It naturally depends +on hackage.nix to resolve package names, versions and revisions to the +respective packages from hackage.nix.
+ +Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+This file contains a summary of changes to Haskell.nix and nix-tools
+that will impact users.
Some time ago the behavior of shellFor
changed so that the arguments
+are now checked against modules/shell.nix
. This was done as part of a fix
+for bugs in the way shellFor
arguments and project shell
arguments
+interacted (both are now modules
and the normal module merge rules apply).
This means it is no longer possible to pass arbitrarily named arguments
+to shellFor
in order to set environment variables.
Instead of:
+p.shellFor {
+ FOO = "bar";
+}
+
+Use:
+p.shellFor {
+ shellHook = ''
+ export FOO="bar"
+ '';
+}
+
+or
+(p.shellFor {}).overrideAttrs {
+ FOO = "bar";
+}
+
+Removed GHC <9.6 from CI.
+The latest nixpkgs-unstable
caused problems with
Cabal projects now use the more granular Unit IDs from plan.json
+to identify packages. This allows for different versions of a
+package to be used when building built-tool-depends
and setup
+dependencies.
Overrides in the modules
argument apply to all versions of
+the package. However to make this work we needed to make
+each packages.somepackage
an option (instead of using an
+attrsOf
the submodule type).
It is now an error to override a package that is not in the
+plan. This can be a problem if different GHC versions, target
+platforms, or cabal flag settings cause the package to be
+excluded from the plan. Adding package-keys
can tell
+haskell.nix to include the option anyway:
modules = [{
+ # Tell haskell.nix that `somepackage` may exist.
+ package-keys = ["somepackage"];
+ # Now the following will not cause an error even
+ # if `somepackage` is not in the plan
+ packages.somepackage.flags.someflag = true;
+ }];
+
+There is a helper function you can use to add package-keys
+for all of the builtins.attrNames
of packages
:
modules = [(pkgs.haskell-nix.haskellLib.addPackageKeys {
+ packages.somepackage.flags.someflag = true;
+ })];
+
+Do not use the module's pkgs
arg to look addPackageKeys
up
+though or it will result an infinite recursion
error.
Code that uses options.packages
will also need to be updated.
+For instance the following code that uses options.packages
+to set --Werror
for local packages:
({ lib, ... }: {
+ options.packages = lib.mkOption {
+ type = lib.types.attrsOf (lib.types.submodule (
+ { config, lib, ... }:
+ lib.mkIf config.package.isLocal
+ {
+ configureFlags = [ "--ghc-option=-Werror"];
+ }
+ ));
+ };
+ })
+
+Now needs to do it for each of the entry in config.package-keys
+instead of using attrsOf
:
({ config, lib, ... }: {
+ options.packages = lib.genAttrs config.package-keys (_:
+ lib.mkOption {
+ type = lib.types.submodule (
+ { config, lib, ... }:
+ lib.mkIf config.package.isLocal
+ {
+ configureFlags = [ "--ghc-option=-Werror"];
+ }
+ );
+ });
+ })
+
+Haskell.nix now respects the pre-existing
packages selected
+by the cabal planner. The selection made by the planner
+is used to set nonReinstallablePkgs
.
Instead setting nonReinstallablePkgs
and reinstallableLibGhc
+haskell.nix projects should add constraints
to the cabal project.
For instance to force the use of the pre-exising
text
+package add:
constraints: text installed
+
+To make sure text
is reinstalled use:
constraints: text source
+
+The pre-existing
ghc
will now be used by default as
+that is what cabal
will choose (haskell.nix used to choose
+reinstallableLibGhc=true
by default).
To allow cabal to choose reinstalling ghc
add:
allow-boot-library-installs: True
+
+To force cabal to choose reinstalling:
+ constraints: ghc source
+ allow-boot-library-installs: True
+
+It may also need allow-newer: ghc:Cabal
Haskell.nix will no longer parse the cabal.project
file to
+determine the index-state
. This decision was made due to
+the function's inability to handle more than one index-state
+or a qualified index-state
as the first index-state
+field in the file.
As a result, there will be some drawbacks:
+There will no longer be a warning in the trace output +if an index state is not found.
+Even if the index-state:
in the cabal.project
has not changed,
+the plan will be recomputed when hackage.nix is bumped. However, this
+is not expected to be a problem since plan recomputations are typically
+quick.
project.index-state
cannot be used to obtain the found index-state
.
+However, the parse function is still available if required
+(haskell-nix.haskellLib.parseIndexState).
Removed reliance on builtins.currentSystem
. It was used it to provide
+pkgs.evalPackages
via an overlay that it used to run derivations
+used in imports from derivation (IFDs).
These derivations are now run on buildPackages
by default.
Passsing evalPackages
to a project function will change where all the
+derivations used in IFDs are run for that project (including shell tools):
+evalPackages = import nixpkgs haskellNix.nixpkgsArgs;
Passing evalSystem
instead will use create a suitable nixpkgs
using pkgs.path
+and pkgs.overlay
:
+evalSystem = "x86_64-linux";
+or
+evalSystem = builtins.currentSystem;
The haskellLib.cleanGit
function is also affected by this change. If you are cross
+compiling and using cleanGit
you should probably do something like:
+pkgs = import nixpkgs haskellNix.nixpkgsArgs;
+evalPackages = import nixpkgs (haskellNix.nixpkgsArgs // { system = evalSystem; });
+p = pkgs.pkgsCross.mingwW64.haskell-nix.cabalProject {
+inherit evalPackages;
+src = evalPackages.haskell-nix.haskellLib.cleanGit { src = ./.; };
+};
sha256map
instead.repository
in cabal.project
. These
+blocks should now work without the need for passing extra-hackages
and
+extra-hackage-tarballs
.nix/sources.json
+as flake inputs (flake.lock
replaces nix/sources.json
).flake-compat
to continue to provide a compatible interface for non
+flake projects.source-repository-package
references in cabal.project
files are now
+left as a source-repository-package
when calculating the the plan-nix
for
+cabalProject
based functions.
+This makes haskell.nix match the behaviour of cabal
better.
+Materialized files for projects that use source-repository-package
+references will need to be updated.plan.json
file it
+will not be present in hsPkgs.pkg.components
..dwarf
to build any component with DWARF dubug info on linux
+(ghc >=8.10.2).enableDWARF
to shellFor
for to get a shell where all the
+components are the .dwarf
ones.ghcOptions
has been moved from package and is now a list of strings.
+old: packages.x.package.ghcOptions = "someGHCoption";
+new: packages.x.ghcOptions = ["someGHCoption"];
+To specify ghcOptions for all packages:
+ghcOptions = ["someGHCoption"];
+For a single component:
+packages.x.compoents.library.ghcOptions = ["someGHCoption"];includeSiblings
to cleanSourceWith
. When true
it
+prevents the subDir
arg from causing filtering of other directories.keepGitDir
to cleanGit
to allow .git
directory to be kept
+(useful for components that use the githash
package).otherShells
arg for shellFor
to `inputsFromshellFor
makeConfigFiles
ghcWithHoogle
and ghcWithPackages
+functions have been removed from project.hsPkgs
. Instead access
+them from project
itself (e.g. change p.hsPkgs.shellFor
to p.shellFor
).project.shells.ghc
has been removed.
+If needed, add something like p // { shells.ghc = p.shellFor {} }
+to shell.nix
.${targetPrefix}cabal
wrapper script for running cross
+compilers in shellFor
.otherShells
arg added to shellFor
.tools.hoogle
to shellFor
with a value suitable for haskel-nix.tool
will
+use the specified hoogle
inside shellFor
. This allows for materialization
+of hoogle
.compiler-nix-name
to project functions for stack.yaml
+based projects now overrides the compiler used (was ignored before).doCoverage
module option that allows users to choose
+packages to enable coverage for.doCoverage
flag to the component builder that outputs HPC
+information when coverage is enabled.components.all
, use symlinkJoin
on components.exes or
+shellFor
if you need a shell.components
argument to shellFor
.haskell-nix.roots
and p.roots
to single derivations.sources.nixpkgs-default
, use sources.nixpkgs
instead../nixpkgs
directory, use (import ./. {}).sources
+or ./nix/sources.nix
instead.compiler-nix-name
argument.haskell-nix.tool
and .tools
now require a compiler-nix-name
argument.
+New functions p.tool
and p.tools
(where p is a project) do not.
+Like shellFor { tools = ... }
they will use the compiler nix name
+from the project (including stack projects where it is derived from
+the resolver).haskell-nix.alex
and haskell-nix.happy
have been removed. Use
+p.tool "alex" "3.2.5"
or shellFor { tools = { alex = "3.2.5"; } }
.haskell-nix.nix-tools
-> haskell-nix.nix-tools.ghc883
(it includes
+the hpack exe now).haskell-nix.cabal-install
->
+p.tool "cabal" "3.2.0.0"
or shellFor { tools = { cabal = "3.2.0.0"; } }
haskell-nix.haskellNixRoots
-> haskell-nix.roots ghc883
or p.roots
shellFor
) attempts
+to accesses the .doc
attribute of component.cleanSourceHaskell
to accept an attrset of src
and
+(optional) name
parameters. This allows you to keep the source
+derivation name constant, so that your builds are always
+cached. Usage of cleanSourceHaskell
will need to be updated.shellFor
no longer sets CABAL_CONFIG
by default.
+This avoids surprising users, but means that Cabal may select a plan which is different to your Haskell.nix package set.
+If you would like the old behaviour, use shellFor { exactDeps = true; }
.haskellLib.collectComponents
function.ghcWithPackages
and ghcWithHoogle
to hsPkgs (documentation.shellFor
function to package set.snaphots
and haskellPackages
attributes to the
+Haskell.nix top-level.cleanSourceHaskell
utility function to the Haskell.nix
+top-level.callCabalProjectToNix
function, which uses "import from
+derivation" (IFD) so that nix-tools doesn't need to be run
+manually.hackage.nix
update process has changed, so that Cabal index
+state hashes are also included in the generated repo.callStackToNix
function, which uses "import from
+derivation" (IFD) so that stack-to-nix
doesn't need to be run
+manually.overlays
was renamed to extras
in
+#79
+to prevent confusion between the notion of Nix overlays.
Therefore plan-pkgs
and stack-pkgs
as generated by plan-to-nix
and stack-to-nix
will
+expose extras
instead of overlay
. Similarly mkStackPkgSet
, mkPkgSet
and mkCabalProjectPkgSet
+take a pkg-def-extras
instead of pkg-def-overlay
argument. If you are using iohk-nix
, the
+iohk-overlay
was parameter was renamed to iohk-extras
.
Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+overlays/bootstrap.nix
Each ghc version is defined in this file. Duplicate one of the existing
+ghc version definitions and replace the version numbers. Make sure
+you update the spec.sha256
or the other versions source will be used.
+Check the LLVM version that should be used in the
+ghc wiki.
ci.nix
In the haskell.nix repo run:
+mkdir materialized/ghc884
+nix-build scripts/check-compiler-materialization --argstr compiler-nix-name ghc884
+
+The nix-build
command will fail with something like:
Materialized nix used for dummy-data-x86_64-unknown-linux-musl-ghc-8.10.1 incorrect. To fix run: /nix/store/wnwpyrhv4nxgyljz3f20gdpspjxvm7h4-updateMaterialized
+
+Run the updateMaterialized
script and repeat the nix-build
until it no longer fails.
+If the failure is not a problem with materialization and no updateMaterialized
script
+is provided then you may need to fix the failure another way or (if it only relates to
+one of the cross compilers) modify scripts/check-compiler-materialization/default.nix
+so that it skips that compiler.
Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+The implementation of coverage starts with the "doCoverage" flag on
+the builder in comp-builder.nix
. The doCoverage flag enables and
+disables the Cabal coverage flag and copies any generated coverage
+data to "$out/share/hpc".
The coverage information for any derivation consists of "mix" and +"tix" files.
+Mix files record static information about a source file and are +generated at build time. They primarily contain a path to the source +file and information about expressions and regions of the source file, +which are later referenced by tix files.
+Tix files contain dynamic information about a test run, recording when +a portion of a source file is touched by a test. These are generated +when the test is run.
+In the context of multiple local packages, there are a few types of +coverage we might be interested in:
+To facilitate expressing any of these classifications of coverage, the
+lib/cover.nix
function provides the mixLibraries
argument. If
+you're just interested in how the tests cover the package library, you
+provide that library as an argument to mixLibraries
. If you're
+interested in how the tests also cover other local packages in the
+project, you can also provide those libraries as arguments to
+mixLibraries.
The projectCoverageReport
and coverageReport
attributes that are
+provided by default on projects and packages respectively provide
+coverage information for all local packages in the project. This is
+to mimic the behaviour of Stack, which seems to be the expectation of
+most people. Of course, you can use the projectCoverageReport
and
+coverageReport
functions to construct your own custom coverage
+reports (as detailed in the coverage tutorial).
The coverage information generated will look something like this:
+/nix/store/...-my-project-0.1.0.0-coverage-report/
+└── share
+ └── hpc
+ └── vanilla
+ ├── html
+ │ └── my-library-0.1.0.0
+ │ ├── my-library-0.1.0.0-48EVZBwW9Kj29VTaRMhBDf
+ │ │ ├── My.Lib.Config.hs.html
+ │ │ ├── My.Lib.Types.hs.html
+ │ │ └── My.Lib.Util.hs.html
+ │ ├── hpc_index_alt.html
+ │ ├── hpc_index_exp.html
+ │ ├── hpc_index_fun.html
+ │ └── hpc_index.html
+ ├── mix
+ │ └── my-library-0.1.0.0
+ │ └── my-library-0.1.0.0-48EVZBwW9Kj29VTaRMhBDf
+ │ ├── My.Lib.Config.mix
+ │ ├── My.Lib.Types.mix
+ │ └── My.Lib.Util.mix
+ └── tix
+ └── my-library-0.1.0.0
+ ├── my-library-0.1.0.0.tix
+ ├── my-test-1
+ │ └── my-test-1.tix
+ └── unit-test
+ └── unit-test.tix
+
+my-project.checks.my-test-1.config.modules
)share/hpc/vanilla/html/my-library-0.1.0.0
report is generated from
+the
+share/hpc/vanilla/tix/my-library-0.1.0.0/my-library-0.1.0.0.tix
+file)The coverage information for an entire project will look something +like this:
+/nix/store/...-coverage-report
+└── share
+ └── hpc
+ └── vanilla
+ ├── html
+ │ ├── index.html
+ │ ├── all
+ │ │ ├── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
+ │ │ │ ├── My.Lib.Config.hs.html
+ │ │ │ ├── My.Lib.Types.hs.html
+ │ │ │ └── My.Lib.Util.hs.html
+ │ │ ├── other-library-0.1.0.0-48EVZBwW9Kj29VTaRMhBDf
+ │ │ │ ├── Other.Lib.A.hs.html
+ │ │ │ └── Other.Lib.B.hs.html
+ │ │ ├── hpc_index_alt.html
+ │ │ ├── hpc_index_exp.html
+ │ │ ├── hpc_index_fun.html
+ │ │ └── hpc_index.html
+ │ ├── my-library-0.1.0.0
+ │ │ ├── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
+ │ │ │ ├── My.Lib.Config.hs.html
+ │ │ │ ├── My.Lib.Types.hs.html
+ │ │ │ └── My.Lib.Util.hs.html
+ │ │ ├── hpc_index_alt.html
+ │ │ ├── hpc_index_exp.html
+ │ │ ├── hpc_index_fun.html
+ │ │ └── hpc_index.html
+ │ └── other-libray-0.1.0.0
+ │ ├── other-library-0.1.0.0-48EVZBwW9Kj29VTaRMhBDf
+ │ │ ├── Other.Lib.A.hs.html
+ │ │ └── Other.Lib.B.hs.html
+ │ ├── hpc_index_alt.html
+ │ ├── hpc_index_exp.html
+ │ ├── hpc_index_fun.html
+ │ └── hpc_index.html
+ ├── mix
+ │ ├── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
+ │ │ ├── My.Lib.Config.mix
+ │ │ ├── My.Lib.Types.mix
+ │ │ └── My.Lib.Util.mix
+ │ └── other-library-0.1.0.0-48EVZBwW9Kj29VTaRMhBDf
+ │ ├── Other.Lib.A.mix
+ │ └── Other.Lib.B.mix
+ └── tix
+ ├── all
+ │ └── all.tix
+ ├── my-library-0.1.0.0
+ │ ├── my-library-0.1.0.0.tix
+ │ ├── my-test-1
+ │ │ └── my-test-1.tix
+ │ └── unit-test
+ │ └── unit-test.tix
+ └── another-library-0.1.0.0
+ ├── another-library-0.1.0.0.tix
+ ├── my-test-2
+ │ └── my-test-2.tix
+ └── unit-test
+ └── unit-test.tix
+
+All of the coverage information is copied verbatim from the coverage +reports for each of the constituent packages. A few additions are +made:
+tix/all/all.tix
is generated from the union of all the library
+tix files.
+html/index.html
) is generated which links to the
+HTML coverage reports of the constituent packages.tix/all/all.tix
+file. This shows the union of all the coverage information
+generated by each constituent coverage report.Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+This shall give a sufficiently good overview over the haskell.nix +ideas, such that a new developer can navigate around without too +much trouble.
+haskell.nix
is centered around packages (haskell package
+descriptions as nix-expressions). These are generated by
+cabal-to-nix
from the nix-tools
package. stack-to-nix
and
+plan-to-nix
will delegate the transformation of cabal packages to
+nix expressions to the same code that cabal-to-nix
uses.
These packages will look similar to the following:
+{ system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
+{
+ flags = {};
+ package = { ... };
+ components = {
+ "library" = { depends = [ ... ]; };
+ exes = { "..." = { depends = [ ... ]; }; ... };
+ sublibs = { "..." = { depends = [ ... ]; }; ... };
+ tests = { "..." = { depends = [ ... ]; }; ... };
+ benchmarks = { "..." = { depends = [ ... ]; }; ... };
+ };
+};
+
+The exact specification can be found in modules/package.nix
.
Packages (unless specified directly in the packages
attribute of the
+module) usually come from a plan. A plan is either a Stackage snapshot
+(nightly or LTS) or a build plan as produced by cabal
.
Plan files usually look like the following:
+hackage:
+{
+ packages = {
+ "$pkg".revision = hackage.$pkg.$version.revisions.default;
+ "$pkg".flags = { flag1 = true; flag2 = false; ... };
+ ...
+ };
+ compiler = {
+ version = "8.4.4";
+ nix-name = "ghc844";
+ packages = {
+ "binary" = "0.8.5.1";
+ ...
+ };
+ };
+}
+
+This provides enough information about the compiler, what packages the +compiler ships with and the packages we want to use in our plan.
+This revision and flag information will be inlined into a list of
+packages in config.packages
in modules/plan.nix
. Thus
+config.packages
will only contains packages as described in the
+previous section.
We finally tie this all together in package-set.nix
where we use
+modules/component-driver.nix
to produce the derivations for each
+packages component to produce the final config.hsPkgs
value.
There is also a modules/compat-driver.nix
that should produce the
+same packageset to be used with the stock haskell infrastructure in
+nixpkgs (This has undergone substantially less testing).
To prevent depending on multiple instances of the same libraries, the
+component builder will try to build every package from scratch and
+rely as little as possible on packages that are shipped with the GHC
+distribution. The exceptions are packages that are known to not be
+reinstallable. See config.nonReinstallablePkgs
.
The component builder can be found in modules/component-driver.nix
+and builder/default.nix
. The component-driver will ensure that we do
+not try to rebuild non-reinstallable packages, and call the
+builder/default.nix
on each package in config.packages
to produce
+config.hsPkgs
.
Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+When making changes to the way Hix works it is often useful to be able to +test the changes locally before uploading them to github.
+Install the hix command wrappers after making changes to a local clone of haskell.nix:
+nix-env -iA hix -f /path/to/local/haskell.nix
+hix-shell
+
+Or override the version of haskell.nix used by the commands with the HIX_ROOT
environment variable:
HIX_ROOT=/path/to/local/haskell.nix hix-shell
+
+For flakes use --override-input
to point to the modified haskell.nix:
nix develop --override-input haskellNix /path/to/local/haskell.nix
+
+
+ Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+nix-tools
To build the latest nix-tools
and store the result at ./nt
, run:
nix build -f https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz pkgs.haskell-nix.nix-tools.ghc884 --out-link nt
+
+If you would like to then install nix-tools
into your profile, run an install
+command:
nix-env -i ./nt
+nix profile install ./nt
+
+The Haskell.nix and nix-tools
source will be useful if you would
+like to contribute improvements, or read the source code to fully
+understand something that the documentation doesn't cover.
git clone https://github.com/input-output-hk/nix-tools
+git clone https://github.com/input-output-hk/haskell.nix
+cd haskell.nix
+nix build -f . pkgs.haskell-nix.nix-tools.ghc884 --arg sourcesOverride '{ nix-tools = ../nix-tools; }' --out-link nt
+
+
+ Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+The hackage.nix
+and stackage.nix
+repos and corresponding files hackage-src.json
and
+stackage-src.json
will be regularly and automatically updated using
+scripts in this repo.
To run the updater scripts manually, use:
+nix-build build.nix -A maintainer-scripts.update-hackage -o update-hackage.sh
+./update-hackage.sh
+
+nix-build build.nix -A maintainer-scripts.update-stackage -o update-stackage.sh
+./update-stackage.sh
+
+The scripts will clone the repo, generate the latest data, then +attempt to push back to the repo and update the source JSON file.
+ +Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+We believe that imports from derivations (IFDs) provide tremendous +value in nix and the aversion towards them stems mostly from +poor tooling and ci support for them. We do not believe +that poor tooling or ci support should cripple nix capability +of abstraction. Hence haskell.nix makes excessive use of +IFDs.
+We do note however that there are users who prefer to +have IFD-free expressions. For this group of users we +detail how to expand the IFD dependent high level functions +into their IFD free building blocks.
+The general structure will be the same, independent of the use of +Stack or Cabal.
+Let us assume for now that we have already generated a pkgs.nix
+expression (see the links bellow). The following file then produces a package set:
# default.nix
+let
+ # Import the Haskell.nix library,
+ pkgs = import <nixpkgs> (import (builtins.fetchTarball "https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz") {}).nixpkgsArgs;
+
+ # Import the file you will create in the stack-to-nix or cabal-to-nix step.
+ my-pkgs = import ./pkgs.nix;
+
+ # Stack projects use this:
+ # pkgSet = pkgs.haskell-nix.mkStackPkgSet {
+ # stack-pkgs = my-pkgs;
+ # pkg-def-extras = [
+ # # these extras will provide additional packages
+ # # ontop of the package set. E.g. extra-deps
+ # # for stack packages. or local packages for
+ # # cabal.projects
+ # ];
+ # modules = [
+ # # specific package overrides would go here
+ # # example:
+ # # packages.cbors.package.ghcOptions = "-Werror";
+ # # packages.cbors.patches = [ ./one.patch ];
+ # # packages.cbors.flags.optimize-gmp = false;
+ # # It may be better to set flags in stack.yaml instead
+ # # (`stack-to-nix` will include them as defaults).
+ # ];
+ # };
+
+ # Cabal projects use this:
+ pkgSet = pkgs.haskell-nix.mkCabalProjectPkgSet {
+ plan-pkgs = my-pkgs;
+ pkg-def-extras = [];
+ modules = [
+ # specific package overrides would go here
+ # example:
+ # packages.cbors.package.ghcOptions = "-Werror";
+ # packages.cbors.patches = [ ./one.patch ];
+ # packages.cbors.flags.optimize-gmp = false;
+ # It may be better to set flags in `cabal.project` instead
+ # (`plan-to-nix` will include them as defaults).
+ ];
+ };
+
+in pkgSet.config.hsPkgs // { _config = pkgSet.config; }
+
+With this setup you can then start building the components of +interest:
+nix build -f default.nix $pkg.components.library
+
+to build the library for $pkg
or
nix build -f default.nix $pkg.components.exes.$exe
+
+to build a specific executable. The same holds for test suites and benchmarks.
+With nix-tools installed, we can simply run the +following command on a stack project:
+stack-to-nix --output . --stack-yaml stack.yaml
+
+This will produce a pkgs.nix
file that looks like the following:
{
+ resolver = "lts-12.17";
+ extras = hackage:
+ {
+ packages = {
+ "o-clock" = hackage.o-clock."0.1.1".revisions.default;
+ ...
+ } // {
+ my-package = ./my-package.nix;
+ ...
+ };
+ };
+}
+
+This file contains the stackage resolver, as well as set of extra
+packages. The extras specifies which extra-deps
(here:
+o-clock-0.1.1
) we wanted to add over the stackage snapshot, and what
+local packages we want (here: my-package
).
plan.json
To get a plan, you need Cabal and GHC. See the How to install a +compiler section of the Nixpkgs Manual for information +about how to choose a specific compiler version.
+++Note: Cabal version
+The minimum Cabal version is 2.4. This version is available +in the NixOS 19.03 release.
+
For this example, we will run a nix-shell
with the default GHC
+version for Nixpkgs.
nix-shell -p haskellPackages.cabal-install haskellPackages.ghc \
+ --run "cabal new-configure"
+
+If all goes well, you should now have the file
+dist-newstyle/cache/plan.json
.
++Tip: Specifying the GHC version
+To use a specific compiler version, replace
+haskellPackages.ghc
+with something likehaskell-nix.compiler.ghc865
. The given compiler +must exist in your Nixpkgs version, of course. See also the +Nixpkgs Manual.
plan-to-nix
With nix-tools installed, we can then run the
+following command on a Cabal project and its build plan. Omit the
+--cabal-project
option if you don't have a project file.
# convert the plan.json file into a pkgs.nix file
+plan-to-nix --output . \
+ --plan-json dist-newstyle/cache/plan.json
+ --cabal-project cabal.project
+
+This will produce a pkgs.nix
file that looks like the following:
{
+ pkgs = hackage:
+ {
+ packages = {
+ "o-clock" = hackage.o-clock."0.1.1".revisions.default;
+ ...
+ };
+ compiler = { ... };
+ };
+
+ extras = hackage:
+ { packages = { my-package = ./.plan.nix/my-package.nix; }; };
+}
+
+It has converted Cabal's build plan into a Nix expression that selects
+dependencies from hackage.nix
. All local packages in the project are
+generated with cabal-to-nix
and added to the package set
+description.
Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+nix-tools
Use niv to update the sources.json:
+nix flake update nix-tools
+
+If nix-tools.cabal
or plan-to-nix
have changed, check the
+materialized files for each of the compiler nix name in
+ls -d materialized/ghc*/nix-tools
with:
nix-build scripts/check-compiler-materialization --argstr compiler-nix-name ghc884
+
+Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+Haskell.nix contains several Nixpkgs pins imanaged by niv
in
+nix/sources.json
.
These are used in testing various versions of nixpkgs.
+To use haskell.nix the config
and overlays
need to be applied to
+Nixpkgs. Users should probably pin a suitable version of nixpkgs, although things might not work for them if their Nixpkgs version is
+too different.
We aim to keep this pin somewhere on a channel of the Nixpkgs latest +stable release. That is currently 20.09.
+We also execute tests on MacOS (darwin). The darwin channel is usually
+behind the NixOS channel. So we follow the nixpkgs-20.09-darwin
+channel.
Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+ghcWithPackages
wrapper removalThe current Nixpkgs Haskell infrastructure and haskell.nix
both
+provide a ghcWithPackages
derivation which contains shell script
+wrappers that wrap ghc
and ghc-pkg
.
In the Nixpkgs Haskell infrastructure, the wrapper scripts are used
+for building Haskell packages. However, in haskell.nix
, the wrappers
+are only used for development environments.
The wrapper scripts provide a ghc
command that "knows" about the
+package set and has all Haskell package dependencies available to it.
We would like to remove the wrapper scripts, but it's currently not +possible to configure all build tools using environment variables +alone.
+ghc
When using ghc
or ghci
by itself, the GHC_ENVIRONMENT
variable
+can point to a configuration file containing an exact package
+set. This works quite well.
ghc-pkg
The package tool ghc-pkg
does not recognize GHC_ENVIRONMENT
, but
+does recognize a GHC_PACKAGE_PATH
pointing to a package.conf.d
.
This works well. However, the cabal
command will refuse to start if
+GHC_PACKAGE_PATH
is set.
Setup.hs
When invoking Setup.hs configure
, the package database is provided
+with the --package-db
argument and exact dependencies in the package
+set can be provided as --dependency
arguments.
The haskell.nix
component builder uses Setup.hs
with these
+command-line options to build Haskell packages.
cabal new-build
Cabal-install will observe the CABAL_CONFIG
environment variable,
+which points to a cabal config file. This config file can provide a
+package-db
value, but it can't specify exact versions of packages.
Cabal is designed to solve dependencies, not simply take the package +set which is given to it.
+Therefore, cabal
does not use GHC_ENVIRONMENT
, but instead creates
+its own environment file. It will not accept --dependency
arguments.
As far as I know, the best way to force cabal
to take a pre-computed
+package set is to use a new-freeze
file. However there is no
+environment variable (or config file entry) which can specify a path
+to a freeze file.
Specifying a package-db
path in the cabal config file is not enough
+for it to successfully resolve dependencies.
As mentioned before, cabal
does not work when GHC_PACKAGE_PATH
is
+set. The best way to work around this is to wrap ghc
and ghc-pkg
+in shell scripts.
Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+To build the test cases, run from the test
directory:
nix-build --no-out-link default.nix
+
+To run all tests (includes impure tests), use the script:
+./tests.sh
+
+If you change the test Cabal files or need to regenerate the code with
+nix-tools, then see regen.nix
. Run it like this:
$(nix-build --no-out-link regen.nix)
+
+
+ Press ← or → to navigate between chapters
+Press S or / to search in the book
+Press ? to show this help
+Press Esc to hide this help
+haskell.nix
is an infrastructure based on nix
to build Haskell code.
The following report shows how each module is covered by any test in the project:
-The following reports show how the tests of each package cover modules in the project:
-