maralorn / nix-output-monitor

Pipe your nix-build output through the nix-output-monitor a.k.a nom to get additional information while building.
GNU Affero General Public License v3.0
834 stars 24 forks source link

DerivationParseError around ca-derivations #122

Open SuperSandro2000 opened 10 months ago

SuperSandro2000 commented 10 months ago

I am testing ca-derivations for things that frequently rebuild but don't always change like the configuration.nix man page.

I think the usage of this is triggering the following bug in nom:

zoxide>    Compiling dirs-sys v0.4.1
zoxide>    Compiling nix v0.26.2
zoxide>    Compiling dirs v5.0.1
resolved derivation: '/nix/store/9wc9qj7bphqnch69wcgrh0vpmdil2di4-dbus-1.drv' -> '/nix/store/22wimagqzz7s6r8kp7r0s48k45wsl5n1-dbus-1.drv'
nix-output-monitor error: DerivationParseError "string"
nix-output-monitor error: DerivationParseError "string"
nix-output-monitor error: DerivationParseError "string"
dbus> building '/nix/store/22wimagqzz7s6r8kp7r0s48k45wsl5n1-dbus-1.drv'
vim-pack-dir> created 1 symlinks in user environment
neovim> building '/nix/store/0jc9acc4dxmazld415yswjzgh4533ra4-neovim-0.9.4.drv'
nix-output-monitor error: DerivationParseError "string"
zoxide>    Compiling color-print-proc-macro v0.3.4
neovim> Generating remote plugin manifest

I did another run with debug loggin through tee and captured the following message:

