|
54 | 54 | # Submodules ------------------------------------------------------------------------------------- |
55 | 55 | # Option values and descriptions of Brewfile entries are sourced/derived from: |
56 | 56 | # * `brew` manpage: https://docs.brew.sh/Manpage |
57 | | - # * `brew bundle` source files (at https://github.com/Homebrew/homebrew-bundle/tree/9fffe077f1a5a722ed5bd26a87ed622e8cb64e0c): |
58 | | - # * lib/bundle/dsl.rb |
59 | | - # * lib/bundle/{brew,cask,tap}_installer.rb |
60 | | - # * spec/bundle/{brew,cask,tap}_installer_spec.rb |
| 57 | + # * `brew bundle` source files (at https://github.com/Homebrew/brew/tree/master/Library/Homebrew/bundle): |
| 58 | + # * dsl.rb |
| 59 | + # * {brew,cask,tap}_installer.rb |
| 60 | + # * ../test/bundle/{brew,cask,tap}_installer_spec.rb |
61 | 61 |
|
62 | 62 | onActivationOptions = { config, ... }: { |
63 | 63 | options = { |
|
234 | 234 | options = { |
235 | 235 | name = mkOption { |
236 | 236 | type = types.str; |
237 | | - example = "homebrew/cask-fonts"; |
| 237 | + example = "apple/apple"; |
238 | 238 | description = '' |
239 | 239 | When {option}`clone_target` is unspecified, this is the name of a formula |
240 | 240 | repository to tap from GitHub using HTTPS. For example, `"user/repo"` |
|
502 | 502 | [](#opt-homebrew.caskArgs) for the available options. |
503 | 503 | ''; |
504 | 504 | }; |
505 | | - greedy = mkNullOrBoolOption { |
| 505 | + greedy = mkOption { |
| 506 | + type = types.nullOr types.bool; |
| 507 | + default = cfg.greedyCasks; |
506 | 508 | description = '' |
507 | 509 | Whether to always upgrade this cask regardless of whether it's unversioned or it updates |
508 | 510 | itself. |
|
605 | 607 | type = with types; listOf (coercedTo str (name: { inherit name; }) (submodule tapOptions)); |
606 | 608 | default = [ ]; |
607 | 609 | example = literalExpression '' |
608 | | - # Adapted examples from https://github.com/Homebrew/homebrew-bundle#usage |
| 610 | + # Adapted from https://docs.brew.sh/Brew-Bundle-and-Brewfile |
609 | 611 | [ |
610 | 612 | # `brew tap` |
611 | | - "homebrew/cask" |
| 613 | + "apple/apple" |
612 | 614 |
|
613 | 615 | # `brew tap` with custom Git URL and arguments |
614 | 616 | { |
|
642 | 644 | ''; |
643 | 645 | }; |
644 | 646 |
|
| 647 | + greedyCasks = mkNullOrBoolOption { |
| 648 | + description = '' |
| 649 | + Whether to always upgrade casks listed in [](#opt-homebrew.casks) regardless |
| 650 | + of whether it's unversioned or it updates itself. |
| 651 | + ''; |
| 652 | + }; |
| 653 | + |
645 | 654 | brews = mkOption { |
646 | 655 | type = with types; listOf (coercedTo str (name: { inherit name; }) (submodule brewOptions)); |
647 | 656 | default = [ ]; |
648 | 657 | example = literalExpression '' |
649 | | - # Adapted examples from https://github.com/Homebrew/homebrew-bundle#usage |
| 658 | + # Adapted from https://docs.brew.sh/Brew-Bundle-and-Brewfile |
650 | 659 | [ |
651 | 660 | # `brew install` |
652 | 661 | "imagemagick" |
|
680 | 689 | type = with types; listOf (coercedTo str (name: { inherit name; }) (submodule caskOptions)); |
681 | 690 | default = [ ]; |
682 | 691 | example = literalExpression '' |
683 | | - # Adapted examples from https://github.com/Homebrew/homebrew-bundle#usage |
| 692 | + # Adapted from https://docs.brew.sh/Brew-Bundle-and-Brewfile |
684 | 693 | [ |
685 | 694 | # `brew install --cask` |
686 | 695 | "google-chrome" |
|
802 | 811 | if [ -f "${cfg.brewPrefix}/brew" ]; then |
803 | 812 | PATH="${cfg.brewPrefix}:${lib.makeBinPath [ pkgs.mas ]}:$PATH" \ |
804 | 813 | sudo \ |
| 814 | + --preserve-env=PATH \ |
805 | 815 | --user=${escapeShellArg cfg.user} \ |
806 | 816 | --set-home \ |
| 817 | + env \ |
807 | 818 | ${cfg.onActivation.brewBundleCmd} |
808 | 819 | else |
809 | 820 | echo -e "\e[1;31merror: Homebrew is not installed, skipping...\e[0m" >&2 |
|
0 commit comments