Skip to content

Commit b16cd44

Browse files
authored
SRP for constrained generators via nix inputs
* Change constrained-generators SRP to nix flake input * Update documentation
1 parent a7fb33a commit b16cd44

File tree

4 files changed

+60
-2
lines changed

4 files changed

+60
-2
lines changed

CONTRIBUTING.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,43 @@ In particular, we should not release our packages to CHaP while we depend on a `
101101

102102
If we are stuck in a situation where we need a long-running fork of a package, we should release it to CHaP instead (see the [CHaP README](https://github.com/IntersectMBO/cardano-haskell-packages) for more).
103103

104-
If you do add a `source-repository-package`, you need to provide a `--sha256` comment in `cabal.project` so that Nix knows the hash of the content.
104+
### How to add a `source-repository-package`
105+
106+
As an example, we show how [constrained-generators](https://github.com/input-output-hk/constrained-generators.git) was added (pinned at commit `45559e07fe1651ddd257f2a1215dfd65e30a963f`).
107+
108+
1. Add the repository as an input to `flake.nix`:
109+
110+
```nix
111+
constrained-generators = {
112+
url = "github:input-output-hk/constrained-generators";
113+
flake = false;
114+
};
115+
```
116+
117+
2. Add an entry to `inputMap` in `flake.nix`:
118+
119+
```nix
120+
inputMap = {
121+
...
122+
"https://github.com/input-output-hk/constrained-generators.git" = inputs.constrained-generators;
123+
...
124+
};
125+
```
126+
127+
3. Add an SRP entry to `cabal.project`:
128+
129+
```
130+
source-repository-package
131+
type: git
132+
location: https://github.com/input-output-hk/constrained-generators.git
133+
tag: 45559e07fe1651ddd257f2a1215dfd65e30a963f
134+
```
135+
136+
4. Update the nix flake:
137+
138+
```
139+
nix flake update constrained-generators --override-input constrained-generators github:input-output-hk/constrained-generators/45559e07fe1651ddd257f2a1215dfd65e30a963f
140+
```
105141
106142
## Warnings
107143

cabal.project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ source-repository-package
2121
source-repository-package
2222
type: git
2323
location: https://github.com/input-output-hk/constrained-generators.git
24-
--sha256: sha256-HjRCWK+3uTZBPLkpxr7oDlZe2W5kf/5s32XzXPdi6Go=
2524
tag: 45559e07fe1651ddd257f2a1215dfd65e30a963f
2625

2726
-- NOTE: If you would like to update the above,

flake.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535

3636
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
3737

38+
constrained-generators = {
39+
url = "github:input-output-hk/constrained-generators";
40+
flake = false;
41+
};
42+
3843
formal-ledger-specifications = {
3944
url = "github:IntersectMBO/formal-ledger-specifications";
4045
flake = false;
@@ -87,6 +92,7 @@
8792
inputMap = {
8893
"https://chap.intersectmbo.org/" = inputs.CHaP;
8994
"https://github.com/IntersectMBO/formal-ledger-specifications.git" = inputs.formal-ledger-specifications;
95+
"https://github.com/input-output-hk/constrained-generators.git" = inputs.constrained-generators;
9096
};
9197
cabalProjectLocal = ''
9298
repository cardano-haskell-packages-local

0 commit comments

Comments
 (0)