Skip to content

[Backport release-21.11] nixos-rebuild: do not resolve flake path#153935

Merged
thiagokokada merged 2 commits intorelease-21.11from
backport-153515-to-release-21.11
Jan 14, 2022
Merged

[Backport release-21.11] nixos-rebuild: do not resolve flake path#153935
thiagokokada merged 2 commits intorelease-21.11from
backport-153515-to-release-21.11

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Jan 8, 2022

Bot-based backport to release-21.11, triggered by a label in #153515.

  • Before merging, ensure that this backport complies with the Criteria for Backporting.
    • Even as a non-commiter, if you find that it does not comply, leave a comment.

The removed lines converted the flake path passed by the command line
from `/some/path` to `git+file:///some/path`.

This technically shouldn't cause any issues, however running
`nixos-rebuild switch` inside a directory `/nix/store` will cause the
switch to fail and leave a partially construct generation (see issue #144811
for details).

By itself this shouldn't be too much of an issue, however thanks to
another issue in `systemd-boot-builder.py` this can leave the system
in a broken state for those using `boot.loader.systemd-boot` (AFAIK the
default), where future `nixos-rebuild switch` will fail
(see issue #93694 for details).

The issue can be fixed by running
`nix-env -p /nix/var/nix/profiles/system --delete-generations old`,
however this makes newbies very confused and it is showing in our
support threads in Matrix and Discourse (see
https://discourse.nixos.org/t/need-help-on-failure-of-building-my-configuration/16842).

Keep in mind this is a workaround. The actual issue seems to be in nix
itself (see: NixOS/nix#5510).

See also #150065 for an alternative fix that caused other issues.

Kudos for @figsoda for figuring out this fix.

(cherry picked from commit c274d04)
Was only used in the code removed in commit
c274d04.

(cherry picked from commit c75bc3a)
@thiagokokada
Copy link
Copy Markdown
Contributor

Please wait some weeks before merging to make sure this doesn't introduce any regressions.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jan 8, 2022
@thiagokokada
Copy link
Copy Markdown
Contributor

Since there seems to be reports of issues on master, I think merging this right now is fine.

@thiagokokada thiagokokada merged commit 3ddd960 into release-21.11 Jan 14, 2022
@thiagokokada thiagokokada deleted the backport-153515-to-release-21.11 branch January 14, 2022 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant