dhallToNix: Permit inputs referring to derivations (#134459)
Fixes https://github.com/dhall-lang/dhall-haskell/issues/2267 `pkgs.dhallToNix` currently fails when a Dhall package is interpolated into the input source code, like this: ```nix let pkgs = import <nixpkgs> { }; f = { buildDhallPackage }: buildDhallPackage { name = "not"; code = "λ(x : Bool) → x == False"; source = true; }; not = pkgs.dhallPackages.callPackage f {}; in pkgs.dhallToNix "${not}/source.dhall True" ``` This is because `dhallToNix` was using `builtins.toFile`, which does not permit inputs with interpolated derivations. However, `pkgs.writeText` does not have this limitation, so we can switch to using that instead.
This commit is contained in:
parent
1c145df9ae
commit
9a8850aea9
|
@ -15,12 +15,12 @@
|
|||
Note that this uses "import from derivation", meaning that Nix will perform
|
||||
a build during the evaluation phase if you use this `dhallToNix` utility
|
||||
*/
|
||||
{ stdenv, dhall-nix }:
|
||||
{ stdenv, dhall-nix, writeText }:
|
||||
|
||||
let
|
||||
dhallToNix = code :
|
||||
let
|
||||
file = builtins.toFile "dhall-expression" code;
|
||||
file = writeText "dhall-expression" code;
|
||||
|
||||
drv = stdenv.mkDerivation {
|
||||
name = "dhall-compiled.nix";
|
||||
|
|
Loading…
Reference in a new issue