15 Oct 2025 |
David Lee | hmm as best I can tell it's that NIX_PATH is explicitly set by the runner script
sudo env NIX_PATH="${nix_path}" nixos-rebuild "$cmd" --no-reexec "$@" | 01:22:36 |
Charles | to prevent a mistake like
let
source = { foo = 5; };
input = source': { foo = source.foo + 1 };
in
...
i guess
| 01:22:48 |
raitobezarius | this example can be transformed into | 01:23:11 |
raitobezarius | let
input = source: let source' = { foo = 5; } in { foo = source'.foo + 1; };
in
| 01:23:30 |
raitobezarius | * let
input = source: let source' = { foo = 5; } in { foo = source'.foo + 1; };
in
| 01:23:33 |
raitobezarius | even with your restriction mechanism, you are not out of the woods here | 01:23:44 |
raitobezarius | it definitely feels like you want the expression defining input to be mostly trivial | 01:24:08 |
QuadRadical (Ping) | by the way, raitobezarius, did you ever take a look at my freeze? | 01:24:11 |
QuadRadical (Ping) | with the nextest? | 01:24:18 |
raitobezarius | not yet, sorry | 01:24:23 |
Charles | i don't think this is what i want? | 01:24:28 |
raitobezarius | please ping me tomorrow 4pm CEST again | 01:24:31 |
QuadRadical (Ping) | ah okay, no worries | 01:24:32 |
QuadRadical (Ping) | sounds good | 01:24:38 |
raitobezarius | i'm just saying you can always inline your example into this | 01:24:38 |
Charles | to be clear the mistake is referring to source instead of source' in the body of input | 01:24:58 |
raitobezarius | ah i see | 01:25:16 |
Charles | if source weren't nameable in the context of input then it's not possible to make this mistake | 01:25:37 |
raitobezarius | but why would it be source' | 01:25:38 |
raitobezarius | and not source ? | 01:25:40 |
raitobezarius | if it's source , shadowing takes over | 01:25:46 |
Charles | that just sweeps the problem under the rug rather than actually preventing it | 01:26:10 |
raitobezarius | feels like that restricting the scope to prevent this mistake goes quite far into curbing the possibilities you have with the nixlang for a user | 01:26:29 |
raitobezarius | is it worth the tradeoff? | 01:26:39 |
Charles | maybe instead of source' they call it s to make naming it shorter and then forget they did that | 01:26:49 |
raitobezarius | shouldn't be this problem fixed by linting? | 01:27:31 |
raitobezarius | define a convention that no let binding named source should appear | 01:27:40 |
raitobezarius | we could have a weird lang construct where we would have input = source': {{ foo = source.foo + 1; }} | 01:28:21 |
Charles | does it? scope restriction would be optional; seems like it gives you strictly more control over what your code can/can't do | 01:28:22 |
raitobezarius | where {{ means no inheritance | 01:28:25 |