no description only meoww

posts from @leftpaddotpy tagged #nix

also:

iliana
@iliana

i think my main takeaway from Nix/Nixpkgs/NixOS is that the more you learn about it and the ecosystem around it, the faster you oscillate between "this is cool" and "lol this sucks". you never stop oscillating between these two absolutes.


leftpaddotpy
@leftpaddotpy

nix rules because you can fix her

nix fucking sucks because you can fix her and nobody else did it yet



fullmoon
@fullmoon

so today I learned from @mzero that Nix has a completely undocumented builtins.exec function that lets you run an arbitrary shell command at evaluation time. The two restrictions are:

  • you have to enable the allow-unsafe-native-code-during-evaluation nix.conf option

  • the standard output of the shell command must produce a valid Nix expression

    … which builtins.exec will parse and return as its output

Here's an example of using it:

$ nix eval \
    --option allow-unsafe-native-code-during-evaluation true \
    --expr 'builtins.exec [ "echo" "x: x" ] 2'
2
syntax highlighting by codehost

Truly cursed. You can even run Nix commands at evaluation time using this trick.


leftpaddotpy
@leftpaddotpy

there's actually a way worse feature mentioned in the iceberg itself: importNative. that's right, dlopen from nix language code.