←back to thread

Nix Derivation Madness

(fzakaria.com)
184 points birdculture | 8 comments | | HN request time: 0s | source | bottom
1. beardsciences ◴[] No.45772979[source]
If I understand this correctly, upcoming Ca-derivations will fix this by making these situations expected, properly-handled cases rather than a weird bug? https://nixos.wiki/wiki/Ca-derivations
replies(3): >>45773374 #>>45773430 #>>45773561 #
2. setheron ◴[] No.45773374[source]
ca-derivations from what i understand, fixed-output derivations but more general.

The point of the article to me (author) was that i found it odd that Nix replaces the derivations when calculating the output path but not the derivation path. (talking about "paths" in Nix is so hard!)

replies(1): >>45773691 #
3. Ericson2314 ◴[] No.45773430[source]
Yes, a hope of mine is that we can stop using "hash derivation modulo" entirely.

I've recently started some fancy formal spec-level documentation here https://github.com/NixOS/nix/pull/14408 The "resolution" equivalence class is both simpler and better than the "hash derivation modulo ..." one.

(The fact that it is a mouthful to say what the derivations are modulo kinda gives the game away! I put "hash quotient derivation" in the docs to side-step the issue.)

4. edolstra ◴[] No.45773561[source]
To be clear, there is no bug here: derivers are simply not uniquely determined in the presence of fixed-output derivations, which is by design. That's even more true with CA derivations.

CA derivations also introduce the opposite situation, namely that the same derivation can produce different output paths for different users (if the build is not bitwise reproducible).

replies(1): >>45773589 #
5. setheron ◴[] No.45773589[source]
pick your poison: 1:N or N:1 ;P
replies(1): >>45774695 #
6. beardsciences ◴[] No.45773691[source]
That makes sense, thanks for clarifying. Great writeup.
7. Ericson2314 ◴[] No.45774695{3}[source]
It's both, multiple derivations can produce the same (content-addressed) store object, and the derivations may not be reproducible and produce different (content-addressed) store objects each time.

The reality of executing arbitrary programs on non-deterministic computers is, unfortunately, N:M!

(Cue deterministic WASM derivations or something.)

replies(1): >>45777729 #
8. huem0n ◴[] No.45777729{4}[source]
> (Cue deterministic WASM derivations)

"Rah Rah, this is why we need deterministic wasm derivations!" - Me

(There you go Ericson) Relevant links: https://github.com/WebAssembly/design/blob/main/Nondetermini...