Published on
Building dhall files with the results in VC has been wonderful
Not only because it saves build time but also you can see exactly what happened
Also because you can truly refactor fearlessly
The DHH post about farming CI out to dev computers
Unisonlang stores the fact that tests passed and probably build artefacts
CI takes ages but people have already built stuff
Developers should be aware of the code they are actually running
We should be able to sign build artefacts and test results etc (these should be the same thing actually) with the source code.
Things like “renaming functions shouldn’t affect the code” should be visible in the git diff.
If someone builds something, nobody should ever have to build that again. Unison kind of does this but requires wacky tooling. Git is fine.
BUILDING OFFLINE SHOULD ALWAYS BE POSSIBLE AAAA
IF you want to dive to a lower level language, that should be totally possible by just integrating into the lower level of the build system.
If my new langauge generates zig code, you can see how your code changes affect the compiled output. You can also just write some zig code to use it.
For that matter, it could be that a higher-level language performs more complex checks along the way. A high level functional language (like a dependently typed language) should generate a lower-level functional language (like simply typed lambda calculus) which should be human readable. The final zig code should also be human readable and link back to the original source.
But I don’t only want to generate zig code. The language should be interpretable with many types of output.
A primary use case is command line functions (e.g. like JQ). In that case, stdin should be parsed into some format (specific to the tool being used, e.g. json) then passed into the expression for evaluation and then output. This process should not involve compiling to another language, and cannot in fact because dependent typing requires compile-time evalutation. But the general pattern should be possible.
Perhaps the first step is a build system that can sign build artefacts against all build inputs. This can be used for compiled source code from my language, but also for times when my language has been used to process something else (e.g. this json transformer).
Make would suffice except that it doesn’t guarantee that artefacts were built from their inputs.
Is there scope for a tool that can sign any output from its inputs? Or a make extension that does this? Or some other build tool?
What is needed for this?
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.