@nix {"action":"result","fields":[2,2,0,0],"id":732313398804584,"type":105}
@nix {"action":"stop","id":732313398804586}
@nix {"action":"stop","id":732313398804584}
@nix {"action":"stop","id":732313398804583}
@nix {"action":"result","fields":[6,23,0,0],"id":732313398804561,"type":105}
@nix {"action":"result","fields":[1,1,0,0],"id":732313398804562,"type":105}
@nix {"action":"result","fields":[101,2218468],"id":732313398804560,"type":106}
@nix {"action":"result","fields":[100,8339608],"id":732313398804560,"type":106}
@nix {"action":"stop","id":732313398804566}
@nix {"action":"start","fields":["/nix/store/nbb9jn946vpcdnf0m3s693lqv5ihlp9b-man-paths.drv","/nix/store/hzrglaszmxq29lb7lk25ppsp4l8v5xn6-man-paths.drv"],"id":732313398804587,"level":3,"pare
nt":0,"text":"resolved derivation: '/nix/store/nbb9jn946vpcdnf0m3s693lqv5ihlp9b-man-paths.drv' -> '/nix/store/hzrglaszmxq29lb7lk25ppsp4l8v5xn6-man-paths.drv'","type":111}
@nix {"action":"result","fields":[6,24,0,0],"id":732313398804561,"type":105}
@nix {"action":"result","fields":[1,1,0,0],"id":732313398804562,"type":105}
@nix {"action":"result","fields":[101,2218468],"id":732313398804560,"type":106}
@nix {"action":"result","fields":[100,8339608],"id":732313398804560,"type":106}
@nix {"action":"start","fields":["/nix/store/kadbxbdmrl3wwnakc2fgcw3yyq15hdvg-system-path.drv","/nix/store/gdb48k383jxwisvjxinvwxi0ljs2gjfr-system-path.drv"],"id":732313398804588,"level":3,"
parent":0,"text":"resolved derivation: '/nix/store/kadbxbdmrl3wwnakc2fgcw3yyq15hdvg-system-path.drv' -> '/nix/store/gdb48k383jxwisvjxinvwxi0ljs2gjfr-system-path.drv'","type":111}
@nix {"action":"result","fields":[6,25,0,0],"id":732313398804561,"type":105}
@nix {"action":"result","fields":[1,1,0,0],"id":732313398804562,"type":105}
@nix {"action":"result","fields":[101,2218468],"id":732313398804560,"type":106}
@nix {"action":"result","fields":[100,8339608],"id":732313398804560,"type":106}
@nix {"action":"start","id":732313398804589,"level":4,"parent":732313398804560,"text":"connecting to 'ssh-ng://amy.dse.in.tum.de'","type":0}
@nix {"action":"stop","id":732313398804589}
@nix {"action":"start","fields":["/nix/store/mj0d9nrc9a01p12x31c1csw6nf18xkv8-zoxide-0.9.2.drv","ssh-ng://amy.dse.in.tum.de",1,1],"id":732313398804590,"level":3,"parent":0,"text":"building '
/nix/store/mj0d9nrc9a01p12x31c1csw6nf18xkv8-zoxide-0.9.2.drv' on 'ssh-ng://amy.dse.in.tum.de'","type":105}
@nix {"action":"result","fields":[6,25,1,0],"id":732313398804561,"type":105}
@nix {"action":"result","fields":[1,1,0,0],"id":732313398804562,"type":105}
@nix {"action":"result","fields":[101,2218468],"id":732313398804560,"type":106}
@nix {"action":"result","fields":[100,8339608],"id":732313398804560,"type":106}
@nix {"action":"start","fields":["/nix/store/0mbmb6zp57xnmihfbqik0rbya1crcg2b-etc-bashrc.drv","",1,1],"id":732313398804591,"level":3,"parent":0,"text":"building '/nix/store/0mbmb6zp57xnmihfb
qik0rbya1crcg2b-etc-bashrc.drv'","type":105}
@nix {"action":"result","fields":[6,25,2,0],"id":732313398804561,"type":105}
@nix {"action":"result","fields":[1,1,0,0],"id":732313398804562,"type":105}
@nix {"action":"result","fields":[101,2218468],"id":732313398804560,"type":106}
@nix {"action":"result","fields":[100,8339608],"id":732313398804560,"type":106}
@nix {"action":"start","fields":["/nix/store/yzz60723qxnivwdv8dhq51nnz7p2hs6q-etc-zshrc.drv","",1,1],"id":732313398804592,"level":3,"parent":0,"text":"building '/nix/store/yzz60723qxnivwdv8d
hq51nnz7p2hs6q-etc-zshrc.drv'","type":105}
@nix {"action":"result","fields":[6,25,3,0],"id":732313398804561,"type":105}
@nix {"action":"result","fields":[1,1,0,0],"id":732313398804562,"type":105}
@nix {"action":"result","fields":[101,2218468],"id":732313398804560,"type":106}
@nix {"action":"result","fields":[100,8339608],"id":732313398804560,"type":106}
@nix {"action":"start","fields":["/nix/store/hzrglaszmxq29lb7lk25ppsp4l8v5xn6-man-paths.drv","",1,1],"id":732313398804593,"level":3,"parent":0,"text":"building '/nix/store/hzrglaszmxq29lb7lk
25ppsp4l8v5xn6-man-paths.drv'","type":105}
maralorn commented 10 months ago

I think this might be a bug in the nix-derivation library. I am, however, planning to drop the dependency on that library. So it is likely this bug will go away during that refactoring.

ConnorBaker commented 7 months ago

Bumping as I just ran into this -- @maralorn any ideas on how deep a refactor would be required to drop the dependency on nix-derivation? That is, do you think it's something an outside contributor could manage or would it require a lot of domain knowledge?

EDIT: Maybe it's not too bad; I made a PR which just vendors the relevant portion of the library: #127. Although, I'm not sure what the implications are of that license-wise (or if that's a direction you had in mind).

maralorn commented 7 months ago

Taking some BSD-licensed code and republishing under GPL is not an issue, I think. But I’d rather not go down this route. Either we contribute to maintaining nix-derivation (or a fork of it) or we don’t use it.

I plan to stop relying on parsing derivations at all. I plan to use the nix derivation and nix path-info commands, which have a JSON output and ideally can give us the needed information in a more useful way.

However I haven’t tried that out yet, so I am not certain that it will be an improvement. It would however make us less dependent on the derivation format to be stable.

mibmo commented 1 month ago

Any progress on this? would really like to build content-addressed derivations with nom! :)