From d3c44b7fec5c63b63eaa61a159043c06d19d46b5 Mon Sep 17 00:00:00 2001 From: Akira Komamura Date: Sun, 12 Dec 2021 05:18:46 +0900 Subject: [PATCH] fix!: Provide the file writer in an overlay builtins.toFile doesn't work in pure evaluation mode. It must use a function from nixpkgs, so it should be provided in an overlay. --- flake.nix | 13 ++++++++++++- nix/default.nix | 4 ---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index ce938c4..f0a27c1 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,16 @@ { description = "Nix library for extracting source blocks from Org"; - outputs = { ... }: { lib = import ./nix; }; + outputs = { ... }: + let + lib = import ./nix; + in + { + inherit lib; + overlay = _: pkgs: { + tangleOrgBabelFile = name: path: options: + pkgs.writeText name + (lib.tangleOrgBabel options (builtins.readFile path)); + }; + }; } diff --git a/nix/default.nix b/nix/default.nix index 1c61189..f9f2cb3 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -8,13 +8,9 @@ let builtins.any (t: matchOrgHeadline t s) headlines; tangleOrgBabel = import ./tangleOrgBabel.nix; - - tangleOrgBabelFile = name: path: options: - toFile name (tangleOrgBabel options (readFile path)); in { inherit matchOrgTag matchOrgHeadline matchOrgHeadlines; inherit excludeOrgSubtreesOnHeadlines; inherit tangleOrgBabel; - inherit tangleOrgBabelFile; }