Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Beady Belle Fanchannel
Beady Belle Fanchannel
@Profpatsch@mastodon.xyz  ·  activity timestamp 12 hours ago

I realized why I always thought `placeholder` was a weird primitive in the nix language: It breaks referential transparency!

#nixos #nix

> cat example.nix
with import <nixpkgs> {};
let
  inner = txt: writeText "inner" txt;

in runCommand "outer" {} ''
  (echo -n "placeholder result: "; cat ${inner (placeholder "out")}) \
  > $out
<End of example.nix>
> cat (nix-build example.nix)
placeholder result: /nix/store/bnns37m7b4kiyqskxnfzka2jsj9byf9y-inner⏎
> cat example.nix with import <nixpkgs> {}; let inner = txt: writeText "inner" txt; in runCommand "outer" {} '' (echo -n "placeholder result: "; cat ${inner (placeholder "out")}) \ > $out <End of example.nix> > cat (nix-build example.nix) placeholder result: /nix/store/bnns37m7b4kiyqskxnfzka2jsj9byf9y-inner⏎
> cat example.nix with import <nixpkgs> {}; let inner = txt: writeText "inner" txt; in runCommand "outer" {} '' (echo -n "placeholder result: "; cat ${inner (placeholder "out")}) \ > $out <End of example.nix> > cat (nix-build example.nix) placeholder result: /nix/store/bnns37m7b4kiyqskxnfzka2jsj9byf9y-inner⏎
1
  • Copy link
  • Flag this post
  • Block
Anselm "Two Sheds" Schüler
Anselm "Two Sheds" Schüler
@anselmschueler@ieji.de replied  ·  activity timestamp 12 hours ago

@Profpatsch What is this function? I can't find it in nixpkgs docs.

1
  • Copy link
  • Flag this comment
  • Block
Anselm "Two Sheds" Schüler
Anselm "Two Sheds" Schüler
@anselmschueler@ieji.de replied  ·  activity timestamp 12 hours ago

@Profpatsch I see, it's a builtin

  • Copy link
  • Flag this comment
  • Block

Kakapo Social

Kakapo Social: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.1-beta.22 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct