From 59132b47b7c796eeeca576cb7ca6b96077b56be6 Mon Sep 17 00:00:00 2001 From: Gabriel Gonzalez Date: Fri, 28 Aug 2020 07:44:06 -0700 Subject: [PATCH] Fix examples to use remote imports (#142) Fixes https://github.com/dhall-lang/dhall-kubernetes/issues/140 --- 1.17/README.md | 39 +++++++++++++++++++++++++++++++++++++-- README.md | 4 ++-- docs/README.md.dhall | 35 +++++++++++++++++++++++++++++++++++ nix/dhall-haskell.json | 10 ++++------ nix/nixpkgs.nix | 2 +- 5 files changed, 79 insertions(+), 11 deletions(-) diff --git a/1.17/README.md b/1.17/README.md index bb7942ef..0b848fbf 100644 --- a/1.17/README.md +++ b/1.17/README.md @@ -53,7 +53,7 @@ In the following example, we: -- examples/deploymentSimple.dhall let kubernetes = - ../package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1 + https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1 let deployment = kubernetes.Deployment::{ @@ -148,7 +148,7 @@ let Prelude = let map = Prelude.List.map 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 } @@ -306,6 +306,41 @@ in ## 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 To add a new supported release, run: diff --git a/README.md b/README.md index ce3ee0d4..0b848fbf 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ In the following example, we: -- examples/deploymentSimple.dhall let kubernetes = - ../package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1 + https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1 let deployment = kubernetes.Deployment::{ @@ -148,7 +148,7 @@ let Prelude = let map = Prelude.List.map 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 } diff --git a/docs/README.md.dhall b/docs/README.md.dhall index b8a11e8a..d3688e21 100644 --- a/docs/README.md.dhall +++ b/docs/README.md.dhall @@ -154,6 +154,41 @@ in ## 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 To add a new supported release, run: diff --git a/nix/dhall-haskell.json b/nix/dhall-haskell.json index e4b94919..95ed6ad1 100644 --- a/nix/dhall-haskell.json +++ b/nix/dhall-haskell.json @@ -1,9 +1,7 @@ { "url": "https://github.com/dhall-lang/dhall-haskell.git", - "rev": "05b12223f8d14055494d4c0cafc5db6807282c40", - "date": "2020-08-09T16:27:04+00:00", - "sha256": "0hgw2fq8n9v24pj3z6c28adwdmxffq5rxal12xk0vb7fvad46z42", - "fetchSubmodules": true, - "deepClone": false, - "leaveDotGit": false + "rev": "186cad7c7caf2d15c37bb5dcdac557535c648cc4", + "date": "2020-08-26T02:27:04+00:00", + "sha256": "0l5zr6di3k7934ayqd4rv3z8sjy55h2klvnqrd6k7adfk8ycnd97", + "fetchSubmodules": true } diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix index 832ae1a2..e254bb1a 100644 --- a/nix/nixpkgs.nix +++ b/nix/nixpkgs.nix @@ -108,7 +108,7 @@ let in pkgsNew.lib.optionalString (version == preferredVersion) ''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} '' } '';