| 29 Jul 2022 |
infinisil | Ah true | 16:24:16 |
infinisil | Alyssa Ross: Can you briefly mention why execline would be good as a replacement for bash in nixpkgs? What are the benefits? | 16:25:58 |
infinisil | (I think that's what you're thinking of right, using it as a replacement for bash?) | 16:26:31 |
Alyssa Ross | Yes, it would work quite well as a bash replacement | 16:26:54 |
Alyssa Ross | The main thing execline has going for it, from a derivation point of view, is that execline is designed around argv, and so is `derivation | 16:27:25 |
Alyssa Ross | So there is no need to construct big script strings | 16:27:39 |
Alyssa Ross | Instead Nix can pass an array directly to the kernel | 16:27:46 |
Alyssa Ross | Other things going for execline are that it is very small, composes much better than shell, and does not have confusing quoting rules that lead to paths not working if they contain special characters, etc. | 16:28:35 |
infinisil | What is the problem with big script strings though? And wouldn't it also be reasonable to use execlineb, so that there's a script string again? | 16:28:42 |
Alyssa Ross | While still being fundamentally focused around running commands, in contrast to something like Python where that's not first class. | 16:28:54 |
Alyssa Ross | infinisil: well why would you use execlineb when what you want in the end is an array? | 16:29:12 |
infinisil | I guess the same reason why execlineb is used at all, for convenience. It's easier to see what's going on with a stringy script than an array of strings imo | 16:29:58 |
Alyssa Ross | In my mind that would defeat the purpose, and if we're going to stick with a single big string we should adopt Oil. | 16:30:30 |
Alyssa Ross | The reason not needing a big script string is good, is that it allows you to easily compose scripts, and implement higher level helpers. | 16:31:07 |
infinisil | Looking at puck's POC, it does seem pretty hard to read due to all the "'s, e.g.
cleanup = [
"cd" "${builtins.placeholder "out"}"
"foreground" [
"find" "-type" "f" "-name" "*.la" "-delete"
]
"find" "-type" "f" "-exec"
"define" "package" "{}"
"backtick" "-E" "dirname" [ "dirname" "$package" ]
"if" [ "mkdir" "-p" "${builtins.placeholder "debuginfo"}/\${dirname}" ]
"foreground" [
"foreground" [ "${patchelf}/patchelf" "--shrink-rpath" "--allowed-rpath-prefixes" "/nix" "$package" ]
"if" [ "${sys.c-compiler.host.prefix}objcopy" "--only-keep-debug" "$package" "${builtins.placeholder "debuginfo"}/\${package}" ]
"${sys.c-compiler.host.prefix}strip" "--strip-debug" "$package"
]
";"
| 16:31:37 |
Alyssa Ross | If we were to use execline in Nixpkgs, the way I'd imagine it working is that we have lots of high level Nix functions that return argv arrays, that can be composed. | 16:31:41 |
Alyssa Ross | I don't think many people would enjoy directly writing execline | 16:31:56 |
Alyssa Ross | but it would allow us to work with much higher level primitives in a way that the shell does not really lend itself to | 16:32:13 |
infinisil | In reply to @qyliss:fairydust.space If we were to use execline in Nixpkgs, the way I'd imagine it working is that we have lots of high level Nix functions that return argv arrays, that can be composed. Ahh I see 🤔 | 16:32:23 |
infinisil | So we'd kind of be writing execline in Nix with a very straight-forward conversion | 16:33:13 |
Alyssa Ross | A very simple, and not very high level example, is that you could replace "foreground" [ ... ] with a foreground Nix function. | 16:33:19 |
infinisil | Yeah, that sounds very interesting | 16:33:34 |
Alyssa Ross | But you could do way better, way higher level than that. | 16:33:35 |
Alyssa Ross | I think it would let us get closer to Guix in terms of expressiveness of build actions. | 16:33:49 |
infinisil | I am a bit worried about evaluation time suffering from this | 16:36:31 |
infinisil | It might not be that bad, since execline is just some array appending | 16:37:01 |
Alyssa Ross | Yeah i'd be surprised if it did tbh. | 16:38:11 |
profpatsch | okay, but how about: chez scheme | 17:11:21 |
profpatsch | (haven’t thought through this a lot, but it’s also just nested lists and could probably make for a nice DSL, plus it should be fairly easy to bootstrap) | 17:12:01 |
K900 | Guix time? | 17:12:16 |