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

Back out "Don't run preSwitchChecks during install" #475

Merged
merged 1 commit into from
Feb 27, 2025

Conversation

Enzime
Copy link
Member

@Enzime Enzime commented Feb 27, 2025

This backs out commit be2d9d7.

This backs out of #447

Now that nix-community/srvos#591 (comment) is fixed upstream, I think it would be preferable to run the pre-switch checks before installing to match the default behaviour of nixos-install and I usually think of nixos-install as nixos-rebuild switch with a few extra steps like installing a bootloader.

@Enzime Enzime requested review from Mic92 and phaer February 27, 2025 07:18
@Enzime
Copy link
Member Author

Enzime commented Feb 27, 2025

In the original PR adding the pre-switch checks, it explicitly mentions they are meant to run during installation (prior to the installation of the bootloader) NixOS/nixpkgs#236375

Copy link
Member

@phaer phaer left a comment

Choose a reason for hiding this comment

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

The specific srvos check you are linking to was fixed before #447 was merged here.

As written there: we don't switch from one system to another during install, because in the case where it's an empty disk, there's just no system to speak of before the switch.
And if you use it because the original system is too broken to do a nixos-rebuild inside, preSwitchChecks most probably won't neither pass nor help.

So I'd like to see a more practical argument than just a mental model (which isn't entirely correct imo) before a possible revert?

I mean, I don't care too much either way, I just think it's much more practical this way, but we could always make it optional if needed.

@phaer
Copy link
Member

phaer commented Feb 27, 2025

it explicitly mentions they are meant to run during installation (prior to the installation of the bootloader)

The PR description says

Add an option for shell script fragments that are ran before switching to a new NixOS system configuration (pre installation of bootloader or system activation).

Which I parse as "during switch to new system, but before bootloader is installed". It does not say anything explicitly about the installation of new systems.

@Enzime
Copy link
Member Author

Enzime commented Feb 27, 2025

@Mic92 was there a specific issue you ran into recently that made you merge #447 recently?

I think that we should match upstream rather than adding an extra flag to diverge our behaviour. In my opinion, pre-switch checks should be able to handle when there's no system/state yet.

From nixos-install's source code:

Switch to the new system configuration.

https://github.com/NixOS/nixpkgs/blob/82e9fc276ac051cc6221d0d1a35368ca5746492d/pkgs/by-name/ni/nixos-install/nixos-install.sh#L239

@Mic92
Copy link
Member

Mic92 commented Feb 27, 2025

I had no particular issue. It was more about the fact that many probably don't test installation very often for their preSwitch checks.

@Mic92 Mic92 added this pull request to the merge queue Feb 27, 2025
Merged via the queue into main with commit 85bed16 Feb 27, 2025
3 checks passed
@Mic92 Mic92 deleted the run-pre-switch-checks branch February 27, 2025 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants