2 Mar 2024 |
| Qyriad joined the room. | 19:34:40 |
3 Mar 2024 |
Philip Taron (UTC-8) | stdenv folks, Qyriad concocted a PR which really helps make the stdenv hooks more self-documenting. I've reviewed it, and while more eyes would definitely be better, having built my NixOS system with it, I think it's good to go.
What's needed in order to get it either further reviewed or merged?
| 23:00:03 |
4 Mar 2024 |
Puna | In reply to @trofi:matrix.org Let's start from a tiny https://github.com/NixOS/nixpkgs/pull/288250 thanks! adding the entry to the file now, so the original PR can go back to referring to Hydra build results and use your script for requesting an upload: https://github.com/NixOS/nixpkgs/pull/293257 | 14:07:46 |
9 Mar 2024 |
Philip Taron (UTC-8) | Qyriad: did you see a-n-n-a-l-e-e 's comment on your merged PR? | 01:47:16 |
Qyriad | I did just now | 01:49:09 |
Qyriad | That is correct behavior for how the change was designed — it outputs just as part of the build log, just like phase headers do | 01:50:03 |
Qyriad | nix-shell -p doing that is kind of an artifact of the cursed way nix-shell is implemented — personally I would argue this is a good thing, and makes it more transparent that nix-shell is a derivation that relies on hooks to make it work | 01:51:32 |
Qyriad | though I suppose it is a lot of output for a common operation | 01:51:42 |
@a-n-n-a-l-e-e:matrix.org | Redacted or Malformed Event | 01:54:08 |
@a-n-n-a-l-e-e:matrix.org | $ nix-shell -I nixpkgs=. -p bash --run "exit"|wc -l
104
104 lines of output from the new logging.
| 01:55:16 |
@a-n-n-a-l-e-e:matrix.org | (when bash already built) | 01:55:55 |
@a-n-n-a-l-e-e:matrix.org | i thought i needed to add --print-build-logs but perhaps that is when using the experimental commands. | 02:01:00 |
@a-n-n-a-l-e-e:matrix.org | #! /usr/bin/env nix-shell
#! nix-shell -I nixpkgs=. -i bash -p bash
when nix-shell used as interpreter has same issue and the output is sent to stdout, which seems bad.
| 02:05:16 |
Qyriad | Ah right the nix- commands have print-build-logs by default, hm | 02:11:03 |
Qyriad | Well, I could leverage the Nix log FD that's already in stdenv, and make it log based on the loglevel setting Nix itself is called with — that would make it so getting the logs vs not wouldn't change the derivation | 02:12:00 |
@a-n-n-a-l-e-e:matrix.org | i think logging to stdout needs a fix or a revert as that will break pipelines that use nix-shell as an interpreter. i verified older nixpkgs log build output to stderr when below commands are run for the first time.
$ cat foo.sh
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p "(hello.overrideAttrs { postBuild = \"#0\"; })"
hello
$ ./foo.sh 2>/dev/null
Hello, world!
but outputs all the hook logging when run with nixpkgs with the hooks change.
| 02:39:02 |
@a-n-n-a-l-e-e:matrix.org | (i do like the hook logging in general -- seems like a good change) | 02:44:23 |
Qyriad | nods, just need to figure out the nix-shell thing | 03:18:30 |
Qyriad | As a stopgap I can throw if [[ -n "${IN_NIX_SHELL:-}" ]] guards on the logs | 04:38:43 |
Qyriad | As a stopgap I can throw if [[ -n "${IN_NIX_SHELL:-}" ]]; then return guards on the logs | 04:38:56 |
Qyriad | which seems to work | 04:39:06 |
Qyriad | though it would also make impure builds from within a nix-shell not log hooks | 04:39:51 |
Artturin | In reply to @qyriad:katesiria.org As a stopgap I can throw if [[ -n "${IN_NIX_SHELL:-}" ]]; then return guards on the logs nix develop doesn't set that iirc | 05:22:41 |
Artturin | * nix shell doesn't set that iirc | 05:22:59 |
Qyriad | nix develop is a different case though | 05:23:05 |
Qyriad | nix-shell -p foo is one of the canonical ways for "just give me these packages for a sec"; nix develop is explicitly a dev command | 05:23:30 |
Artturin | Yeah I edited | 05:23:31 |