From 814b6d8d5ea0822c5460b455b7caba105a9eaab4 Mon Sep 17 00:00:00 2001 From: Andrea Bedini Date: Wed, 24 Aug 2022 17:20:17 +0200 Subject: [PATCH] Switch to internal haskell package repository - Remove all source-repository-package stanzas (package repository has been pre-populated with the exact same versions) - Remove cabal work-around disabling tests for packages erroneously considered local. Cabal now does the right thing - Remove cabalWrapped, as now unnecessary --- CONTRIBUTING.rst | 189 ++++++++++++++++++++++ README.rst | 157 +------------------ cabal.project | 320 +++++--------------------------------- flake.lock | 18 +++ flake.nix | 8 + nix/haskell.nix | 10 +- nix/workbench/manifest.sh | 6 +- nix/workbench/run.sh | 10 +- nix/workbench/shell.nix | 6 - shell.nix | 4 - 10 files changed, 271 insertions(+), 457 deletions(-) create mode 100644 CONTRIBUTING.rst diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 00000000000..1812db58cce --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,189 @@ +******************************************** +Contributing to the ``cardano-node`` project +******************************************** + +The ``cardano-node`` development is primarily based on the Nix infrastructure (https://nixos.org/ ), which enables packaging, CI, development environments and deployments. + +On how to set up Nix for ``cardano-node`` development, please see `Building Cardano Node with nix `_. + +Supplementary tooling +==== + +GHCID +---- + +run *ghcid* with: ``ghcid -c "cabal repl exe:cardano-node --reorder-goals"`` + +Haskell Language Server +---- + +When using Haskell Language Server with Visual Studio Code, you may find that +`HLINT annotations are ignored `_. + +To work around this, you may run the script ``./scripts/reconfigure-hlint.sh`` to generate a ``.hlint.yaml`` +file with HLINT ignore rules derived from the source code. + +Testing +==== + +``cardano-node`` is essentially a container which implements several components such networking, consensus, and storage. These components have individual test coverage. The node goes through integration and release testing by Devops/QA while automated CLI tests are ongoing alongside development. + +Developers on ``cardano-node`` can `launch their own testnets `_ or `run the chairman tests `_ locally. + +Debugging +==== + +Pretty printing CBOR encoded files +---- + +It may be useful to print the on chain representations of blocks, delegation certificates, txs and update proposals. There are two commands that do this (for any cbor encoded file): + +To pretty print as CBOR: +``cabal exec cardano-cli -- pretty-print-cbor --filepath CBOREncodedFile`` + +Validate CBOR files +---- + +You can validate Byron era blocks, delegation certificates, txs and update proposals with the ``validate-cbor`` command. + +``cabal exec cardano-cli -- validate-cbor --byron-block 21600 --filepath CBOREncodedByronBlockFile`` + +Updating dependencies +==== + +... from Hackage +---- + +Updating package dependencies from Hackage should work like normal in a Haskell project. +The most important thing to note is that we pin the ``index-state`` of the Hackage package index in ``cabal.project``. +This means that cabal will always see Hackage “as if” it was that time, ensuring reproducibility. +But it also means that if you need a package version that was released *after* that time, you need to bump the ``index-state`` (and to run ``cabal update`` locally). + +Because of how we use Nix to manage our Haskell build, whenever you do this you will also need to pull in the Nix equivalent of the newer ``index-state``. +You can do this by running ``nix flake lock --update-input hackageNix``. + +... from the Cardano package repository +---- + +Many Cardano packages are not on Hackage and are instead in the `Cardano package repository `__, see the README for (lots) more information. +Getting new packages from there works much like getting them from Hackage. +The differences are that it has an independent ``index-state``, and that there is a different Nix command you need to run afterwards: ``nix flake lock --update-input CHaP``. + +Using unreleased versions of dependencies +~~~~ + +Sometimes we need to use an unreleased version of one of our dependencies, either to fix an issue in a package that is not under our control, or to experiment with a pre-release version of one of our own packages. +You can use a ``source-repository-package`` stanza to pull in the unreleased version. +Try only to do this for a short time, as it does not play very well with tooling, and will interfere with the ability to release the node itself. + +For packages that we do not control, we can end up in a situation where we have a fork that looks like it will be long-lived or permanent (e.g. the maintainer is unresponsive, or the change has been merged but not released). +In that case, release a patched version to the `Cardano package repository `__, which allows us to remove the ``source-repository-package`` stanza. +See the README for instructions. + +Releasing a version of the node +==== + +(There is much more to say here, this is just a small fragment) + +... to the Cardano package repository +---- + +When releasing a new version of the node, it and the other packages in this repository should be released to the `Cardano package repository `__. +See the README for instructions, including a script to automate most of the process. +Please note that libraries need bounds on the version of their dependencies to avoid bitrot and be effectively reusable. + +Workbench: a local cluster playground +==== + +You can quickly spin up a local cluster (on Linux and Darwin), based on any of a wide variety of configurations, and put it under a transaction generation workload -- using the ``workbench`` environment: + +1. Optional: choose a workbench profile: + - ``default`` stands for a light-state, 6-node cluster, under saturation workload, indefinite runtime + - ``ci-test`` is the profile run in the node CI -- very light, just two nodes and short runtime + - ``devops`` is an unloaded profile (no transaction generation) with short slots -- ``0.2`` sec. + - ..and many more -- which can be either: + - listed, by ``make ps`` + - observed at their point of definition: `nix/workbench/profiles/prof1-variants.jq `_ +2. Optional: select mode of operation, by optionally providing a suffix: + - default -- no suffix -- just enter the workbench shell, allowing you to run ``start-cluster`` at any time. Binaries will be built locally, by ``cabal``. + - ``autostay`` suffix -- enter the workbench shell, start the cluster, and stay in the shell afterwards. Binaries will be built locally, by ``cabal``. + - ``autonix`` suffix -- enter the workbench shell, start the cluster. All binaries will be provided by the Nix CI. + - ..there are other modes, as per `lib.mk `_ +3. Enter the workbench shell for the chosen profile & mode: + ``make `` or ``make -`` (when there is a suffix). +4. Optional: start cluster: + Depending on the chosen mode, your cluster might already start, or you are expected to start it yourself, using ``start-cluster``. + +The workbench services are available only inside the workbench shell. + +Using Cabal +---- + +By default, all binaries originating in the ``cardano-node`` repository are available to ``cabal build`` and ``cabal run``, unless the workbench was entered using one of the pure ``*nix`` modes. Note that in all cases, the dependencies for the workbench are supplied though Nix and have been built/tested on CI. + +**Dependency localisation** -or- *Cabal&Nix for painless cross-repository work* +---- + +The Cabal workflow described above only extends to the repository-local packages. Therefore, ordinarily, to work on ``cardano-node`` dependencies in the context of the node itself, one needs to go through an expensive multi-step process -- with committing, pushing and re-pinning of the dependency changes. + +The **dependency localisation** workflow allows us to pick a subset of leaf dependencies of the ``cardano-node`` repository, and declare them *local* -- so they can be iterated upon using the ``cabal build`` / ``cabal run`` of ``cardano-node`` itself. This cuts development iteration time dramatically and enables effective cross-repo development of the full stack of Cardano packages. + +Without further ado (**NOTE**: *the order of steps is important!*): + +1. Ensure that your ``cardano-node`` checkout is clean, with no local modifications. Also, ensure that you start outside the node's Nix shell. +2. Check out the repository with the dependencies, *beside* the ``cardano-node`` checkout. You have to check out the git revision of the dependency used by your ``cardano-node`` checkout -- as listed in ``cardano-node/cabal.project``. + - we'll assume the ``ouroboros-network`` repository + - ..so a certain parent directory will include checkouts of both ``ouroboros-network`` and ``cardano-node``, at the same level + - ..and the git revision checked out in ``ouroboros-network`` will match the version of the ``ouroboros-network`` packages used currently + - Extra point #1: you can localise/check out several dependency repositories + - Extra point #2: for the dependencies that are not listed in ``cabal.project`` of the node -- how do you determine the version to check out? You can ask the workbench shell: + 1. Temporarily enter the workbench shell + 2. Look for the package version in ``ghc-pkg list`` + 3. Use that version to determine the git revision of the dependency's repository (using a tag or some special knowledge about the version management of said dependency). +3. Enter the workbench shell, as per instructions in previous sections -- or just a plain Nix shell. +4. Ensure you can build ``cardano-node`` with Cabal: ``cabal build exe:cardano-node``. If you can't something else is wrong. +5. Determine the *leaf dependency set* you will have to work on. The *leaf dependency set* is defined to include the target package you want to modify, and its reverse dependencies -- that is, packages that depend on it (inside the dependency repository). + - let's assume, for example, that you want to modify ``ouroboros-consensus-shelley`` + - ``ouroboros-consensus-shelley`` is not a leaf dependency in itself, since ``ouroboros-consensus-cardano`` (of the same ``ouroboros-network`` repository) depends on it -- so the *leaf dependency set* will include both of them. + - you might find out that you have to include a significant fraction of packages in ``ouroboros-network`` into this *leaf dependency set* -- do not despair. + - if the *leaf dependency set* is hard to determine, you can use ``cabal-plan`` -- which is included in the workbench shell (which you, therefore, have to enter temporarily): + .. code-block:: console + + [nix-shell:~/cardano-node]$ cabal-plan dot-png --revdep ouroboros-consensus-shelley + + This command will produce a HUGE ``deps.png`` file, which will contain the entire chart of the project dependencies. The important part to look for will be the subset of packages highlighted in red -- those, which belong to the ``ouroboros-network`` repository. This will be the full *leaf dependency set*. +6. Edit the ``cardano-node/cabal.project`` as follows: + - for the *leaf dependency set* in the very beginning of the ``cabal.project``, add their relative paths to the ``packages:`` section, e.g.: + .. code-block:: console + + packages: + cardano-api + cardano-cli + ... + trace-resources + trace-forward + ../ouroboros-network/ouroboros-consensus-shelley + ../ouroboros-network/ouroboros-consensus-cardano + +7. The two packages have now became **local** -- when you try ``cabal build exe:cardano-node`` now, you'll see that Cabal starts to build these dependencies you just localised. Hacking time! + +Hoogle +---- + +The workbench shell provides ``hoogle``, with a local database for the full set of dependencies: + +.. code-block:: console + + [nix-shell:~/cardano-node]$ hoogle search TxId + Byron.Spec.Ledger.UTxO newtype TxId + Byron.Spec.Ledger.UTxO TxId :: Hash -> TxId + Cardano.Chain.UTxO type TxId = Hash Tx + Cardano.Ledger.TxIn newtype TxId crypto + Cardano.Ledger.TxIn TxId :: SafeHash crypto EraIndependentTxBody -> TxId crypto + Cardano.Ledger.Shelley.API.Types newtype TxId crypto + Cardano.Ledger.Shelley.API.Types TxId :: SafeHash crypto EraIndependentTxBody -> TxId crypto + Cardano.Ledger.Shelley.Tx newtype TxId crypto + Cardano.Ledger.Shelley.Tx TxId :: SafeHash crypto EraIndependentTxBody -> TxId crypto + Ouroboros.Consensus.HardFork.Combinator data family TxId tx :: Type + -- plus more results not shown, pass --count=20 to see more + diff --git a/README.rst b/README.rst index 5beca959cd5..77698fa7c28 100644 --- a/README.rst +++ b/README.rst @@ -401,156 +401,6 @@ Byron vote submission: (--mainnet | --testnet-magic NATURAL) --filepath UpdateProposalVoteFile -**** -Development -**** - -Overview -==== - -The ``cardano-node`` development is primarily based on the Nix infrastructure (https://nixos.org/ ), which enables packaging, CI, development environments and deployments. - -On how to set up Nix for ``cardano-node`` development, please see `Building Cardano Node with nix `_. - -Workbench: a local cluster playground -==== - -You can quickly spin up a local cluster (on Linux and Darwin), based on any of a wide variety of configurations, and put it under a transaction generation workload -- using the ``workbench`` environment: - -1. Optional: choose a workbench profile: - - ``default`` stands for a light-state, 6-node cluster, under saturation workload, indefinite runtime - - ``ci-test`` is the profile run in the node CI -- very light, just two nodes and short runtime - - ``devops`` is an unloaded profile (no transaction generation) with short slots -- ``0.2`` sec. - - ..and many more -- which can be either: - - listed, by ``make ps`` - - observed at their point of definition: `nix/workbench/profiles/prof1-variants.jq `_ -2. Optional: select mode of operation, by optionally providing a suffix: - - default -- no suffix -- just enter the workbench shell, allowing you to run ``start-cluster`` at any time. Binaries will be built locally, by ``cabal``. - - ``autostay`` suffix -- enter the workbench shell, start the cluster, and stay in the shell afterwards. Binaries will be built locally, by ``cabal``. - - ``autonix`` suffix -- enter the workbench shell, start the cluster. All binaries will be provided by the Nix CI. - - ..there are other modes, as per `lib.mk `_ -3. Enter the workbench shell for the chosen profile & mode: - ``make `` or ``make -`` (when there is a suffix). -4. Optional: start cluster: - Depending on the chosen mode, your cluster might already start, or you are expected to start it yourself, using ``start-cluster``. - -The workbench services are available only inside the workbench shell. - -Using Cabal ----- - -By default, all binaries originating in the ``cardano-node`` repository are available to ``cabal build`` and ``cabal run``, unless the workbench was entered using one of the pure ``*nix`` modes. Note that in all cases, the dependencies for the workbench are supplied though Nix and have been built/tested on CI. - -**Dependency localisation** -or- *Cabal&Nix for painless cross-repository work* ----- - -The Cabal workflow described above only extends to the repository-local packages. Therefore, ordinarily, to work on ``cardano-node`` dependencies in the context of the node itself, one needs to go through an expensive multi-step process -- with committing, pushing and re-pinning of the dependency changes. - -The **dependency localisation** workflow allows us to pick a subset of leaf dependencies of the ``cardano-node`` repository, and declare them *local* -- so they can be iterated upon using the ``cabal build`` / ``cabal run`` of ``cardano-node`` itself. This cuts development iteration time dramatically and enables effective cross-repo development of the full stack of Cardano packages. - -Without further ado (**NOTE**: *the order of steps is important!*): - -1. Ensure that your ``cardano-node`` checkout is clean, with no local modifications. Also, ensure that you start outside the node's Nix shell. -2. Check out the repository with the dependencies, *beside* the ``cardano-node`` checkout. You have to check out the git revision of the dependency used by your ``cardano-node`` checkout -- as listed in ``cardano-node/cabal.project``. - - we'll assume the ``ouroboros-network`` repository - - ..so a certain parent directory will include checkouts of both ``ouroboros-network`` and ``cardano-node``, at the same level - - ..and the git revision checked out in ``ouroboros-network`` will match the corresponding ``source-repository-package`` clause in ``cardano-node/cabal.project``. - - Extra point #1: you can localise/check out several dependency repositories - - Extra point #2: for the dependencies that are not listed in ``cabal.project`` of the node -- how do you determine the version to check out? You can ask the workbench shell: - 1. Temporarily enter the workbench shell - 2. Look for the package version in ``ghc-pkg list`` - 3. Use that version to determine the git revision of the dependency's repository (using a tag or some special knowledge about the version management of said dependency). -3. Enter the workbench shell, as per instructions in previous sections -- or just a plain Nix shell. -4. Ensure you can build ``cardano-node`` with Cabal: ``cabal build exe:cardano-node``. If you can't something else is wrong. -5. Determine the *leaf dependency set* you will have to work on. The *leaf dependency set* is defined to include the target package you want to modify, and its reverse dependencies -- that is, packages that depend on it (inside the dependency repository). - - let's assume, for example, that you want to modify ``ouroboros-consensus-shelley`` - - ``ouroboros-consensus-shelley`` is not a leaf dependency in itself, since ``ouroboros-consensus-cardano`` (of the same ``ouroboros-network`` repository) depends on it -- so the *leaf dependency set* will include both of them. - - you might find out that you have to include a significant fraction of packages in ``ouroboros-network`` into this *leaf dependency set* -- do not despair. - - if the *leaf dependency set* is hard to determine, you can use ``cabal-plan`` -- which is included in the workbench shell (which you, therefore, have to enter temporarily): - .. code-block:: console - - [nix-shell:~/cardano-node]$ cabal-plan dot-png --revdep ouroboros-consensus-shelley - - This command will produce a HUGE ``deps.png`` file, which will contain the entire chart of the project dependencies. The important part to look for will be the subset of packages highlighted in red -- those, which belong to the ``ouroboros-network`` repository. This will be the full *leaf dependency set*. -6. Edit the ``cardano-node/cabal.project`` as follows: - - for the *leaf dependency set*, in the very beginning of the ``cabal.project``, add their relative paths to the ``packages:`` section, e.g.: - .. code-block:: console - - packages: - cardano-api - cardano-cli - ... - trace-resources - trace-forward - ../ouroboros-network/ouroboros-consensus-shelley - ../ouroboros-network/ouroboros-consensus-cardano - -7. The two packages have now became **local** -- when you try ``cabal build exe:cardano-node`` now, you'll see that Cabal starts to build these dependencies you just localised. Hacking time! - -Hoogle ----- - -The workbench shell provides ``hoogle``, with a local database for the full set of dependencies: - -.. code-block:: console - - [nix-shell:~/cardano-node]$ hoogle search TxId - Byron.Spec.Ledger.UTxO newtype TxId - Byron.Spec.Ledger.UTxO TxId :: Hash -> TxId - Cardano.Chain.UTxO type TxId = Hash Tx - Cardano.Ledger.TxIn newtype TxId crypto - Cardano.Ledger.TxIn TxId :: SafeHash crypto EraIndependentTxBody -> TxId crypto - Cardano.Ledger.Shelley.API.Types newtype TxId crypto - Cardano.Ledger.Shelley.API.Types TxId :: SafeHash crypto EraIndependentTxBody -> TxId crypto - Cardano.Ledger.Shelley.Tx newtype TxId crypto - Cardano.Ledger.Shelley.Tx TxId :: SafeHash crypto EraIndependentTxBody -> TxId crypto - Ouroboros.Consensus.HardFork.Combinator data family TxId tx :: Type - -- plus more results not shown, pass --count=20 to see more - -Supplementary tooling -==== - -GHCID ----- - -run *ghcid* with: ``ghcid -c "cabal repl exe:cardano-node --reorder-goals"`` - -Haskell Language Server ----- - -When using Haskell Language Server with Visual Studio Code, you may find that -`HLINT annotations are ignored `_. - -To work around this, you may run the script ``./scripts/reconfigure-hlint.sh`` to generate a ``.hlint.yaml`` -file with HLINT ignore rules derived from the source code. - -Testing -==== - -``cardano-node`` is essentially a container which implements several components such networking, consensus, and storage. These components have individual test coverage. The node goes through integration and release testing by Devops/QA while automated CLI tests are ongoing alongside development. - -Developers on ``cardano-node`` can `launch their own testnets `_ or `run the chairman tests `_ locally. - - -Debugging -==== - -Pretty printing CBOR encoded files ----- - -It may be useful to print the on chain representations of blocks, delegation certificates, txs and update proposals. There are two commands that do this (for any cbor encoded file): - -To pretty print as CBOR: -``cabal exec cardano-cli -- pretty-print-cbor --filepath CBOREncodedFile`` - -Validate CBOR files ----- - -You can validate Byron era blocks, delegation certificates, txs and update proposals with the ``validate-cbor`` command. - -``cabal exec cardano-cli -- validate-cbor --byron-block 21600 --filepath CBOREncodedByronBlockFile`` - - **** Native Tokens **** @@ -574,3 +424,10 @@ The API documentation is published `here `_ to get the packages defined in this repository. +Please note that you may need to use any ``source-repository-package`` stanzas defined in ``cabal.project``, although we will endeavour to keep these to an absolute minimum. diff --git a/cabal.project b/cabal.project index a5f330b15ed..6757619abc3 100644 --- a/cabal.project +++ b/cabal.project @@ -1,5 +1,19 @@ --- run `nix flake lock --update-input hackageNix` after updating index-state. +-- Custom repository for cardano haskell packages, see CONTRIBUTING for more +repository cardano-haskell-packages + url: https://input-output-hk.github.io/cardano-haskell-packages + secure: True + root-keys: + 3e0cce471cf09815f930210f7827266fd09045445d65923e6d0238a6cd15126f + 443abb7fb497a134c343faf52f0b659bd7999bc06b7f63fa76dc99d631f9bea1 + a86a1f6ce86c449c46666bda44268677abf29b5b2d2eb5ec7af903ec2f117a82 + bcec67e8e99cabfa7764d75ad9b158d72bfacf70ca1d0ec8bc6b4406d1bf8413 + c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56 + d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee + +-- See CONTRIBUTING for information about these, including some Nix commands +-- you need to run if you change them index-state: 2022-07-01T00:00:00Z +index-state: cardano-haskell-packages 2022-08-31T08:36:45Z packages: cardano-api @@ -54,282 +68,10 @@ package cryptonite -- generation is dubious. Set the flag so we use /dev/urandom by default. flags: -support_rdrand --- --------------------------------------------------------- --- Disable all tests by default - -tests: False +tests: True test-show-details: direct --- Then enable specific tests in this repo - -package cardano-api - tests: True - -package cardano-cli - tests: True - -package cardano-node - tests: True - -package cardano-node-chairman - tests: True - -package cardano-submit-api - tests: True - -package cardano-testnet - tests: True - -package trace-resources - tests: True - -package trace-dispatcher - tests: True - -package trace-forward - tests: True - -package cardano-tracer - tests: True - -package trace-resources - tests: True - -package locli - tests: True - --- The following is needed because Nix is doing something crazy. -package byron-spec-ledger - tests: False - -package vector-map - ghc-options: -Werror - -package iohk-monitoring - tests: False - -package ouroboros-consensus-test - tests: False - -package ouroboros-consensus-cardano-test - tests: False - -package ouroboros-network - tests: False - -package ouroboros-network-framework - tests: False - -package plutus-tx - tests: False - -package prettyprinter-configurable - tests: False - -package small-steps - tests: False - -package small-steps-test - tests: False - -package tx-generator - tests: True - -package goblins - tests: False - -package io-classes - tests: False - -package cardano-ledger-alonzo-test - tests: False - --- --------------------------------------------------------- - --- The two following one-liners will cut off / restore the remainder of this file (for nix-shell users): --- when using the "cabal" wrapper script provided by nix-shell. --- --------------------------- 8< -------------------------- --- Please do not put any `source-repository-package` clause above this line. - --- Using a fork until our patches can be merged upstream -source-repository-package - type: git - location: https://github.com/input-output-hk/optparse-applicative - tag: 7497a29cb998721a9068d5725d49461f2bba0e7a - --sha256: 1gvsrg925vynwgqwplgjmp53vj953qyh3wbdf34pw21c8r47w35r - -source-repository-package - type: git - location: https://github.com/vshabanov/ekg-json - tag: 00ebe7211c981686e65730b7144fbf5350462608 - --sha256: 1zvjm3pb38w0ijig5wk5mdkzcszpmlp5d4zxvks2jk1rkypi8gsm - -source-repository-package - type: git - location: https://github.com/input-output-hk/hedgehog-extras - tag: 714ee03a5a786a05fc57ac5d2f1c2edce4660d85 - --sha256: 1qa4mm36xynaf17990ijmzww0ij8hjrc0vw5nas6d0zx6q9hb978 - -source-repository-package - type: git - location: https://github.com/input-output-hk/cardano-base - tag: a3c13fb11bc41fedff7885ca70a3b33f61fef4b5 - --sha256: 0h492cz9mvzbsl5yzvp3iq40c0z0j5hmrifdrnnqzzk02g9j9c4b - subdir: - base-deriving-via - binary - binary/test - cardano-crypto-class - cardano-crypto-praos - cardano-crypto-tests - measures - orphans-deriving-via - slotting - strict-containers - -source-repository-package - type: git - location: https://github.com/input-output-hk/cardano-crypto - tag: f73079303f663e028288f9f4a9e08bcca39a923e - --sha256: 1n87i15x54s0cjkh3nsxs4r1x016cdw1fypwmr68936n3xxsjn6q - -source-repository-package - type: git - location: https://github.com/input-output-hk/cardano-ledger - tag: f49879a79098d9372d63baa13b94a941a56eda34 - --sha256: 0i9x66yqkrvx2w79dy6lzlya82yxc8567rgjj828vc2d46d6nvx6 - subdir: - eras/alonzo/impl - eras/alonzo/test-suite - eras/babbage/impl - eras/babbage/test-suite - eras/byron/chain/executable-spec - eras/byron/crypto - eras/byron/crypto/test - eras/byron/ledger/executable-spec - eras/byron/ledger/impl - eras/byron/ledger/impl/test - eras/shelley/impl - eras/shelley/test-suite - eras/shelley-ma/impl - eras/shelley-ma/test-suite - libs/cardano-ledger-core - libs/cardano-ledger-pretty - libs/cardano-protocol-tpraos - libs/cardano-data - libs/vector-map - libs/set-algebra - libs/small-steps - libs/small-steps-test - libs/non-integral - -source-repository-package - type: git - location: https://github.com/input-output-hk/cardano-prelude - tag: 6ea36cf2247ac0bc33e08c327abec34dfd05bd99 - --sha256: 0z2y3wzppc12bpn9bl48776ms3nszw8j58xfsdxf97nzjgrmd62g - subdir: - cardano-prelude - cardano-prelude-test - -source-repository-package - type: git - location: https://github.com/input-output-hk/goblins - tag: cde90a2b27f79187ca8310b6549331e59595e7ba - --sha256: 17c88rbva3iw82yg9srlxjv2ia5wjb9cyqw44hik565f5v9svnyg - -source-repository-package - type: git - location: https://github.com/input-output-hk/iohk-monitoring-framework - tag: 066f7002aac5a0efc20e49643fea45454f226caa - --sha256: 0s6x4in11k5ba7nl7la896g28sznf9185xlqg9c604jqz58vj9nj - subdir: - contra-tracer - iohk-monitoring - plugins/backend-aggregation - plugins/backend-ekg - plugins/backend-monitoring - plugins/backend-trace-forwarder - plugins/scribe-systemd - tracer-transformers - -source-repository-package - type: git - location: https://github.com/input-output-hk/Win32-network - tag: 3825d3abf75f83f406c1f7161883c438dac7277d - --sha256: 19wahfv726fa3mqajpqdqhnl9ica3xmf68i254q45iyjcpj1psqx - -source-repository-package - type: git - location: https://github.com/input-output-hk/ouroboros-network - tag: c764553561bed8978d2c6753d1608dc65449617a - --sha256: 0hdh7xdrvxw943r6qr0xr4kwszindh5mnsn1lww6qdnxnmn7wcsc - subdir: - monoidal-synchronisation - network-mux - ouroboros-consensus - ouroboros-consensus-byron - ouroboros-consensus-cardano - ouroboros-consensus-protocol - ouroboros-consensus-shelley - ouroboros-network - ouroboros-network-framework - ouroboros-network-testing - -source-repository-package - type: git - location: https://github.com/input-output-hk/io-sim - tag: f4183f274d88d0ad15817c7052df3a6a8b40e6dc - --sha256: 0vb2pd9hl89v2y5hrhrsm69yx0jf98vppjmfncj2fraxr3p3lldw - subdir: - io-classes - io-sim - strict-stm - -source-repository-package - type: git - location: https://github.com/input-output-hk/typed-protocols - tag: 181601bc3d9e9d21a671ce01e0b481348b3ca104 - --sha256: 1lr97b2z7l0rpsmmz92rsv27qzd5vavz10cf7n25svya4kkiysp5 - subdir: - typed-protocols - typed-protocols-cborg - typed-protocols-examples - -source-repository-package - type: git - location: https://github.com/input-output-hk/plutus - tag: f680ac6979e069fcc013e4389ee607ff5fa6672f - --sha256: 180jq8hd0jlg48ya7b5yw3bnd2d5czy0b1agy9ng3mgnzpyq747i - subdir: - plutus-core - plutus-ledger-api - plutus-tx - plutus-tx-plugin - prettyprinter-configurable - stubs/plutus-ghc-stub - word-array - -source-repository-package - type: git - location: https://github.com/input-output-hk/ekg-forward - tag: 8a21e6c3fd9b306e07e0e0f39047032c97789b38 - --sha256: 170vgf94g6fhc2p2cx58gqy9520gs39ddl7q4lkqyr8h33p9wrvq - -source-repository-package - type: git - location: https://github.com/denisshevchenko/threepenny-gui - tag: 4ec92ded05ccf59ba4a874be4b404ac1b6d666b6 - --sha256: 00fvvaf4ir4hskq4a6gggbh2wmdvy8j8kn6s4m1p1vlh8m8mq514 - --- Drops an instance breaking our code. Should be released to Hackage eventually. -source-repository-package - type: git - location: https://github.com/input-output-hk/flat - tag: ee59880f47ab835dbd73bea0847dab7869fc20d8 - --sha256: 1lrzknw765pz2j97nvv9ip3l1mcpf2zr4n56hwlz0rk7wq7ls4cm - constraints: hedgehog >= 1.0 , bimap >= 0.4.0 @@ -348,11 +90,35 @@ package snap-server package comonad flags: -test-doctests -package cardano-ledger-alonzo-test - tests: False - allow-newer: *:aeson, monoidal-containers:aeson, size-based:template-haskell, snap-server:attoparsec, + +-- IMPORTANT +-- Do NOT add more source-repository-package stanzas here unless they are strictly +-- temporary! Please read the section in CONTRIBUTING about updating dependencies. + +-- TODO (mpj): remove this once https://github.com/input-output-hk/ekg-forward/pull/10 +-- is merged and released to CHaP +source-repository-package + type: git + location: https://github.com/input-output-hk/ekg-forward + tag: 8a21e6c3fd9b306e07e0e0f39047032c97789b38 + --sha256: 170vgf94g6fhc2p2cx58gqy9520gs39ddl7q4lkqyr8h33p9wrvq + +-- Open PR upstream, maintainer unresponsive, hopefully short-lived fork. +-- TODO (mpj): release into CHaP as a patched version and delete +source-repository-package + type: git + location: https://github.com/vshabanov/ekg-json + tag: 00ebe7211c981686e65730b7144fbf5350462608 + --sha256: 1zvjm3pb38w0ijig5wk5mdkzcszpmlp5d4zxvks2jk1rkypi8gsm + +source-repository-package + type: git + location: https://github.com/denisshevchenko/threepenny-gui + tag: 4ec92ded05ccf59ba4a874be4b404ac1b6d666b6 + --sha256: 00fvvaf4ir4hskq4a6gggbh2wmdvy8j8kn6s4m1p1vlh8m8mq514 + diff --git a/flake.lock b/flake.lock index edc00b8a673..3f7d137431c 100644 --- a/flake.lock +++ b/flake.lock @@ -2532,6 +2532,23 @@ "type": "github" } }, + "CHaP": { + "flake": false, + "locked": { + "lastModified": 1663153559, + "narHash": "sha256-395ipfzWf6KFhRY8sYS/M0q8D5qpy3RNk4UktP8srHc=", + "owner": "input-output-hk", + "repo": "cardano-haskell-packages", + "rev": "2ec5c627e31fbac059ceb2b437d283a09b6b195e", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "repo", + "repo": "cardano-haskell-packages", + "type": "github" + } + }, "customConfig": { "locked": { "lastModified": 1630400035, @@ -10069,6 +10086,7 @@ "inputs": { "cardano-mainnet-mirror": "cardano-mainnet-mirror", "cardano-node-workbench": "cardano-node-workbench", + "CHaP": "CHaP", "customConfig": "customConfig_2", "flake-compat": "flake-compat_2", "hackageNix": "hackageNix", diff --git a/flake.nix b/flake.nix index 51741f47198..9705e464776 100644 --- a/flake.nix +++ b/flake.nix @@ -18,6 +18,10 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.hackage.follows = "hackageNix"; }; + CHaP = { + url = "github:input-output-hk/cardano-haskell-packages?ref=repo"; + flake = false; + }; utils.url = "github:numtide/flake-utils"; iohkNix = { url = "github:input-output-hk/iohk-nix"; @@ -67,6 +71,7 @@ , hostNixpkgs , utils , haskellNix + , CHaP , iohkNix , plutus-apps , cardano-mainnet-mirror @@ -202,6 +207,9 @@ project = (import ./nix/haskell.nix { inherit (pkgs) haskell-nix gitrev; inherit projectPackagesExes; + inputMap = { + "https://input-output-hk.github.io/cardano-haskell-packages" = CHaP; + }; }).appendModule customConfig.haskellNix // { profiled = profiledProject; asserted = assertedProject; diff --git a/nix/haskell.nix b/nix/haskell.nix index 05a3c63c853..f1a9e64a865 100644 --- a/nix/haskell.nix +++ b/nix/haskell.nix @@ -6,6 +6,7 @@ gitrev , # Pre-computed package list (generated by nix/regenerate.sh) to avoid double evaluation: projectPackagesExes +, inputMap }: let @@ -23,6 +24,7 @@ haskell-nix.cabalProject' ({ pkgs , buildProject , ... }: { + inherit inputMap; name = "cardano-node"; src = haskellLib.cleanSourceWith { src = ../.; @@ -43,8 +45,6 @@ haskell-nix.cabalProject' ({ pkgs shell = { name = "cabal-dev-shell"; - packages = lib.attrVals projectPackageNames; - # These programs will be available inside the nix-shell. nativeBuildInputs = with pkgs.buildPackages.buildPackages; [ nix-prefetch-git @@ -52,15 +52,9 @@ haskell-nix.cabalProject' ({ pkgs hlint ghcid haskell-language-server - cabalWrapped - # we also add cabal (even if cabalWrapped will be used by default) for shell completion: cabal ]; - # Prevents cabal from choosing alternate plans, so that - # *all* dependencies are provided by Nix. - exactDeps = true; - withHoogle = true; }; modules = diff --git a/nix/workbench/manifest.sh b/nix/workbench/manifest.sh index 1ffd5dd32df..507ab7e6a98 100644 --- a/nix/workbench/manifest.sh +++ b/nix/workbench/manifest.sh @@ -131,10 +131,8 @@ manifest_git_checkout_state_desc() { } manifest_cabal_project_dep_pin_hash() { - local project_file=$1/cabal.project - local dep=$2 - grep "^[ ]*location: .*/${dep}\$" "${project_file}" -A1 \ - | tail -n-1 | sed 's/^.* tag: //' + # FIXME + echo 0123456789ABCDEF0123456789ABCDEF01234567 } manifest_local_repo_branch() { diff --git a/nix/workbench/run.sh b/nix/workbench/run.sh index fb2d547c6a8..29c318e8858 100644 --- a/nix/workbench/run.sh +++ b/nix/workbench/run.sh @@ -703,14 +703,8 @@ run_aws_get() { } node_cabal_source_at() { - local node=$1 - local pin=$2 - - git show $node:cabal.project | - grep "location: .*/$pin\$" -A1 | - tail -n1 | - cut -d: -f2 | - cut -c 2- + # FIXME + echo 0123456789ABCDEF0123456789ABCDEF01234567 } legacy_run_manifest() { diff --git a/nix/workbench/shell.nix b/nix/workbench/shell.nix index 2c8e17f1a42..0df5b6a1128 100644 --- a/nix/workbench/shell.nix +++ b/nix/workbench/shell.nix @@ -78,8 +78,6 @@ in project.shellFor { inherit withHoogle; - packages = ps: builtins.attrValues (haskellLib.selectProjectPackages ps); - tools = { haskell-language-server = { version = "latest"; @@ -130,9 +128,5 @@ in project.shellFor { cluster.workbench.workbench ]; - # Prevents cabal from choosing alternate plans, so that - # *all* dependencies are provided by Nix. - exactDeps = true; - } // { inherit shellHook; } diff --git a/shell.nix b/shell.nix index 7cfab1ca141..c56184ba6a9 100644 --- a/shell.nix +++ b/shell.nix @@ -103,10 +103,6 @@ let pkgs.time ]; - # Prevents cabal from choosing alternate plans, so that - # *all* dependencies are provided by Nix. - exactDeps = true; - shellHook = '' echo "DevOps Tools" \ | ${figlet}/bin/figlet -f banner -c \