diff --git a/Rakefile b/Rakefile index 9a55f9d..11403ac 100644 --- a/Rakefile +++ b/Rakefile @@ -7,11 +7,19 @@ require "rubocop/rake_task" Rake::TaskManager.record_task_metadata = true Rake.add_rakelib "lib/tasks" -desc "install EVERYTHING" +desc "install Homebrew" task :install do + require "got_files/homebrew" + + homebrew = GotFiles::Homebrew.new + homebrew.install +end + +desc "setup EVERYTHING" +task :setup do require "highline/import" - Rake.application.in_namespace(:install) do |namespace| + Rake.application.in_namespace(:setup) do |namespace| namespace.tasks.sort_by(&:name).each do |t| Rake::Task[t.name].invoke if HighLine.agree("#{t.comment.capitalize}? ") end diff --git a/files/homebrew/Brewfile b/files/homebrew/Brewfile deleted file mode 100644 index b0ba621..0000000 --- a/files/homebrew/Brewfile +++ /dev/null @@ -1,10 +0,0 @@ -tap "homebrew/bundle" -tap "homebrew/cask" -tap "homebrew/core" -brew "dockutil", link: false -brew "mas", link: false -brew "pwgen" -brew "tree" -cask "google-chrome" -cask "iterm2" -cask "slack" diff --git a/lib/got_files/homebrew.rb b/lib/got_files/homebrew.rb index bd8d7c6..68c2585 100644 --- a/lib/got_files/homebrew.rb +++ b/lib/got_files/homebrew.rb @@ -4,12 +4,6 @@ module GotFiles class Homebrew < Base - def bundle_install - Dir.chdir(File.expand_path("~")) do - system("brew bundle") - end - end - def install return if installed? @@ -19,15 +13,5 @@ def install def installed? command_exist?("brew") end - - def update_brewfile - Dir.chdir(File.expand_path("~")) do - system("brew bundle dump --force") - end - end - - def setup - install_file "files/homebrew/Brewfile", false - end end end diff --git a/lib/got_files/neovim.rb b/lib/got_files/neovim.rb index 0d0f0e6..711aeba 100644 --- a/lib/got_files/neovim.rb +++ b/lib/got_files/neovim.rb @@ -4,20 +4,10 @@ module GotFiles class Neovim < Base - def install - puts "Checking for dependencies..." - - brew_install_if_missing("cmake", "CMake") - brew_install_if_missing("go", "Golang") - brew_install_if_missing("python", "Python 3") - - brew_install_if_missing("neovim", "Neovim") - + def setup system("pip3 install --upgrade pynvim --user", out: File::NULL) system("pip3 install --upgrade neovim --user", out: File::NULL) - end - def setup system('defaults write com.googlecode.iterm2 "Draw Powerline Glyphs" -bool true') mkdir_p File.expand_path("~/.config/nvim/backup") diff --git a/lib/got_files/terminal.rb b/lib/got_files/terminal.rb index 8e5cebf..71f2a8d 100644 --- a/lib/got_files/terminal.rb +++ b/lib/got_files/terminal.rb @@ -4,17 +4,10 @@ module GotFiles class Terminal < Base - def install - brew_cask_install_if_missing("iterm2", "iTerm2") - - brew_install_if_missing("coreutils") # required gdircolors and gls - brew_install_if_missing("ccat", "ccat") - - install_fzf - install_zim - end - def setup + setup_fzf + setup_zim + # Use gnu dircolors and ls %w[dircolors ls].each do |f| symlink("/usr/local/bin/g#{f}", @@ -42,14 +35,12 @@ def setup private - def install_fzf - brew_install_if_missing("fzf", "fzf") - + def setup_fzf system("$(brew --prefix)/opt/fzf/install --key-bindings --no-update-rc --no-bash --no-fish --completion", out: File::NULL) end - def install_zim + def setup_zim unless File.exist?(File.join(ENV["HOME"], ".zim")) system("curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh") end diff --git a/lib/got_files/tmux.rb b/lib/got_files/tmux.rb index 201703a..c881485 100644 --- a/lib/got_files/tmux.rb +++ b/lib/got_files/tmux.rb @@ -4,10 +4,7 @@ module GotFiles class Tmux < Base - def install - brew_install_if_missing("reattach-to-user-namespace") - brew_install_if_missing("tmux", "Tmux") - + def setup git("https://github.com/gpakosz/.tmux.git", "#{ENV['HOME']}/.tmux", "Oh My Tmux!") @@ -15,9 +12,7 @@ def install git("https://github.com/tmux-plugins/tpm", "#{ENV['HOME']}/.tmux/plugins/tpm", "Tmux Plugin Manager") - end - def setup install_file %w[~/.tmux/.tmux.conf files/tmux/tmux.conf.local] run %(tmux source ~/.tmux.conf) if ENV["TMUX"] diff --git a/lib/tasks/gpg.rake b/lib/tasks/gpg.rake index 052c5eb..b93fd76 100644 --- a/lib/tasks/gpg.rake +++ b/lib/tasks/gpg.rake @@ -1,7 +1,7 @@ # frozen_string_literal: true -namespace "install" do - desc "install and setup GPG Agent (and optionally import an exported key)" +namespace "setup" do + desc "import a key" task :gpg, [:key_to_import] do |_t, args| require "got_files/Gpg" diff --git a/lib/tasks/homebrew.rake b/lib/tasks/homebrew.rake deleted file mode 100644 index 6556a21..0000000 --- a/lib/tasks/homebrew.rake +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -namespace "brewfile" do - desc "install homebrew packages from Brewfile" - task :install do - require "got_files/homebrew" - - brew = GotFiles::Homebrew.new - brew.bundle_install - end - - desc "update Brewfile" - task :update do - require "got_files/homebrew" - - brew = GotFiles::Homebrew.new - brew.update_brewfile - end -end - -namespace "install" do - desc "install and setup Homebrew" - task :brew do - require "got_files/homebrew" - - brew = GotFiles::Homebrew.new - brew.install - brew.setup - end -end diff --git a/lib/tasks/neovim.rake b/lib/tasks/neovim.rake index 0d9a407..22a91ce 100644 --- a/lib/tasks/neovim.rake +++ b/lib/tasks/neovim.rake @@ -1,12 +1,11 @@ # frozen_string_literal: true -namespace "install" do - desc "install and setup Neovim" +namespace "setup" do + desc "setup Neovim" task :neovim do require "got_files/neovim" neovim = GotFiles::Neovim.new - neovim.install neovim.setup end end diff --git a/lib/tasks/terminal.rake b/lib/tasks/terminal.rake index 58ae882..513f3b3 100644 --- a/lib/tasks/terminal.rake +++ b/lib/tasks/terminal.rake @@ -1,12 +1,11 @@ # frozen_string_literal: true -namespace "install" do - desc "install and setup terminal and shell experience" +namespace "setup" do + desc "setup terminal and shell experience" task :terminal do require "got_files/terminal" terminal = GotFiles::Terminal.new - terminal.install terminal.setup end end diff --git a/lib/tasks/tmux.rake b/lib/tasks/tmux.rake index 9f4d110..2a6ecaf 100644 --- a/lib/tasks/tmux.rake +++ b/lib/tasks/tmux.rake @@ -1,12 +1,11 @@ # frozen_string_literal: true -namespace "install" do - desc "install and setup Tmux" +namespace "setup" do + desc "setup Tmux" task :tmux do require "got_files/tmux" tmux = GotFiles::Tmux.new - tmux.install tmux.setup end end diff --git a/nix/hosts/sbpltt6cllvdl/default.nix b/nix/hosts/sbpltt6cllvdl/default.nix index d33dce1..4b7e2b9 100644 --- a/nix/hosts/sbpltt6cllvdl/default.nix +++ b/nix/hosts/sbpltt6cllvdl/default.nix @@ -1,16 +1,20 @@ { pkgs, ... }: -{ +let + imports = [ + ./homebrew.nix + ]; + +in { + + inherit imports; + # Make sure the nix daemon always runs services.nix-daemon.enable = true; # If you use zsh you'll need to enable this so nix-darwin creates a zshrc sourcing needed environment changes programs.zsh.enable = true; - homebrew.enable = true; - homebrew.casks = [ - ]; - home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users."shoekstra" = import ./home.nix; diff --git a/nix/hosts/sbpltt6cllvdl/homebrew.nix b/nix/hosts/sbpltt6cllvdl/homebrew.nix new file mode 100644 index 0000000..f817067 --- /dev/null +++ b/nix/hosts/sbpltt6cllvdl/homebrew.nix @@ -0,0 +1,156 @@ +{ + homebrew.enable = true; + + # Output from `brew tap` + homebrew.taps = [ + "anchore/grype" + "aquasecurity/trivy" + "aws/tap" + "chipmk/tap" + "fairwindsops/tap" + "garden-io/garden" + "github/gh" + "hashicorp/tap" + "helm/tap" + "instrumenta/instrumenta" + "kube-score/tap" + "liamg/tfsec" + "norwoodj/tap" + "padok-team/tap" + "stecky/tap" + "yleisradio/terraforms" + "zaquestion/tap" + ]; + + # Output from `brew leaves` + homebrew.brews = [ + "adns" + "anchore/grype/grype" + "aquasecurity/trivy/trivy" + "argocd" + "argocd-autopilot" + "aws/tap/aws-sam-cli" + "awscli" + "bash" + "bat" + "cdktf" + "chart-testing" + "checkov" + "chipmk/tap/docker-mac-net-connect" + "cilium-cli" + "cmake" + "colima" + "coreutils" + "curl" + "dnsmasq" + "docker-machine" + "dockutil" + "dog" + "dos2unix" + "eksctl" + "fairwindsops/tap/polaris" + "fpp" + "fzf" + "garden-io/garden/garden-cli" + "gawk" + "gh" + "git" + "goreleaser" + "gpg" + "guile" + "hashicorp/tap/terraform-ls" + "helm/tap/chart-releaser" + "helmfile" + "htop" + "hubble" + "hugo" + "hyperkit" + "irssi" + "jpeg" + "jq" + "k9s" + "kind" + "krew" + "kube-linter" + "kube-score/tap/kube-score" + "kubebuilder" + "kubeconform" + "kubectx" + "kubeval" + "kubevela" + "kustomize" + "lab" + "libassuan" + "libgcrypt" + "libksba" + "localstack" + "luajit-openresty" + "mas" + "midnight-commander" + "minikube" + "mtr" + "mysql-client" + "ncdu" + "neovim" + "nghttp2" + "node" + "norwoodj/tap/helm-docs" + "npth" + "padok-team/tap/tfautomv" + "pipenv" + "pipx" + "pre-commit" + "pwgen" + "python@3.10" + "rename" + "stern" + "syft" + "telnet" + "terraform-docs" + "terragrunt" + "terrascan" + "testssl" + "tflint" + "tfsec" + "tree" + "utf8proc" + "vcluster" + "watch" + "wget" + "yamllint" + "yleisradio/terraforms/chtf" + "yq" + "zsh" + ]; + + # Output from `brew list --cask` + homebrew.casks = [ + "amazon-chime" + "authy" + "background-music" + "chef-workstation" + "clipy" + "daisydisk" + "docker" + "font-meslo-lg-nerd-font" + "forticlient-vpn" + "google-backup-and-sync" + "iterm2" + "lastpass" + "lens" + "obsidian" + "postman" + "powershell" + "ring" + "sentinel" + "sequel-pro" + "skitch" + "slack" + "spotify" + "telegram" + "vagrant" + "virtualbox" + "visual-studio-code" + "whatsapp" + ]; +}