Skip to content

Commit

Permalink
ret-cont-recursive-nix: Improve syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericson2314 committed Feb 10, 2019
1 parent ffb9203 commit c6b6ef9
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions rfcs/0000-ret-cont-recursive-nix.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ stdenv.mkDerivation {
The other main reason is other build systems should be translated to Nix without vendoring tons of autogenerated code in Nixpkgs.
For this, case, the one difference is we need to generate some Nix first.
```nix
installPhase = ''
bazel2nix # new bit
for o in $outputs; do
pkg=$(nix-build -E '((import <nixpkgs> {}).callPackage ./. {}).'"$o")
cp -r $pkg ${!o}
done
'';
stdenv.mkDerivation {
...
installPhase = ''
bazel2nix # new bit
for o in $outputs; do
pkg=$(nix-build -E '((import <nixpkgs> {}).callPackage ./. {}).'"$o")
cp -r $pkg ${!o}
done
'';
}
```

"Ret-cont" recursive Nix, short for "return-continuation" recursive Nix, is a different take on recursive Nix.
Expand Down Expand Up @@ -106,10 +109,13 @@ Sandboxing and Darwin are crucial to Nix today, and we shouldn't sacrifice eithe
With "ret-cont" recursive Nix, actual builds are never nested, so we don't need any fancy constraints on the derivation "runtime" (i.e. the code that actually performs and isolates builds).
Furthermore, we can skip needing to talk to the daemon by just producing a local store:
```nix
outputs = [ "drv" "store" ];
installPhase = ''
mv $(nix-instantiate --store $store -E '((import <nixpkgs> {}).callPackage ./. {}).'"$o") $drv
'';
stdenv.mkDerivation {
...
outputs = [ "drv" "store" ];
installPhase = ''
mv $(nix-instantiate --store $store -E '((import <nixpkgs> {}).callPackage ./. {}).'"$o") $drv
'';
}
```
This further simplifies the implementation.
Derivations remain built exactly as today, with only logic *between* building steps that is entirely platform-agnostic changing.
Expand Down

0 comments on commit c6b6ef9

Please sign in to comment.