Mic92 / nixpkgs-review

Review pull-requests on https://github.com/NixOS/nixpkgs
MIT License
356 stars 59 forks source link

How to build multiple outputs #306

Closed davidak closed 1 year ago

davidak commented 1 year ago

I reviewed a multiple output package (https://github.com/NixOS/nixpkgs/pull/215728), but in results/ i see only the bin output.

[nix-shell:~/.cache/nixpkgs-review/pr-215728]$ tree results/
results/
└── geogram -> /nix/store/j64i56kvgg5wp5m1snhxwmm9wcbg2zm1-geogram-1.8.2-bin

How can i access the other? (lib)

I tried to specify it similar to nix-build, but it does not work.

https://nixos.org/manual/nix/stable/command-ref/nix-build.html#examples

[davidak@gaming:~/code/nixpkgs]$ nixpkgs-review pr -p geogram.lib 215728
$ git -c fetch.prune=false fetch --no-tags --force https://github.com/NixOS/nixpkgs master:refs/nixpkgs-review/0 pull/215728/head:refs/nixpkgs-review/1
$ git worktree add /home/davidak/.cache/nixpkgs-review/pr-215728-2/nixpkgs 0621648513a20d6e6a3be974f396c0cebc1cb48d
Preparing worktree (detached HEAD 0621648513a)
Updating files: 100% (33608/33608), done.
HEAD is now at 0621648513a Merge pull request #216123 from Detegr/c64-debugger
$ git merge --no-commit --no-ff 9edb082b5a3cbd3d914038f1ddc890038e6e3543
Auto-merging pkgs/top-level/all-packages.nix
Automatic merge went well; stopped before committing as requested
The following packages specified with `-p` are not rebuilt by the pull request
geogram.lib
$ git worktree prune
[davidak@gaming:~/code/nixpkgs]$ nixpkgs-review pr -p geogram.all 215728
$ git -c fetch.prune=false fetch --no-tags --force https://github.com/NixOS/nixpkgs master:refs/nixpkgs-review/0 pull/215728/head:refs/nixpkgs-review/1
$ git worktree add /home/davidak/.cache/nixpkgs-review/pr-215728-3/nixpkgs 0621648513a20d6e6a3be974f396c0cebc1cb48d
Preparing worktree (detached HEAD 0621648513a)
Updating files: 100% (33608/33608), done.
HEAD is now at 0621648513a Merge pull request #216123 from Detegr/c64-debugger
$ git merge --no-commit --no-ff 9edb082b5a3cbd3d914038f1ddc890038e6e3543
Auto-merging pkgs/top-level/all-packages.nix
Automatic merge went well; stopped before committing as requested
error: cannot coerce a list to a string

       at /nix/store/0zipgmy333i0x71xgriaa5ajz11waf1s-nixpkgs-review-2.7.0/lib/python3.10/site-packages/nixpkgs_review/nix/evalAttrs.nix:16:27:

           15|       else
           16|         builtins.tryEval "${pkg}";
             |                           ^
           17|   in rec {
nix --experimental-features nix-command --system x86_64-linux eval --json --impure --expr (import /nix/store/0zipgmy333i0x71xgriaa5ajz11waf1s-nixpkgs-review-2.7.0/lib/python3.10/site-packages/nixpkgs_review/nix/evalAttrs.nix { allowAliases = false; attr-json = /tmp/tmp6k5ncsg3; }) failed to run, /tmp/tmp6k5ncsg3 was stored inspection
https://github.com/NixOS/nixpkgs/pull/215728 failed to build
$ git worktree prune

Workaround

Build PR as usual:

[davidak@gaming:~/code/nixpkgs]$ nixpkgs-review pr 215728

Then use nix-build:

[nix-shell:~/.cache/nixpkgs-review/pr-215728-4]$ nix-build nixpkgs/ -A geogram.all
/nix/store/j64i56kvgg5wp5m1snhxwmm9wcbg2zm1-geogram-1.8.2-bin
/nix/store/299za097p633g4w1ig63g8k5zcf86nk6-geogram-1.8.2-lib
/nix/store/cr6wlvc22gj072r0fw0j52kbmqmpr6my-geogram-1.8.2-dev
/nix/store/jd1ys0jn7sp9bw647ch8ydp5ic3l09g6-geogram-1.8.2

I would expect nixpkgs-review to build all outputs in this way.

figsoda commented 1 year ago

Looks like nixpkgs-review does build all the outputs, but doesn't symlink all of them. The current symlink logic only symlinks one path per attribute, and the path is determined by the default output here: https://github.com/Mic92/nixpkgs-review/blob/ecfc53e2a18b72defb412cbd7c3ec8f61a06ccdb/nixpkgs_review/nix/evalAttrs.nix#L16

figsoda commented 1 year ago

Can you see if #307 fixes the issue?