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

feat: system tools can be configured individually #1331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

isabelroses
Copy link
Contributor

With the merging of #1313, it makes it easier to port the tools module from nixpkgs, https://github.com/NixOS/nixpkgs/blob/3fd6fcf0a896c789573955df6e674e7dad64da67/nixos/modules/installer/tools/tools.nix#L234 which is a almost exact copy.

Copy link
Collaborator

@emilazy emilazy left a comment

Choose a reason for hiding this comment

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

Seems reasonable in principle, but some nits with the implementation.

inherit (nix-tools) darwin-option darwin-rebuild darwin-version;
mkToolModule = { name, package ? nix-tools.${name} }: { config, ... }: {
options.system.tools.${name}.enable = lib.mkEnableOption "${name} script" // {
default = config.nix.enable && ! config.system.disableInstallerTools;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that most users with nix.enable = false; will be using an unmanaged system Nix rather than deploying a configuration with no Nix installation at all (since that’s kinda hard on macOS). So we probably want this to be on by default even if !config.nix.enable. I don’t have a super principled justification for this divergence from NixOS, but I think it’s okay to expect people to manually disable system.disableInstallerTools if they want them gone.

(mkToolModule { name = "darwin-option"; })
(mkToolModule { name = "darwin-rebuild"; })
(mkToolModule { name = "darwin-version"; })
(mkToolModule { name = "darwin-uninstaller"; package = darwin-uninstaller; })
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should move darwin-uninstaller to nix-tools. cc @Enzime

Comment on lines +31 to +33
Disable installer tools, such as darwin-rebuild and darwin-option. This
is useful to shrink systems which are not expected to rebuild or
reconfigure themselves. Use at your own risk!
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like “installer tools” is a bit of a weird term here when we don’t even have nixos-install. But the option name is already what it is, so eh…

Comment on lines 11 to 12
system.tools.darwin-uninstaller.enable = false;
system.tools.darwin-rebuild.enable = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The uninstaller only uses darwin-rebuild activate, which is kinda disjoint from the vast majority of other darwin-rebuild behaviour. I’m hoping to encourage third‐party deployment tools to use it more, so its removal breaking our own installer feels a bit awkward. This would be fixed by removing the config.nix.enable condition, though.

In an ideal world we’d have an apply script like has been worked on for NixOS but we don’t currently. Maybe the uninstaller should just invoke the activation scripts directly for now, and then we could disable installer tools in its configuration.nix.

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.

2 participants