Skip to content

Commit 59132b4

Browse files
authored
Fix examples to use remote imports (#142)
Fixes #140
1 parent c0586bc commit 59132b4

File tree

5 files changed

+79
-11
lines changed

5 files changed

+79
-11
lines changed

1.17/README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ In the following example, we:
5353
-- examples/deploymentSimple.dhall
5454

5555
let kubernetes =
56-
../package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
56+
https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
5757

5858
let deployment =
5959
kubernetes.Deployment::{
@@ -148,7 +148,7 @@ let Prelude =
148148
let map = Prelude.List.map
149149

150150
let kubernetes =
151-
../package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
151+
https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
152152

153153
let Service = { name : Text, host : Text, version : Text }
154154

@@ -306,6 +306,41 @@ in
306306

307307
## Development
308308

309+
### Updating the `dhall-openapi` dependency
310+
311+
The `dhall-openapi` dependency is a subproject of the `dhall-haskell`
312+
repository, so in order to upgrade `dhall-openapi` you need to update the
313+
reference to the `dhall-haskell` repository.
314+
315+
To upgrade to the latest version of the `dhall-openapi` package, run:
316+
317+
```bash
318+
nix-prefetch-git --fetch-submodules https://github.com/dhall-lang/dhall-haskell.git > ./nix/dhall-haskell.json
319+
```
320+
321+
If you want to build against a local copy of `dhall-haskell`, then edit the
322+
Nix code like this:
323+
324+
```diff
325+
diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix
326+
index 832ae1a..810e966 100644
327+
--- a/nix/nixpkgs.nix
328+
+++ b/nix/nixpkgs.nix
329+
@@ -126,11 +126,7 @@ let
330+
json =
331+
builtins.fromJSON (builtins.readFile ./dhall-haskell.json);
332+
333+
- dhall-haskell = pkgsNew.fetchFromGitHub {
334+
- owner = "dhall-lang";
335+
- repo = "dhall-haskell";
336+
- inherit (json) rev sha256 fetchSubmodules;
337+
- };
338+
+ dhall-haskell = ~/path/to/dhall-haskell;
339+
340+
in
341+
(import "${dhall-haskell}/default.nix").dhall-openapi;
342+
```
343+
309344
### Adding a new Kubernetes releases
310345

311346
To add a new supported release, run:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ In the following example, we:
5353
-- examples/deploymentSimple.dhall
5454

5555
let kubernetes =
56-
../package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
56+
https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
5757

5858
let deployment =
5959
kubernetes.Deployment::{
@@ -148,7 +148,7 @@ let Prelude =
148148
let map = Prelude.List.map
149149

150150
let kubernetes =
151-
../package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
151+
https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
152152

153153
let Service = { name : Text, host : Text, version : Text }
154154

docs/README.md.dhall

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,41 @@ in
154154

155155
## Development
156156

157+
### Updating the `dhall-openapi` dependency
158+
159+
The `dhall-openapi` dependency is a subproject of the `dhall-haskell`
160+
repository, so in order to upgrade `dhall-openapi` you need to update the
161+
reference to the `dhall-haskell` repository.
162+
163+
To upgrade to the latest version of the `dhall-openapi` package, run:
164+
165+
```bash
166+
nix-prefetch-git --fetch-submodules https://github.com/dhall-lang/dhall-haskell.git > ./nix/dhall-haskell.json
167+
```
168+
169+
If you want to build against a local copy of `dhall-haskell`, then edit the
170+
Nix code like this:
171+
172+
```diff
173+
diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix
174+
index 832ae1a..810e966 100644
175+
--- a/nix/nixpkgs.nix
176+
+++ b/nix/nixpkgs.nix
177+
@@ -126,11 +126,7 @@ let
178+
json =
179+
builtins.fromJSON (builtins.readFile ./dhall-haskell.json);
180+
181+
- dhall-haskell = pkgsNew.fetchFromGitHub {
182+
- owner = "dhall-lang";
183+
- repo = "dhall-haskell";
184+
- inherit (json) rev sha256 fetchSubmodules;
185+
- };
186+
+ dhall-haskell = ~/path/to/dhall-haskell;
187+
188+
in
189+
(import "''${dhall-haskell}/default.nix").dhall-openapi;
190+
```
191+
157192
### Adding a new Kubernetes releases
158193

159194
To add a new supported release, run:

nix/dhall-haskell.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
22
"url": "https://github.com/dhall-lang/dhall-haskell.git",
3-
"rev": "05b12223f8d14055494d4c0cafc5db6807282c40",
4-
"date": "2020-08-09T16:27:04+00:00",
5-
"sha256": "0hgw2fq8n9v24pj3z6c28adwdmxffq5rxal12xk0vb7fvad46z42",
6-
"fetchSubmodules": true,
7-
"deepClone": false,
8-
"leaveDotGit": false
3+
"rev": "186cad7c7caf2d15c37bb5dcdac557535c648cc4",
4+
"date": "2020-08-26T02:27:04+00:00",
5+
"sha256": "0l5zr6di3k7934ayqd4rv3z8sjy55h2klvnqrd6k7adfk8ycnd97",
6+
"fetchSubmodules": true
97
}

nix/nixpkgs.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ let
108108
in
109109
pkgsNew.lib.optionalString (version == preferredVersion)
110110
''echo './${inputFile} → ./${outputFile}'
111-
${pkgsNew.dhall}/bin/dhall text --file $out/${inputFile} > $out/${outputFile}
111+
${pkgsNew.dhall}/bin/dhall text --file $out/${inputFile} | ${pkgsNew.gnused}/bin/sed 's_\.\./package.dhall_https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall_g' > $out/${outputFile}
112112
''
113113
}
114114
'';

0 commit comments

Comments
 (0)