Skip to content

Comments

Make --read-only a separate mixin#7755

Merged
thufschmitt merged 1 commit intoNixOS:masterfrom
obsidiansystems:mix-read-only-mode
Feb 21, 2023
Merged

Make --read-only a separate mixin#7755
thufschmitt merged 1 commit intoNixOS:masterfrom
obsidiansystems:mix-read-only-mode

Conversation

@Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Feb 5, 2023

Motivation

This functionality was part of SourceExprCommand. However, it is actually independent parsing installables or source expressions, except for the fact that parsing installables is one of the many things influenced by read-only mode.

We can make it a mixin instead, which separates concerns.

Context

Cleaning things up so NixOS/rfcs#134 is easy to implement. We will be surgically separating InstallableCommand from SourceExprCommand as part of that, and making those simpler first helps make that task less difficult.

Depends on #7754

Checklist for maintainers

Maintainers: tick if completed or explain if not relevant

  • agreed on idea
  • agreed on implementation strategy
  • tests, as appropriate
    • functional tests - tests/**.sh
    • unit tests - src/*/tests
    • integration tests - tests/nixos/*
  • documentation in the manual
  • code and comments are self-explanatory
  • commit message explains why the change was made
  • new feature or bug fix: updated release notes

@Ericson2314 Ericson2314 marked this pull request as draft February 5, 2023 01:50
@Ericson2314 Ericson2314 mentioned this pull request Feb 20, 2023
10 tasks
It is independent of SourceExprCommand, which is about parsing
installables, except for the fact that parsing installables is one of
the many things influenced by read-only mode.
@Ericson2314 Ericson2314 marked this pull request as ready for review February 20, 2023 15:44
@Ericson2314
Copy link
Member Author

This is similar in spirit to #7754, which also split out a flag to a mixin.

Copy link
Contributor

@tomberek tomberek left a comment

Choose a reason for hiding this comment

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

I'm not clear on whether the defaults are changing for read-only. Is InstallableCommand changing to have a default value to true now?

@thufschmitt
Copy link
Member

I'm not clear on whether the defaults are changing for read-only. Is InstallableCommand changing to have a default value to true now?

Nah, it shouldn't. The source of truth is settings.readOnlyMode which is false by default

@thufschmitt thufschmitt merged commit c7885ab into NixOS:master Feb 21, 2023
@Ericson2314 Ericson2314 deleted the mix-read-only-mode branch February 21, 2023 15:41
@Ericson2314
Copy link
Member Author

Thanks @thufschmitt for beating me to the reply :)

@tomberek I should have made clearer in the PR description that supportReadOnlyMode just controls whether the flag exists, and doesn't influence the default value of settings.readOnlyMode in any way.

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