Fix examples to use remote imports (#142)

Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/140
This commit is contained in:
Gabriel Gonzalez 2020-08-28 07:44:06 -07:00 committed by GitHub
parent c0586bcce5
commit 59132b47b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 79 additions and 11 deletions

View File

@ -53,7 +53,7 @@ In the following example, we:
-- examples/deploymentSimple.dhall -- examples/deploymentSimple.dhall
let kubernetes = let kubernetes =
../package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1 https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
let deployment = let deployment =
kubernetes.Deployment::{ kubernetes.Deployment::{
@ -148,7 +148,7 @@ let Prelude =
let map = Prelude.List.map let map = Prelude.List.map
let kubernetes = let kubernetes =
../package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1 https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
let Service = { name : Text, host : Text, version : Text } let Service = { name : Text, host : Text, version : Text }
@ -306,6 +306,41 @@ in
## Development ## Development
### Updating the `dhall-openapi` dependency
The `dhall-openapi` dependency is a subproject of the `dhall-haskell`
repository, so in order to upgrade `dhall-openapi` you need to update the
reference to the `dhall-haskell` repository.
To upgrade to the latest version of the `dhall-openapi` package, run:
```bash
nix-prefetch-git --fetch-submodules https://github.com/dhall-lang/dhall-haskell.git > ./nix/dhall-haskell.json
```
If you want to build against a local copy of `dhall-haskell`, then edit the
Nix code like this:
```diff
diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix
index 832ae1a..810e966 100644
--- a/nix/nixpkgs.nix
+++ b/nix/nixpkgs.nix
@@ -126,11 +126,7 @@ let
json =
builtins.fromJSON (builtins.readFile ./dhall-haskell.json);
- dhall-haskell = pkgsNew.fetchFromGitHub {
- owner = "dhall-lang";
- repo = "dhall-haskell";
- inherit (json) rev sha256 fetchSubmodules;
- };
+ dhall-haskell = ~/path/to/dhall-haskell;
in
(import "${dhall-haskell}/default.nix").dhall-openapi;
```
### Adding a new Kubernetes releases ### Adding a new Kubernetes releases
To add a new supported release, run: To add a new supported release, run:

View File

@ -53,7 +53,7 @@ In the following example, we:
-- examples/deploymentSimple.dhall -- examples/deploymentSimple.dhall
let kubernetes = let kubernetes =
../package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1 https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
let deployment = let deployment =
kubernetes.Deployment::{ kubernetes.Deployment::{
@ -148,7 +148,7 @@ let Prelude =
let map = Prelude.List.map let map = Prelude.List.map
let kubernetes = let kubernetes =
../package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1 https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1
let Service = { name : Text, host : Text, version : Text } let Service = { name : Text, host : Text, version : Text }

View File

@ -154,6 +154,41 @@ in
## Development ## Development
### Updating the `dhall-openapi` dependency
The `dhall-openapi` dependency is a subproject of the `dhall-haskell`
repository, so in order to upgrade `dhall-openapi` you need to update the
reference to the `dhall-haskell` repository.
To upgrade to the latest version of the `dhall-openapi` package, run:
```bash
nix-prefetch-git --fetch-submodules https://github.com/dhall-lang/dhall-haskell.git > ./nix/dhall-haskell.json
```
If you want to build against a local copy of `dhall-haskell`, then edit the
Nix code like this:
```diff
diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix
index 832ae1a..810e966 100644
--- a/nix/nixpkgs.nix
+++ b/nix/nixpkgs.nix
@@ -126,11 +126,7 @@ let
json =
builtins.fromJSON (builtins.readFile ./dhall-haskell.json);
- dhall-haskell = pkgsNew.fetchFromGitHub {
- owner = "dhall-lang";
- repo = "dhall-haskell";
- inherit (json) rev sha256 fetchSubmodules;
- };
+ dhall-haskell = ~/path/to/dhall-haskell;
in
(import "''${dhall-haskell}/default.nix").dhall-openapi;
```
### Adding a new Kubernetes releases ### Adding a new Kubernetes releases
To add a new supported release, run: To add a new supported release, run:

View File

@ -1,9 +1,7 @@
{ {
"url": "https://github.com/dhall-lang/dhall-haskell.git", "url": "https://github.com/dhall-lang/dhall-haskell.git",
"rev": "05b12223f8d14055494d4c0cafc5db6807282c40", "rev": "186cad7c7caf2d15c37bb5dcdac557535c648cc4",
"date": "2020-08-09T16:27:04+00:00", "date": "2020-08-26T02:27:04+00:00",
"sha256": "0hgw2fq8n9v24pj3z6c28adwdmxffq5rxal12xk0vb7fvad46z42", "sha256": "0l5zr6di3k7934ayqd4rv3z8sjy55h2klvnqrd6k7adfk8ycnd97",
"fetchSubmodules": true, "fetchSubmodules": true
"deepClone": false,
"leaveDotGit": false
} }

View File

@ -108,7 +108,7 @@ let
in in
pkgsNew.lib.optionalString (version == preferredVersion) pkgsNew.lib.optionalString (version == preferredVersion)
''echo './${inputFile} ./${outputFile}' ''echo './${inputFile} ./${outputFile}'
${pkgsNew.dhall}/bin/dhall text --file $out/${inputFile} > $out/${outputFile} ${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}
'' ''
} }
''; '';