Skip to content
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

Revert "lib/trivial: fix 'error: cannot decode virtual path '/nix/sto… #202370

Merged
merged 1 commit into from
Nov 22, 2022

Conversation

Artturin
Copy link
Member

…re/virtual0000000000000000000000005-source''"

This reverts commit b67ee6e.

#202244

error: a string that refers to a store path cannot be appended to a path, at /etc/nixos/nix/nixos-unstable/lib/sources.nix:193:30

appears to happen when there's a nixpkgs git submodule

So one of the things that is different for a git submodule is that the .git folder isn't a folder, it's a textfile that contains (in my case) this:

$ cat nix/nixos-unstable/.git
gitdir: ../../.git/modules/nixpkgs

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

…re/virtual0000000000000000000000005-source''"

This reverts commit b67ee6e.

NixOS#202244

error: a string that refers to a store path cannot be appended to a path, at /etc/nixos/nix/nixos-unstable/lib/sources.nix:193:30

appears to happen when there's a nixpkgs git submodule

> So one of the things that is different for a git submodule is that the .git folder isn't a folder, it's a textfile that contains (in my case) this:

> $ cat nix/nixos-unstable/.git
> gitdir: ../../.git/modules/nixpkgs
Copy link
Contributor

@amaxine amaxine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My system builds again, thanks.

@edolstra
Copy link
Member

The use of toString <path> is undesirable for performance reasons (it causes an unneeded copy of Nixpkgs to the Nix store) and will cause problems once NixOS/nix#6530 is merged. I'm not sure whether the use of nixpkgs as a submodule should count as a blocker - is that a use case that we actually support?

@Artturin
Copy link
Member Author

Artturin commented Nov 22, 2022

The use of toString <path> is undesirable for performance reasons (it causes an unneeded copy of Nixpkgs to the Nix store) and will cause problems once NixOS/nix#6530 is merged.

yep can't use a path nixpkgs input in a flake without getting error: cannot decode virtual path '/nix/store/virtual0000000000000000000000005-source' after reverting this commit
inputs.nixpkgs.url = "path:/home/artturin/nixgits/my-nixpkgs";

I'm not sure whether the use of nixpkgs as a submodule should count as a blocker -
is that a use case that we actually support?

it's common with niv i think
this might happen with non-nixpkgs submodules too

i opted to revert it for now because NixOS/nix#6530 is a nix PR while some peoples working systems can't rebuild now

@amaxine
Copy link
Contributor

amaxine commented Nov 22, 2022

@edolstra I wouldn't advocate for blocking such a change on the basis of my or anyone else's use, but when I started using nix this was (at least in my eyes and based on friends' recommendations) common enough that I opted to follow the idea. If this behaviour is unintentional, I think it still warrants a deprecation notice and a planned removal - e.g. by 23.05 - rather than just dropping it overnight because it wasn't meant to be supported in the first place.

I don't follow nix development closely enough to have known that this is an intentional change before now, and I don't recall seeing any mention of this in release notes either - so to me, this comes out of nowhere and breaks my systems with no prior warning.

Copy link
Contributor

@etu etu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay, now it can unblock my updates of the unstable channel 🙂

And I agree with @maxeaubrey, maybe this could be based on state version or something?

Otherwise, if this change should be pushed for all of a sudden. It should at least be documented in the release notes that this is an intended change.

@etu
Copy link
Contributor

etu commented Nov 22, 2022

I'm not sure whether the use of nixpkgs as a submodule should count as a blocker - is that a use case that we actually support?

Well, it's a use case that has been working fine for many years. So there's certainly people that uses it. Which means that it should at least be deprecated in some form of graceful way.

@github-actions
Copy link
Contributor

Successfully created backport PR #202375 for release-22.11.

@talyz
Copy link
Contributor

talyz commented Nov 22, 2022

I'm not sure whether the use of nixpkgs as a submodule should count as a blocker - is that a use case that we actually support?

The code that broke was there specifically to support fetching the nixpkgs git revision from a submodule, so yes, it has certainly been a supported use case.

The use of toString <path> is undesirable for performance reasons (it causes an unneeded copy of Nixpkgs to the Nix store)

In this case, it seems toString was used to get the real path to .git and avoid copying the whole repo to the nix store.

@talyz
Copy link
Contributor

talyz commented Nov 22, 2022

Here is an alternative solution that could work with NixOS/nix#6530. It does however make a useless copy of the .git directory to the store.

@Artturin
Copy link
Member Author

Here is an alternative solution that could work with NixOS/nix#6530. It does however make a useless copy of the .git directory to the store.

you forgot to link/paste the code

@talyz
Copy link
Contributor

talyz commented Nov 22, 2022

Oops! Here's the link: talyz@1e659be

@infinisil infinisil mentioned this pull request Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants