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

nixos/screen: fix assertion to actually execute, by moving it outside of mkIf. #312210

Merged
merged 1 commit into from
May 20, 2024

Conversation

tomfitzhenry
Copy link
Contributor

@tomfitzhenry tomfitzhenry commented May 16, 2024

Fixes #312194.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • 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/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 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
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@tomfitzhenry tomfitzhenry requested a review from h7x4 May 16, 2024 13:40
@tomfitzhenry tomfitzhenry changed the title nixos/screen: fix assertion to actually execute nixos/screen: fix assertion to actually execute, noting confusing mkIf semantics May 16, 2024
@tomfitzhenry
Copy link
Contributor Author

I see this question came up during the PR review that introduced the assertion: https://github.com/NixOS/nixpkgs/pull/262133/files/f12eabdcbe642884b37cb5d20dbf781f998061f7#r1415492863

@tomfitzhenry
Copy link
Contributor Author

#312187 (comment) has a better suggested alternative. I'll do that.

@SuperSandro2000
Copy link
Member

#312187 (comment) has a better suggested alternative. I'll do that.

No, that is worse. Using throw will abort the evaluation completely and not collect all assertions.

nixos/modules/programs/screen.nix Outdated Show resolved Hide resolved
nixos/modules/programs/screen.nix Outdated Show resolved Hide resolved
nixos/modules/programs/screen.nix Outdated Show resolved Hide resolved
See NixOS#312194 (comment) for explanation why the assertion currently fails to run.
@tomfitzhenry tomfitzhenry changed the title nixos/screen: fix assertion to actually execute, noting confusing mkIf semantics nixos/screen: fix assertion to actually execute, by moving it outside of mkIf. May 17, 2024
@tomfitzhenry tomfitzhenry marked this pull request as ready for review May 17, 2024 22:04
@tomfitzhenry
Copy link
Contributor Author

@SuperSandro2000 thoughts on this being merged before the 24.05 cut?

  • Con: It's technically a breaking change: any users with programs.screen.screenrc set and programs.screen.enable unset will see a failure
  • Pro: It's helpful in fixing broken config.
  • Pro: The assertion's purpose is to help NixOS 24.05 users.

@tomfitzhenry
Copy link
Contributor Author

@Mic92 @wegank , thoughts re #312210 (comment) ?

@SuperSandro2000
Copy link
Member

The code was before broken and didn't do what we expected it to do and we silently ignored peoples configs unlike what is written in the release notes.

@tomfitzhenry tomfitzhenry merged commit 05b0c49 into NixOS:master May 20, 2024
25 of 26 checks passed
@Atemu
Copy link
Member

Atemu commented May 22, 2024

I just got hit by this assertion, why does it need to exist?

Per convention, module settings are always guarded behind the enable option's value. We usually don't assert this.

@tomfitzhenry
Copy link
Contributor Author

I just got hit by this assertion, why does it need to exist?

#262133 introduced this assertion, and has the rationale/commentary. This PR just fixed the assertion to actually work.

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.

programs.screen's assertion doesn't run, possibly due to confusing semantics around mkIf?
4 participants