Skip to content

Commit c18337c

Browse files
Try #4078:
2 parents b83d44e + 6375799 commit c18337c

File tree

12 files changed

+145
-200
lines changed

12 files changed

+145
-200
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ jobs:
8888
cabal --version
8989
echo "cabal-store=$(dirname $(cabal --help | tail -1 | tr -d ' '))\\store" >> $GITHUB_OUTPUT
9090
91-
- name: Update Hackage index
92-
run: cabal update
93-
9491
- name: Set cache version
9592
run: echo "CACHE_VERSION=20220919" >> $GITHUB_ENV
9693

@@ -134,6 +131,9 @@ jobs:
134131
run: |
135132
cp .github/workflows/cabal.project.local.Windows cabal.project.local
136133
134+
- name: Update Hackage and CHaP
135+
run: cabal update
136+
137137
- name: Record dependencies
138138
id: record-deps
139139
run: |

CONTRIBUTING.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,64 @@ out=$(pwd) genericBuild
3838
```
3939

4040
Build logs are written to stdout and artifacts written to the current directory.
41+
42+
## Releasing packages to CHaP
43+
44+
When new versions of the packages are released, they should be included in [CHaP](https://github.com/input-output-hk/cardano-haskell-packages).
45+
See the CHaP README for [instructions](https://github.com/input-output-hk/cardano-haskell-packages#-from-github).
46+
47+
## Updating dependencies
48+
49+
Our Haskell packages come from two package repositories:
50+
- Hackage
51+
- [CHaP](https://github.com/input-output-hk/cardano-haskell-packages) (which is essentially another Hackage)
52+
53+
The "index state" of each repository is pinned to a particular time in
54+
`cabal.project`. This tells Cabal to treat the repository as if it was
55+
the specified time, ensuring reproducibility. If you want to use a package
56+
version from repository X which was added after the pinned index state
57+
time, you need to bump the index state for X. This is not a big deal,
58+
since all it does is change what packages `cabal` considers to be available
59+
when doing solving, but it will change what package versions cabal picks
60+
for the plan, and so will likely result in significant recompilation, and
61+
potentially some breakage. That typically just means that we need to fix
62+
the breakage (increasing the lower-bound on the problematic package if fix
63+
is not backward compatible), or delay that work and instead decrease the
64+
upper-bound on the problematic package for now.
65+
66+
Note that `cabal`'s own persistent state includes which index states it is
67+
aware of, so when you bump the pinned index state you may need to
68+
call `cabal update` in order for `cabal` to be happy.
69+
70+
The Nix code which builds our packages also needs some information relating
71+
to the index-state. This information needs to be new enough to include
72+
the index-state specified in `cabal.project`. The information is represented
73+
by inputs managed by `niv`:
74+
You can update these by running:
75+
- `niv update hackage.nix` for Hackage
76+
- `niv update CHaP` for CHaP
77+
78+
If you fail to do this you may get an error like this from Nix:
79+
```
80+
error: Unknown index-state 2021-08-08T00:00:00Z, the latest index-state I know about is 2021-08-06T00:00:00Z. You may need to update to a newer hackage.nix.
81+
```
82+
83+
### Use of `source-repository-package`s
84+
85+
We *can* use Cabal's `source-repository-package` mechanism to pull in
86+
un-released package versions. This can be useful when debugging/developing
87+
across different repositories. However, we should not release our packages
88+
to CHaP while we depend on a `source-repository-package` since downstream
89+
consumers would not be able to build such package.
90+
91+
If we are stuck in a situation where we need a long-running fork of a
92+
package, we should release it to CHaP instead (see the
93+
https://github.com/input-output-hk/cardano-haskell-packages[CHaP README]
94+
for more).
95+
96+
If you do add a temporary `source-repository-package` stanza, you need to
97+
provide a `--sha256` comment in `cabal.project` so that Nix knows the hash
98+
of the content. There are two relatively straightforward ways to do this:
99+
100+
1. The TOFU approach: put in the wrong hash and then Nix will tell you the correct one, which you can copy in.
101+
2. Calculate the hash with `nix-shell -p nix-prefetch-git --run 'nix-prefetch-git <URL> <COMMIT_HASH>'`

cabal.project

Lines changed: 53 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1+
-- Custom repository for cardano haskell packages, see CONTRIBUTING for more
2+
repository cardano-haskell-packages
3+
url: https://input-output-hk.github.io/cardano-haskell-packages
4+
secure: True
5+
root-keys:
6+
3e0cce471cf09815f930210f7827266fd09045445d65923e6d0238a6cd15126f
7+
443abb7fb497a134c343faf52f0b659bd7999bc06b7f63fa76dc99d631f9bea1
8+
a86a1f6ce86c449c46666bda44268677abf29b5b2d2eb5ec7af903ec2f117a82
9+
bcec67e8e99cabfa7764d75ad9b158d72bfacf70ca1d0ec8bc6b4406d1bf8413
10+
c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56
11+
d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee
12+
13+
-- See CONTRIBUTING for some Nix commands you will need to run if you
14+
-- update either of these.
15+
-- Bump this if you need newer packages from Hackage
116
index-state: 2022-07-01T00:00:00Z
17+
-- Bump this if you need newer packages from CHaP
18+
index-state: cardano-haskell-packages 2022-11-07T00:00:00Z
219

320
packages: ./ouroboros-network-testing
421
./monoidal-synchronisation
@@ -22,18 +39,7 @@ packages: ./ouroboros-network-testing
2239
./ntp-client
2340
./cardano-client
2441

25-
constraints:
26-
ip < 1.5
27-
, hedgehog >= 1.0
28-
, bimap >= 0.4.0
29-
, ListLike >= 4.7.3
30-
, witherable >= 0.4
31-
32-
-- Plutus dependency
33-
, algebraic-graphs < 0.7
34-
35-
package Win32-network
36-
tests: True
42+
tests: True
3743

3844
package io-classes
3945
flags: +asserts
@@ -44,184 +50,38 @@ package strict-stm
4450
package network-mux
4551
flags: +asserts
4652

47-
package ouroboros-network-testing
48-
tests: True
49-
50-
package mux
51-
tests: True
52-
5353
package ouroboros-network
54-
tests: True
5554
flags: +asserts +cddl
5655

57-
5856
package ouroboros-consensus
5957
flags: +asserts
6058

61-
package ouroboros-consensus-test
62-
tests: True
63-
6459
package ouroboros-consensus-mock
6560
flags: +asserts
6661

67-
package ouroboros-consensus-mock-test
68-
tests: True
69-
7062
package ouroboros-consensus-byron
7163
flags: +asserts
7264

73-
package ouroboros-consensus-byron-test
74-
tests: True
75-
7665
package ouroboros-consensus-shelley
7766
flags: +asserts
7867

79-
package ouroboros-consensus-shelley-test
80-
tests: True
81-
8268
package ouroboros-consensus-cardano
8369
flags: +asserts
8470

85-
package ouroboros-consensus-cardano-test
86-
tests: True
87-
88-
package ouroboros-consensus-cardano-tools
89-
tests: True
90-
91-
92-
package cardano-binary
93-
tests: False
94-
95-
package cardano-crypto
96-
tests: False
97-
98-
package cardano-crypto-class
99-
tests: False
100-
101-
package cardano-crypto-wrapper
102-
tests: False
103-
104-
package cardano-prelude-test
105-
tests: False
106-
107-
package contra-tracer
108-
tests: False
109-
110-
package byron-spec-chain
111-
tests: False
112-
113-
package byron-spec-ledger
114-
tests: False
115-
116-
package cardano-ledger-byron
117-
tests: False
118-
119-
package cardano-ledger-shelley-ma-test
120-
tests: False
121-
122-
package cardano-ledger-byron-test
123-
tests: False
124-
125-
package goblins
126-
tests: False
127-
128-
package shelley-spec-ledger-test
129-
tests: False
130-
131-
package cardano-ledger-alonzo-test
132-
tests: False
133-
134-
package shelley-spec-non-integral
135-
tests: False
136-
137-
package small-steps
138-
tests: False
139-
140-
package small-steps-test
141-
tests: False
142-
143-
package plutus-tx
144-
tests: False
145-
146-
package plutus-core
147-
tests: False
148-
149-
package prettyprinter-configurable
150-
tests: False
151-
152-
allow-newer:
153-
size-based:template-haskell
154-
15571
constraints:
72+
-- CONSTRAINTS FOR UPSTREAM CARDANO PACKAGES
73+
-- These should all be constraints in upstream packages, but are currently missing.
74+
-- We should a) fix these upstream and b) revise the constraints on the released
75+
-- version in CHaP.
76+
-- TODO Unfortunately revisions in CHaP don't work yet, revisit this when we fix it.
77+
-- See https://github.com/input-output-hk/haskell.nix/issues/1675
78+
15679
-- bizarre issue: in earlier versions they define their own 'GEq', in newer
15780
-- ones they reuse the one from 'some', but there isn't e.g. a proper version
15881
-- constraint from dependent-sum-template (which is the library we actually use).
15982
, dependent-sum > 0.6.2.0
160-
161-
-- ---------------------------------------------------------
162-
-- The "cabal" wrapper script provided by nix-shell will cut off / restore the remainder of this file
163-
-- in order to force usage of nix provided dependencies for `source-repository-package`s.
164-
-- --------------------------- 8< --------------------------
165-
-- Please do not put any `source-repository-package` clause above this line.
166-
167-
source-repository-package
168-
type: git
169-
location: https://github.com/input-output-hk/io-sim
170-
tag: 0df93fe773e9b66ce35f3637128533e5b0029558
171-
--sha256: 0vcafginvx4vcd78brihan8b8s436qihrl6h3swsgh86vbfp2r27
172-
subdir:
173-
io-classes
174-
io-sim
175-
strict-stm
176-
177-
source-repository-package
178-
type: git
179-
location: https://github.com/input-output-hk/typed-protocols
180-
tag: c5e87c9ba2854966794f04c5c2887faa09bf2214
181-
--sha256: 06iqdgl97rms9mk56kn4g445ppi47jsshfn5gl1f9cr1zvlqhcrv
182-
subdir:
183-
typed-protocols
184-
typed-protocols-cborg
185-
typed-protocols-examples
186-
187-
source-repository-package
188-
type: git
189-
location: https://github.com/input-output-hk/Win32-network
190-
tag: 3825d3abf75f83f406c1f7161883c438dac7277d
191-
--sha256: 19wahfv726fa3mqajpqdqhnl9ica3xmf68i254q45iyjcpj1psqx
192-
193-
source-repository-package
194-
type: git
195-
location: https://github.com/input-output-hk/iohk-monitoring-framework
196-
tag: 066f7002aac5a0efc20e49643fea45454f226caa
197-
--sha256: 0s6x4in11k5ba7nl7la896g28sznf9185xlqg9c604jqz58vj9nj
198-
subdir: contra-tracer
199-
200-
source-repository-package
201-
type: git
202-
location: https://github.com/input-output-hk/cardano-prelude
203-
tag: 533aec85c1ca05c7d171da44b89341fb736ecfe5
204-
--sha256: 0z2y3wzppc12bpn9bl48776ms3nszw8j58xfsdxf97nzjgrmd62g
205-
subdir:
206-
cardano-prelude
207-
cardano-prelude-test
208-
209-
source-repository-package
210-
type: git
211-
location: https://github.com/input-output-hk/cardano-base
212-
tag: 631cb6cf1fa01ab346233b610a38b3b4cba6e6ab
213-
--sha256: 0944wg2nqazmhlmsynwgdwxxj6ay0hb9qig9l128isb2cjia0hlp
214-
subdir:
215-
base-deriving-via
216-
binary
217-
binary/test
218-
cardano-crypto-class
219-
cardano-crypto-praos
220-
cardano-crypto-tests
221-
measures
222-
orphans-deriving-via
223-
slotting
224-
strict-containers
83+
-- plutus-core: needs a constraint here, fixed on plutus master but not in the released version
84+
, algebraic-graphs < 0.7
22585

22686
source-repository-package
22787
type: git
@@ -253,6 +113,32 @@ source-repository-package
253113
libs/small-steps-test
254114
libs/vector-map
255115

116+
source-repository-package
117+
type: git
118+
location: https://github.com/input-output-hk/cardano-prelude
119+
tag: 533aec85c1ca05c7d171da44b89341fb736ecfe5
120+
--sha256: 0z2y3wzppc12bpn9bl48776ms3nszw8j58xfsdxf97nzjgrmd62g
121+
subdir:
122+
cardano-prelude
123+
cardano-prelude-test
124+
125+
source-repository-package
126+
type: git
127+
location: https://github.com/input-output-hk/cardano-base
128+
tag: 631cb6cf1fa01ab346233b610a38b3b4cba6e6ab
129+
--sha256: 0944wg2nqazmhlmsynwgdwxxj6ay0hb9qig9l128isb2cjia0hlp
130+
subdir:
131+
base-deriving-via
132+
binary
133+
binary/test
134+
cardano-crypto-class
135+
cardano-crypto-praos
136+
cardano-crypto-tests
137+
measures
138+
orphans-deriving-via
139+
slotting
140+
strict-containers
141+
256142
source-repository-package
257143
type: git
258144
location: https://github.com/input-output-hk/plutus
@@ -264,23 +150,3 @@ source-repository-package
264150
plutus-core
265151
prettyprinter-configurable
266152
word-array
267-
268-
source-repository-package
269-
type: git
270-
location: https://github.com/input-output-hk/goblins
271-
tag: cde90a2b27f79187ca8310b6549331e59595e7ba
272-
--sha256: 17c88rbva3iw82yg9srlxjv2ia5wjb9cyqw44hik565f5v9svnyg
273-
274-
source-repository-package
275-
type: git
276-
location: https://github.com/input-output-hk/cardano-crypto
277-
tag: f73079303f663e028288f9f4a9e08bcca39a923e
278-
--sha256: 1n87i15x54s0cjkh3nsxs4r1x016cdw1fypwmr68936n3xxsjn6q
279-
280-
-- Drops an instance breaking the Plutus code. Should be released to Hackage
281-
-- eventually.
282-
source-repository-package
283-
type: git
284-
location: https://github.com/input-output-hk/flat
285-
tag: ee59880f47ab835dbd73bea0847dab7869fc20d8
286-
--sha256: 1lrzknw765pz2j97nvv9ip3l1mcpf2zr4n56hwlz0rk7wq7ls4cm

network-mux/network-mux.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ test-suite test
124124
build-depends: base,
125125
io-classes,
126126
strict-stm,
127-
io-sim ^>=0.3,
127+
io-sim >=0.3 && < 0.4,
128128
contra-tracer,
129129
network-mux,
130130
Win32-network,

nix/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ let
4848
};
4949
})
5050
# And, of course, our haskell-nix-ified cabal project:
51-
(import ./pkgs.nix)
51+
(import ./pkgs.nix { inherit sources; })
5252
] ++ [
5353
# This overlay adds a field localConfig to the pkgs that will be used
5454
# afterwards to retrieve the locally defined values for building the

0 commit comments

Comments
 (0)