dhall-nix-lib/dhallToNix.nix

15 lines
405 B
Nix

{ pkgs ? import <nixpkgs> {} }: code:
let
codeString = builtins.toString code;
file = if builtins.isPath code then code else builtins.toFile "dhall-expr" codeString;
drv = pkgs.stdenvNoCC.mkDerivation {
name = "dhall-expr-as-nix";
src = ./.;
buildCommand = ''
cd $src
dhall-to-nix < ${file} > $out
'';
nativeBuildInputs = [ pkgs.dhall-nix ];
};
in import "${drv}"