Build Artefacts Should Be Version Controlled

Published on


Here’s an idea

You still have to build things in the right order, and you still have to calculate what all the inputs are for some particular process.

Apparently this is related to merkle DAGs or merkle trees. Jack says diff-o-scope. It could also use nix.


I think Jack was onto something. I was initially put off by the “it’s just Nix” idea because I want all artefacts to be visible within the development tree, but this can be remedied by building stuff and then symlinking a link farm into the dev tree. Also the nix language is not essential to nix - you can also generate drv files. I wonder if we could build haskell this way by generating a bunch of drv files from a cabal file? haskell.nix doesn’t really do this.

Here’s an idea


Here’s an idea

For this to work:

This is an ecosystem of tools. It would have to be easy to make them all work together. A flake part might be the best way. I wonder if there is already such a thing.

Not by the looks of flake.parts website.

We need a bulletproof way to manage these files:

Summarised:

What if the tool fails before it updates its tracking list?

How do we ensure the generated files aren’t considered source files for the purpose of generating files?

Given the current state of a directory, you can know what files should be there. But how do you know which to remove? We need a file to remember the state of the directory when files were generated. That file could be a complete tree listing with file hashes. It could also be a complete copy of the tree - this may be simpler since the tree will already have to be copied into nix store for this to work. So the tool just needs to know how to find the old tree in the nix store. We can store its path in a file in the tree.