modules/homebrew: deprecate homebrew.global.lockfiles
Homebrew Bundle removed lockfile support in Homebrew 4.4.0 (Oct 2024): the `--no-lock` CLI flag, the `HOMEBREW_BUNDLE_NO_LOCK` env var, and the `no_lock` parameter in `installer.rb` are all dead code. Setting `homebrew.global.lockfiles` has had no effect on current Homebrew versions. - Replace the `lockfiles` option with a hidden stub (matching `noLock`) - Replace the `noLock` hard assertion with a shared deprecation warning for both options - Stop setting `HOMEBREW_BUNDLE_NO_LOCK` in `environment.variables` - Remove the lockfiles paragraph from the `brewfile` option description
This commit is contained in:
parent
65cfcebaa2
commit
24531016d8
1 changed files with 8 additions and 39 deletions
|
|
@ -164,14 +164,6 @@ let
|
||||||
Whether to enable Homebrew to automatically use the Brewfile that this module generates in
|
Whether to enable Homebrew to automatically use the Brewfile that this module generates in
|
||||||
the Nix store, when you manually invoke {command}`brew bundle`.
|
the Nix store, when you manually invoke {command}`brew bundle`.
|
||||||
|
|
||||||
Enabling this option will change the default value of
|
|
||||||
[](#opt-homebrew.global.lockfiles) to `false` since, with
|
|
||||||
this option enabled, {command}`brew bundle [install]` will default to using the
|
|
||||||
Brewfile that this module generates in the Nix store, unless you explicitly point it at
|
|
||||||
another Brewfile using the `--file` flag. As a result, it will try to
|
|
||||||
write the lockfile in the Nix store, and complain that it can't (though the command will
|
|
||||||
run successfully regardless).
|
|
||||||
|
|
||||||
Implementation note: when enabled, this option sets the
|
Implementation note: when enabled, this option sets the
|
||||||
`HOMEBREW_BUNDLE_FILE` environment variable to the path of the Brewfile
|
`HOMEBREW_BUNDLE_FILE` environment variable to the path of the Brewfile
|
||||||
that this module generates in the Nix store, by adding it to
|
that this module generates in the Nix store, by adding it to
|
||||||
|
|
@ -200,31 +192,13 @@ let
|
||||||
[](#opt-environment.variables).
|
[](#opt-environment.variables).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
lockfiles = mkOption {
|
# `noLock` was the original option; `lockfiles` replaced it (with inverted semantics).
|
||||||
type = types.bool;
|
# Both are now dead: Homebrew Bundle removed lockfile support in Homebrew 4.4.0
|
||||||
default = !config.brewfile;
|
# (Oct 2024), so the `HOMEBREW_BUNDLE_NO_LOCK` env var and `--no-lock` CLI flag are
|
||||||
defaultText = literalExpression "!config.homebrew.global.brewfile";
|
# ignored. We keep both definitions with null defaults to detect explicit user
|
||||||
description = ''
|
# configuration and emit a warning below. We can't use `mkRemovedOptionModule` because
|
||||||
Whether to enable Homebrew to generate lockfiles when you manually invoke
|
# `homebrew.global` is a submodule.
|
||||||
{command}`brew bundle [install]`.
|
lockfiles = mkOption { visible = false; default = null; };
|
||||||
|
|
||||||
This option will default to `false` if
|
|
||||||
[](#opt-homebrew.global.brewfile) is enabled since, with that option enabled,
|
|
||||||
{command}`brew bundle [install]` will default to using the Brewfile that this
|
|
||||||
module generates in the Nix store, unless you explicitly point it at another Brewfile
|
|
||||||
using the `--file` flag. As a result, it will try to write the
|
|
||||||
lockfile in the Nix store, and complain that it can't (though the command will run
|
|
||||||
successfully regardless).
|
|
||||||
|
|
||||||
Implementation note: when disabled, this option sets the
|
|
||||||
`HOMEBREW_BUNDLE_NO_LOCK` environment variable, by adding it to
|
|
||||||
[](#opt-environment.variables).
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
# The `noLock` option was replaced by `lockfiles`. Due to `homebrew.global` being a submodule,
|
|
||||||
# we can't use `mkRemovedOptionModule`, so we leave this option definition here, and trigger
|
|
||||||
# and error message with an assertion below if it's set by the user.
|
|
||||||
noLock = mkOption { visible = false; default = null; };
|
noLock = mkOption { visible = false; default = null; };
|
||||||
|
|
||||||
homebrewEnvironmentVariables = mkInternalOption { type = types.attrs; };
|
homebrewEnvironmentVariables = mkInternalOption { type = types.attrs; };
|
||||||
|
|
@ -234,7 +208,6 @@ let
|
||||||
homebrewEnvironmentVariables = {
|
homebrewEnvironmentVariables = {
|
||||||
HOMEBREW_BUNDLE_FILE = mkIf config.brewfile "${brewfileFile}";
|
HOMEBREW_BUNDLE_FILE = mkIf config.brewfile "${brewfileFile}";
|
||||||
HOMEBREW_NO_AUTO_UPDATE = mkIf (!config.autoUpdate) "1";
|
HOMEBREW_NO_AUTO_UPDATE = mkIf (!config.autoUpdate) "1";
|
||||||
HOMEBREW_BUNDLE_NO_LOCK = mkIf (!config.lockfiles) "1";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -840,13 +813,9 @@ in
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
||||||
assertions = [
|
|
||||||
# See comment above `homebrew.global.noLock` option declaration for why this is required.
|
|
||||||
{ assertion = cfg.global.noLock == null; message = "The option `homebrew.global.noLock' was removed, use `homebrew.global.lockfiles' in it's place."; }
|
|
||||||
];
|
|
||||||
|
|
||||||
warnings = [
|
warnings = [
|
||||||
(mkIf (options.homebrew.autoUpdate.isDefined || options.homebrew.cleanup.isDefined) "The `homebrew' module no longer upgrades outdated formulae and apps by default during `nix-darwin' system activation. To enable upgrading, set `homebrew.onActivation.upgrade = true'.")
|
(mkIf (options.homebrew.autoUpdate.isDefined || options.homebrew.cleanup.isDefined) "The `homebrew' module no longer upgrades outdated formulae and apps by default during `nix-darwin' system activation. To enable upgrading, set `homebrew.onActivation.upgrade = true'.")
|
||||||
|
(mkIf (cfg.global.noLock != null || cfg.global.lockfiles != null) "The options `homebrew.global.noLock' and `homebrew.global.lockfiles' have been deprecated. Homebrew Bundle removed lockfile support in Homebrew 4.4.0 (Oct 2024), so these options no longer have any effect. Please remove them from your configuration.")
|
||||||
];
|
];
|
||||||
|
|
||||||
system.requiresPrimaryUser = mkIf (cfg.enable && options.homebrew.user.highestPrio == (mkOptionDefault {}).priority) [
|
system.requiresPrimaryUser = mkIf (cfg.enable && options.homebrew.user.highestPrio == (mkOptionDefault {}).priority) [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue