!djTaTBQyWEPRQxrPTb:nixos.org

Nixpkgs Architecture Team

227 Members
https://github.com/nixpkgs-architecture, weekly public meetings on Wednesday 15:00-16:00 UTC at https://meet.jit.si/nixpkgs-architecture53 Servers

Load older messages


SenderMessageTime
29 Jul 2022
@infinisil:matrix.orginfinisilAh true16:24:16
@infinisil:matrix.orginfinisil 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:matrix.orginfinisil(I think that's what you're thinking of right, using it as a replacement for bash?)16:26:31
@qyliss:fairydust.spaceAlyssa RossYes, it would work quite well as a bash replacement16:26:54
@qyliss:fairydust.spaceAlyssa RossThe main thing execline has going for it, from a derivation point of view, is that execline is designed around argv, and so is `derivation16:27:25
@qyliss:fairydust.spaceAlyssa RossSo there is no need to construct big script strings16:27:39
@qyliss:fairydust.spaceAlyssa RossInstead Nix can pass an array directly to the kernel16:27:46
@qyliss:fairydust.spaceAlyssa RossOther 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:matrix.orginfinisil 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
@qyliss:fairydust.spaceAlyssa RossWhile still being fundamentally focused around running commands, in contrast to something like Python where that's not first class.16:28:54
@qyliss:fairydust.spaceAlyssa Rossinfinisil: well why would you use execlineb when what you want in the end is an array? 16:29:12
@infinisil:matrix.orginfinisilI 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 imo16:29:58
@qyliss:fairydust.spaceAlyssa RossIn 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
@qyliss:fairydust.spaceAlyssa RossThe 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:matrix.orginfinisil

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
@qyliss:fairydust.spaceAlyssa RossIf 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
@qyliss:fairydust.spaceAlyssa RossI don't think many people would enjoy directly writing execline 16:31:56
@qyliss:fairydust.spaceAlyssa Rossbut it would allow us to work with much higher level primitives in a way that the shell does not really lend itself to16:32:13
@infinisil:matrix.orginfinisil
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:matrix.orginfinisilSo we'd kind of be writing execline in Nix with a very straight-forward conversion16:33:13
@qyliss:fairydust.spaceAlyssa 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:matrix.orginfinisilYeah, that sounds very interesting16:33:34
@qyliss:fairydust.spaceAlyssa RossBut you could do way better, way higher level than that.16:33:35
@qyliss:fairydust.spaceAlyssa RossI think it would let us get closer to Guix in terms of expressiveness of build actions.16:33:49
@infinisil:matrix.orginfinisilI am a bit worried about evaluation time suffering from this16:36:31
@infinisil:matrix.orginfinisilIt might not be that bad, since execline is just some array appending16:37:01
@qyliss:fairydust.spaceAlyssa RossYeah i'd be surprised if it did tbh.16:38:11
@profpatsch:augsburg.oneprofpatschokay, but how about: chez scheme17:11:21
@profpatsch:augsburg.oneprofpatsch(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:0upti.meK900Guix time?17:12:16

There are no newer messages yet.


Back to Room ListRoom Version: 9