From af9b7d2dd1441d22f9305832c053a0f8edffdc4b Mon Sep 17 00:00:00 2001 From: Stephen Parkinson Date: Fri, 20 Dec 2024 08:37:48 -0800 Subject: [PATCH] Switch back to brew --- brew/italica | 78 ++++++++++++++++++++ nix/flake.lock | 188 ------------------------------------------------- nix/flake.nix | 177 ---------------------------------------------- nix/home.nix | 44 ------------ nix/work.nix | 44 ------------ setup.sh | 45 ++++++++---- zsh/aliases | 4 +- zsh/zshrc | 20 ++---- 8 files changed, 119 insertions(+), 481 deletions(-) create mode 100644 brew/italica delete mode 100644 nix/flake.lock delete mode 100644 nix/flake.nix delete mode 100644 nix/home.nix delete mode 100644 nix/work.nix diff --git a/brew/italica b/brew/italica new file mode 100644 index 0000000..a32def9 --- /dev/null +++ b/brew/italica @@ -0,0 +1,78 @@ +tap "homebrew/bundle" +brew "coreutils" +brew "fastfetch" +brew "mas" +brew "nmap" +brew "tree" +brew "zsh-autosuggestions" +brew "zsh-syntax-highlighting" +cask "appcleaner" +cask "balenaetcher" +cask "bambu-studio" +cask "daisydisk" +cask "discord" +cask "docker" +cask "firefox" +cask "font-sf-mono" +cask "iina" +cask "istat-menus" +cask "iterm2" +cask "obsidian" +cask "ollama" +cask "prismlauncher" +cask "protonvpn" +cask "qbittorrent" +cask "raspberry-pi-imager" +cask "raycast" +cask "rectangle" +cask "scroll-reverser" +cask "sf-symbols" +cask "steam" +cask "utm" +cask "visual-studio-code" +mas "Broadcasts", id: 1469995354 +mas "Developer", id: 640199958 +mas "Flighty", id: 1358823008 +mas "Infuse", id: 1136220934 +mas "Keynote", id: 409183694 +mas "Noir", id: 1592917505 +mas "Numbers", id: 409203825 +mas "Pages", id: 409201541 +mas "SponsorBlock", id: 1573461917 +mas "TestFlight", id: 899247664 +mas "The Unarchiver", id: 425424353 +mas "Unread", id: 1363637349 +mas "Wipr", id: 1662217862 +mas "WireGuard", id: 1451685025 +mas "Xcode", id: 497799835 +vscode "42crunch.vscode-openapi" +vscode "bbenoist.nix" +vscode "charliermarsh.ruff" +vscode "davidanson.vscode-markdownlint" +vscode "dbaeumer.vscode-eslint" +vscode "foxundermoon.shell-format" +vscode "gamunu.vscode-yarn" +vscode "george-alisson.html-preview-vscode" +vscode "golang.go" +vscode "ms-azuretools.vscode-docker" +vscode "ms-python.debugpy" +vscode "ms-python.mypy-type-checker" +vscode "ms-python.python" +vscode "ms-python.vscode-pylance" +vscode "ms-vscode-remote.remote-containers" +vscode "ms-vscode-remote.remote-ssh" +vscode "ms-vscode-remote.remote-ssh-edit" +vscode "ms-vscode-remote.remote-wsl" +vscode "ms-vscode-remote.vscode-remote-extensionpack" +vscode "ms-vscode.cpptools" +vscode "ms-vscode.cpptools-extension-pack" +vscode "ms-vscode.cpptools-themes" +vscode "ms-vscode.remote-explorer" +vscode "ms-vscode.remote-server" +vscode "ms-vscode.vscode-typescript-next" +vscode "pkief.material-icon-theme" +vscode "redhat.vscode-yaml" +vscode "sswg.swift-lang" +vscode "vadimcn.vscode-lldb" +vscode "visualstudioexptteam.vscodeintellicode" +vscode "zainchen.json" diff --git a/nix/flake.lock b/nix/flake.lock deleted file mode 100644 index f74feb0..0000000 --- a/nix/flake.lock +++ /dev/null @@ -1,188 +0,0 @@ -{ - "nodes": { - "brew-src": { - "flake": false, - "locked": { - "lastModified": 1731323744, - "narHash": "sha256-SxUQm4cTHcaoPQHoXe26ZV8cZiMWBGow8MjE4L+MckM=", - "owner": "Homebrew", - "repo": "brew", - "rev": "254bf3fe9d8fa2e1b2fb55dbcf535b2d870180c4", - "type": "github" - }, - "original": { - "owner": "Homebrew", - "ref": "4.4.5", - "repo": "brew", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1733175814, - "narHash": "sha256-zFOtOaqjzZfPMsm1mwu98syv3y+jziAq5DfWygaMtLg=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "bf23fe41082aa0289c209169302afd3397092f22", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "nix-darwin": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1733047432, - "narHash": "sha256-fQUKxgxAEHlL5bevRkdsQB7sSpAMhlvxf7Zw0KK8QIg=", - "owner": "LnL7", - "repo": "nix-darwin", - "rev": "e30a3622b606dffc622305b4bbe1cfe37e78fa40", - "type": "github" - }, - "original": { - "owner": "LnL7", - "repo": "nix-darwin", - "type": "github" - } - }, - "nix-darwin_2": { - "inputs": { - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1716329735, - "narHash": "sha256-ap51w+VqG21vuzyQ04WrhI2YbWHd3UGz0e7dc/QQmoA=", - "owner": "LnL7", - "repo": "nix-darwin", - "rev": "eac4f25028c1975a939c8f8fba95c12f8a25e01c", - "type": "github" - }, - "original": { - "owner": "LnL7", - "repo": "nix-darwin", - "type": "github" - } - }, - "nix-homebrew": { - "inputs": { - "brew-src": "brew-src", - "flake-utils": "flake-utils", - "nix-darwin": "nix-darwin_2", - "nixpkgs": "nixpkgs_2" - }, - "locked": { - "lastModified": 1732145543, - "narHash": "sha256-VRQh/lvCSko9YV7haXyPt7DSp+EkgjjBv/9U4cY9c50=", - "owner": "zhaofengli-wip", - "repo": "nix-homebrew", - "rev": "ac3945ee614f69ab89c6935b3f0567028de5f012", - "type": "github" - }, - "original": { - "owner": "zhaofengli-wip", - "repo": "nix-homebrew", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1687274257, - "narHash": "sha256-TutzPriQcZ8FghDhEolnHcYU2oHIG5XWF+/SUBNnAOE=", - "path": "/nix/store/22qgs3skscd9bmrxv9xv4q5d4wwm5ppx-source", - "rev": "2c9ecd1f0400076a4d6b2193ad468ff0a7e7fdc5", - "type": "path" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1716330097, - "narHash": "sha256-8BO3B7e3BiyIDsaKA0tY8O88rClYRTjvAp66y+VBUeU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5710852ba686cc1fd0d3b8e22b3117d43ba374c2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1733024928, - "narHash": "sha256-n/DOfpKH1vkukuBnach91QBQId2dr5tkE7/7UrkV2zw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "2c27ab2e60502d1ebb7cf38909de38663f762a79", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "home-manager": "home-manager", - "nix-darwin": "nix-darwin", - "nix-homebrew": "nix-homebrew", - "nixpkgs": "nixpkgs_3" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/nix/flake.nix b/nix/flake.nix deleted file mode 100644 index 8f4feb7..0000000 --- a/nix/flake.nix +++ /dev/null @@ -1,177 +0,0 @@ -{ - description = "smparkin Darwin system flake"; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - nix-darwin.url = "github:LnL7/nix-darwin"; - nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; - nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew"; - home-manager.url = "github:nix-community/home-manager"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; - }; - - outputs = inputs@{ self, nix-darwin, nixpkgs, nix-homebrew, home-manager }: - let - configuration = { pkgs, config, ... }: { - - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search by name, run: - # $ nix-env -qaP | grep wget - environment.systemPackages = [ - pkgs.vim - ]; - - # Auto upgrade nix package and the daemon service. - services.nix-daemon.enable = true; - # nix.package = pkgs.nix; - - # Necessary for using flakes on this system. - nix.settings.experimental-features = "nix-command flakes"; - - # Defaults - security.pam.enableSudoTouchIdAuth = true; - system.defaults = { - dock.autohide = true; - trackpad.Clicking = true; - trackpad.TrackpadThreeFingerDrag = true; - }; - - # Set Git commit hash for darwin-version. - system.configurationRevision = self.rev or self.dirtyRev or null; - - # Used for backwards compatibility, please read the changelog before changing. - # $ darwin-rebuild changelog - system.stateVersion = 5; - - # The platform the configuration will be used on. - nixpkgs.hostPlatform = "aarch64-darwin"; - programs.zsh.enable = true; - - # Home Manager - users.users = { - smparkin.home = "/Users/smparkin"; - parkist.home = "/Users/parkist"; - }; - nix.configureBuildUsers = true; - nix.useDaemon = true; - }; - in - { - darwinConfigurations."macbook" = nix-darwin.lib.darwinSystem { - modules = [ - configuration - nix-homebrew.darwinModules.nix-homebrew - { - homebrew = { - enable = true; - casks = [ - "appcleaner" - "balenaetcher" - "bambu-studio" - "daisydisk" - "discord" - "docker" - "firefox" - "font-sf-mono" - "iina" - "istat-menus" - "iterm2" - "obsidian" - "ollama" - "prismlauncher" - "protonvpn" - "qbittorrent" - "raspberry-pi-imager" - "raycast" - "rectangle" - "scroll-reverser" - "sf-symbols" - "steam" - "utm" - "visual-studio-code" - ]; - masApps = { - "Broadcasts" = 1469995354; - "Callsheet" = 1672356376; - "Developer" = 640199958; - "Flighty" = 1358823008; - "Infuse" = 1136220934; - "Noir" = 1592917505; - "Numbers" = 409203825; - "Overcast" = 888422857; - "Pages" = 409201541; - "SponsorBlock" = 1573461917; - "TestFlight" = 899247664; - "TheUnarchiver" = 425424353; - "Unread" = 1363637349; - "WiFiMan" = 1385561119; - "Wipr2" = 1662217862; - "WireGuard" = 1451685025; - "Xcode" = 497799835; - }; - onActivation.cleanup = "zap"; - onActivation.autoUpdate = true; - onActivation.upgrade = true; - }; - nix-homebrew = { - enable = true; - enableRosetta = true; - user = "smparkin"; - }; - } - home-manager.darwinModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.smparkin = import ./home.nix; - }; - } - ]; - }; - - darwinConfigurations."workbook" = nix-darwin.lib.darwinSystem { - modules = [ - configuration - nix-homebrew.darwinModules.nix-homebrew - { - homebrew = { - enable = true; - casks = [ - "appcleaner" - "balenaetcher" - "daisydisk" - "firefox" - "font-sf-mono" - "iina" - "istat-menus" - "iterm2" - "obsidian" - "raycast" - "rectangle" - "scroll-reverser" - "visual-studio-code" - ]; - onActivation.cleanup = "zap"; - onActivation.autoUpdate = true; - onActivation.upgrade = true; - }; - nix-homebrew = { - enable = true; - enableRosetta = true; - user = "parkist"; - }; - } - home-manager.darwinModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.parkist = import ./work.nix; - }; - } - ]; - }; - }; -} diff --git a/nix/home.nix b/nix/home.nix deleted file mode 100644 index be0db40..0000000 --- a/nix/home.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ config, pkgs, ... }: - -{ - # Home Manager needs a bit of information about you and the - # paths it should manage. - home.username = "smparkin"; - home.homeDirectory = "/Users/smparkin"; - - # nix packages - home.packages = [ - pkgs.fastfetch - pkgs.coreutils - pkgs.nmap - pkgs.tree - # zsh plugins - pkgs.zsh-autosuggestions - pkgs.zsh-syntax-highlighting - ]; - - # This value determines the Home Manager release that your - # configuration is compatible with. This helps avoid breakage - # when a new Home Manager release introduces backwards - # incompatible changes. - # - # You can update Home Manager without changing this value. See - # the Home Manager release notes for a list of state version - # changes in each release. - home.stateVersion = "24.11"; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - - # Home dir - home.file = { - ".zshrc".source = ../zsh/zshrc; - ".zsh.d/aliases".source = ../zsh/aliases; - ".zsh.d/functions".source = ../zsh/functions; - ".zsh.d/theme".source = ../zsh/theme; - ".gitconfig".source = ../git/gitconfig; - ".gitignore_global".source = ../git/gitignore_global; - ".tmux.conf".source = ../tmux/tmux.conf; - ".vimrc".source = ../vim/vimrc; - }; -} diff --git a/nix/work.nix b/nix/work.nix deleted file mode 100644 index 611e361..0000000 --- a/nix/work.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ config, pkgs, ... }: - -{ - # Home Manager needs a bit of information about you and the - # paths it should manage. - home.username = "parkist"; - home.homeDirectory = "/Users/parkist"; - - # nix packages - home.packages = [ - pkgs.fastfetch - pkgs.coreutils - pkgs.nmap - pkgs.tree - # zsh plugins - pkgs.zsh-autosuggestions - pkgs.zsh-syntax-highlighting - ]; - - # This value determines the Home Manager release that your - # configuration is compatible with. This helps avoid breakage - # when a new Home Manager release introduces backwards - # incompatible changes. - # - # You can update Home Manager without changing this value. See - # the Home Manager release notes for a list of state version - # changes in each release. - home.stateVersion = "24.11"; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - - # Home dir - home.file = { - ".zshrc".source = ../zsh/zshrc; - ".zsh.d/aliases".source = ../zsh/aliases; - ".zsh.d/functions".source = ../zsh/functions; - ".zsh.d/theme".source = ../zsh/theme; - ".gitconfig".source = ../git/gitconfig; - ".gitignore_global".source = ../git/gitignore_global; - ".tmux.conf".source = ../tmux/tmux.conf; - ".vimrc".source = ../vim/vimrc; - }; -} diff --git a/setup.sh b/setup.sh index 146f23e..4d3f60c 100755 --- a/setup.sh +++ b/setup.sh @@ -3,21 +3,35 @@ OSTYPE=$(uname -s) if [ "$OSTYPE" = "Linux" ]; then - DISTRO=$(lsb_release -i -s) - if [ "$DISTRO" = "Ubuntu" ]; then + echo "Package manager: " + read packm + if [ "$packm" = "apt" ]; then sudo apt update - sudo apt install coreutils vim zsh jq python3 python3-pip -y + sudo apt install coreutils vim zsh jq python3 -y sudo apt upgrade -y - else - # pretty safe assumption that if not ubuntu its arch + elif [ "$packm" = "yum" ]; then + sudo yum update + sudo yum install coreutils vim zsh jq python3 -y + elif [ "$packm" = "pacman" ]; then sudo pacman -Syu sudo pacman -Sy coreutils vim zsh jq python3 + else + echo "Unknown package manager, continuing..." fi elif [ "$OSTYPE" = "Darwin" ]; then - echo "Install Nix? [y/n]" - read install_nix - if [ "$install_nix" = "y" ]; then - sh <(curl -L https://nixos.org/nix/install) + mkdir ~/Developer + echo "Install Homebrew? [y/n]" + read homebrew + if [ "$homebrew" = "y" ]; then + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + echo "Restore from Brewfile? [y/n]" + read bundle + if [ "$bundle" = "y" ]; then + brew bundle install --file= + else + brew install coreutils fastfetch vim zsh jq python3 zsh-autosuggestions zsh-syntax-highlighting + fi + fi fi # silence login message @@ -25,12 +39,19 @@ touch ~/.hushlogin # remove common files and symlink new files rm ~/.zshrc ~/.vimrc ~/.tmux.conf - -mkdir ~/Developer +mkdir ~/.zsh.d +ln -s ~/dotfiles/zsh/aliases ~/.zsh.d/aliases +ln -s ~/dotfiles/zsh/functions ~/.zsh.d/functions +ln -s ~/dotfiles/zsh/theme ~/.zsh.d/theme +ln -s ~/dotfiles/zsh/zshrc ~/.zshrc +ln -s ~/dotfiles/git/gitconfig ~/.gitconfig +ln -s ~/dotfiles/git/gitignore_global ~/.gitignore_global +ln -s ~/dotfiles/tmux/tmux.conf ~/.tmux.conf +ln -s ~/dotfiles/vim/vimrc ~/.vimrc echo "Change shell to zsh? [y/n]" read shell if [ "$shell" = "y" ]; then chsh -s /bin/zsh fi -exit +exit \ No newline at end of file diff --git a/zsh/aliases b/zsh/aliases index 6c91ade..feae08b 100644 --- a/zsh/aliases +++ b/zsh/aliases @@ -8,7 +8,7 @@ alias ll='ls -lah' alias l='ls -CF' # System Utils -alias rebuild='darwin-rebuild switch --flake ~/dotfiles/nix#macbook' +alias brewup='cl && brew update && brew upgrade && brew upgrade --cask && brew cleanup -s && brew doctor --verbose | grep -A 1 --color=never "Homebrew Version" && brew autoremove' alias cl='clear' alias wthr='curl wttr.in/san_luis_obispo' alias nf='cl && fastfetch && shownetinfo && batt' @@ -18,4 +18,4 @@ alias fps='if [[ $(launchctl getenv MTL_HUD_ENABLED) -eq 1 ]]; then launchctl unsetenv MTL_HUD_ENABLED && echo "Metal FPS disabled" else launchctl setenv MTL_HUD_ENABLED 1 && echo "Metal FPS enabled" -fi' \ No newline at end of file +fi' diff --git a/zsh/zshrc b/zsh/zshrc index 024bd8e..2a68a95 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -57,20 +57,12 @@ else alias ls='ls -G' fi -shownetinfo -if [ "$OSTYPE" = "Linux" ]; then - echo "" -elif [ "$OSTYPE" = "Darwin" ]; then +if [ "$(uname)" = "Darwin" ]; then # set up iterm integration source ~/.iterm2_shell_integration.zsh - # set up auto suggestions and syntax highlighting - source /nix/store/*zsh-autosuggestions*/share/zsh-autosuggestions/zsh-autosuggestions.zsh - source /nix/store/*zsh-syntax-highlighting*/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh - ssh-add -K ~/.ssh/id_rsa 2>/dev/null - LAPTOP=$(system_profiler SPHardwareDataType | grep "Model Name" | grep "Book") - if [ "$LAPTOP" != "" ]; then - batt - else - echo "" - fi + # source homebrew + eval "$(/opt/homebrew/bin/brew shellenv)" + # plugins + source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh + source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh fi