3
0
Fork 0
forked from mirrors/nixpkgs
Commit graph

3 commits

Author SHA1 Message Date
Gabriella Gonzalez 9a8850aea9
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.
2021-08-21 19:25:01 -07:00
volth 7b8fb5c06c treewide: remove redundant quotes 2019-09-08 23:38:31 +00:00
Gabriel Gonzalez c791c0fd16 Add a pkgs.dhallToNix utility
This adds a `dhallToNix` utility which compiles expression from the Dhall
configuration language to Nix using Nix's support for "import from derivation".
The main motivation of this compiler is to allow users to carve out small typed
subsets of Nix projects.  Everything in the Dhall language (except `Double`s)
can be translated to Nix in this way, including functions.
2017-01-26 20:11:49 -08:00