[Haskell-cafe] [ANN] nix-freeze-tree-0.1.0.0 - Freeze a tree using fixed-output derivations

Jack Kelly jack at jackkelly.name
Sat Jan 25 04:39:05 UTC 2020


I have just pushed an initial release of nix-freeze-tree[1] to Hackage.

`nix-freeze-tree` is a utility that walks a directory tree, and writes
out Nix expressions which rebuild that tree. The generated expressions
have two important properties:

1. Each file in the tree is built by a separate fixed-output
   derivation, and

2. Directories are built by derivations that symlink their contents
   recursively.

If you are using `nix copy` to ship a derivation between nix stores,
copying the derivation built by evaluating the output of
`nix-freeze-tree` can reuse existing files in the destination store,
as fixed-output derivations can be checked against a hash before
copying.

I use this to speed up deploys to my personal website. Running
`nix-freeze-tree` on the output from my site generator and importing the
result means that `nix copy` only uploads new files, instead of copying
a single giant derivation containing every image on the site.

The code is on Sourcehut[2]; bug reports[3] and patches[4] are
welcome. The repository also has a Nix helper function for running the
tool on your own derivations.

Best,

-- Jack

[1]: https://hackage.haskell.org/package/nix-freeze-tree-0.1.0.0
[2]: https://git.sr.ht/~jack/nix-freeze-tree/
[3]: https://todo.sr.ht/~jack/nix-freeze-tree
[4]: https://lists.sr.ht/~jack/nix-freeze-tree-discuss


More information about the Haskell-Cafe mailing list