-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos-install
cannot install nixos-test-driver
package with fileset src
#334098
Comments
This is a great report, thank you! I briefly looked into it, but I'm pretty much as clueless 😅 However, this very much reminds me of NixOS/nix#9852, which could be related |
I think I came a lot closer to the root cause. Here's what I observed by placing
So it appears that the second nix store that is given by To me this feels like a bug in Unfortunatelly I currently don't see a proper workaround for this problem, particularly none that might be implemented within the fileset library to make things like |
Given NixOS/nix#11503 (comment) it looks like a bug in Nix indeed, so I think we can close the issue at hand. Thanks to @infinisil for agonizing over this! |
@Yarny0 Thank you for the detailed report! |
Describe the bug
There is apparently something strange happening when a package that is using
src = lib.fileset
is built during anixos-install
invocation. The symptom is thatsrc
ends up as an empty directory (failing the build), but I can't see why.Steps To Reproduce
Clone
nixpkgs
, checkout currentnixos-unstable
(I used this commit for my tests).Apply the following patch
This should modify the
installer.simple
vm test such the installed system also contains thenixos-test-driver-1.1
package. The additionalextraDependencies
are needed to build the test driver package inside the vm without network access.Run
nix build -f ${NIXPKGS_CHECKOUT_PATH} nixosTests.installer.simple
.The test fails:
vm-test-run-installer-simple> installer # ERROR Source /build/source does not appear to be a Python project: no pyproject.toml or setup.py
Revert the commit b3ad661 while keeping the patch above.
Run
nix build -f ${NIXPKGS_CHECKOUT_PATH} nixosTests.installer.simple
again.The test succeeds, it will also install
nixos-test-driver-1.1
as anextraDependency
on the target system as expected.Expected behavior
The patched test should succeed in all circumstances, i.e., even with b3ad661 applied.
Additional context
This behaviour stumps me -- I investigated as far as my imagination allowed me to do, but I can't see any root cause for what is happening here.
Here are some additional observations:
The direct cause of the build failure is that the
src
is effectively empty. (I discovered that after investigating the failing derivation withnix derivation show
and looking into the derivation inputs.)Internally,
nixos-install
callswhich attempts to build the broken package. This also fails if called by hand. If one removes the
--store
and--extra-substituters
arguments, hence callsthe build succeeds. So it seems nix interprets the
src
of the problematic derivation differently, depending on those arguments.I recall that if the symlink
/mnt/nix/var/nix/profiles/per-user/root/channels
is removed and replaced with a directory with the same content (I did this withrsync -lr channels-1-link/ channels/
), thennixos-install
succeeds. This suggests that symlink handling is contributing to the problem. However, I'm unable to reproduce it.I encountered this because I have a vm test that installs a machine and includes the test drivers in order to pull in its dependencies. The driver itself isn't strictly needed, so I already found a workaround to pull in those dependencies by other means. Yet I'm reporting my observations here as I suspect this problem might come up again in other circumstances where it might be even more suprising and possibly harder to work around.
Notify maintainers
Notifying fileset author @infinisil .
Sorry! I see it entirely possible that this behaviour is caused by something else (maybe even a bug in nix iteself), and the fileset mechanism is just uncovering it. Yet you might better understand the difference in what filesets are doing compared to a simple
./.
, and I don't know anyone else to ping.Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: