From 102a09dc16f8443c9f72c01407434bb0836a75f0 Mon Sep 17 00:00:00 2001 From: Malo Bourgon Date: Thu, 10 Dec 2020 11:06:34 -0800 Subject: Add brew-bundle.noAutoUpdate with true as default --- modules/programs/brew-bundle.nix | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'modules/programs') diff --git a/modules/programs/brew-bundle.nix b/modules/programs/brew-bundle.nix index 33e07b3..c5939d5 100644 --- a/modules/programs/brew-bundle.nix +++ b/modules/programs/brew-bundle.nix @@ -28,8 +28,10 @@ let (if cfg.extraConfig != "" then "# Extra config\n" + cfg.extraConfig else "") ); - brew-bunble-options = - "--file='${brewfile}' --no-lock" + + brew-bundle-command = + "HOMEBREW_NO_AUTO_UPDATE=" + + (if cfg.noAutoUpdate then "1" else "0") + + " brew bundle --file='${brewfile}' --no-lock" + (if cfg.cleanupType == "uninstall" || cfg.cleanupType == "zap" then " --cleanup" else "") + (if cfg.cleanupType == "zap" then " --zap" else ""); @@ -45,8 +47,19 @@ in installation instructions: https://brew.sh ''; + noAutoUpdate = mkOption { + type = types.bool; + default = true; + example = false; + description = '' + Sets the HOMEBREW_NO_AUTO_UPDATE environment variable when running the + brew bundle command. The default is true so that + repeated invocations of darwin-rebuild switch are idempotent. + ''; + }; + cleanupType = mkOption { - type = with types; enum [ "none" "uninstall" "zap" ]; + type = types.enum [ "none" "uninstall" "zap" ]; default = "none"; example = "uninstall"; description = '' @@ -205,8 +218,7 @@ in system.activationScripts.brew-bundle.text = mkIf cfg.enable '' # Homebrew Bundle echo >&2 "Homebrew bundle..." - PATH=/usr/local/bin:$PATH brew update > /dev/null - PATH=/usr/local/bin:$PATH brew bundle ${brew-bunble-options} + PATH=/usr/local/bin:$PATH ${brew-bundle-command} ''; }; -- cgit v1.2.3