dustinlyons / nixos-config

General purpose Nix configuration for macOS / NixOS with starter templates + step-by-step guides ✨
BSD 3-Clause "New" or "Revised" License
1.52k stars 95 forks source link

Zshrc is not replaced after `nix run .#build-switch` on MacOS #102

Closed Demianeen closed 2 months ago

Demianeen commented 2 months ago

I am starting with Nix, and everybody uses NixOS, so I was happy to find I have a good Nix guide that can help me to start with Nix. Big thanks for that)

I did go with the Full version with secrets management. I completed each step without issues (thanks to good docs) until the final step, nix run .#build-switch. Although the command ran without errors, my zshrc was not replaced with the new configuration, and the flake was not activated.

The output from nix run .#build-switch:


warning: Git tree '/Users/demian/nixos-config' is dirty
Running build-switch for aarch64-darwin
Starting build...
warning: Git tree '/Users/demian/nixos-config' is dirty
trace: warning: nixfmt was renamed to nixfmt-classic. The nixfmt attribute may be used for the new RFC 166-style formatter in the future, which
Switching to new generation...
warning: unknown setting 'upgrade-nix-store-path-url'
warning: Git tree '/Users/demian/nixos-config' is dirty
building the system configuration...
warning: unknown setting 'upgrade-nix-store-path-url'
warning: Git tree '/Users/demian/nixos-config' is dirty
trace: warning: nixfmt was renamed to nixfmt-classic. The nixfmt attribute may be used for the new RFC 166-style formatter in the future, which
warning: unknown setting 'upgrade-nix-store-path-url'
setting up Homebrew (/opt/homebrew)...
user defaults...
setting up user launchd services...
Homebrew bundle...
Using mas
Using docker
Installing visual-studio-code
==> Downloading https://update.code.visualstudio.com/1.91.1/darwin-arm64/stable
Already downloaded: /Users/demian/Library/Caches/Homebrew/downloads/1f4e426cec6d732adfb02c5a492c134fca145fa182923fc422569b2d10edb7cd--VSCode-darwin-arm64.zip
==> Installing Cask visual-studio-code
Error: It seems there is already an App at '/Applications/Visual Studio Code.app'.
==> Purging files for version 1.91.1 of Cask visual-studio-code
Installing visual-studio-code has failed!
Using discord
Installing notion
==> Downloading https://desktop-release.notion-static.com/Notion-3.10.0-arm64.dmg
Already downloaded: /Users/demian/Library/Caches/Homebrew/downloads/fb3f20ed29141c25abad04e8420dcf418fde30d6d179496b1aafb75c30692feb--Notion-3.10.0-arm64.dmg
==> Installing Cask notion
Error: It seems there is already an App at '/Applications/Notion.app'.
==> Purging files for version 3.10.0 of Cask notion
Installing notion has failed!
Installing slack
==> Downloading https://downloads.slack-edge.com/desktop-releases/mac/arm64/4.39.90/Slack-4.39.90-macOS.dmg
Already downloaded: /Users/demian/Library/Caches/Homebrew/downloads/41b0e113b1c6b5363933bd6924b0af3ad4e092b7786111a72e2b960d8eeaf977--Slack-4.39.90-macOS.dmg
==> Installing Cask slack
Error: It seems there is already an App at '/Applications/Slack.app'.
==> Purging files for version 4.39.90 of Cask slack
Installing slack has failed!
Installing telegram
==> Downloading https://osx.telegram.org/updates/Telegram-10.15.2.265540.app.zip
Already downloaded: /Users/demian/Library/Caches/Homebrew/downloads/622c8f8ad9b3e2493aa99ef2571000557baf535a5761ca15f5b863ff76a81e8a--Telegram-10.15.2.265540.app.zip
==> Installing Cask telegram
Error: It seems there is already an App at '/Applications/Telegram.app'.
==> Purging files for version 10.15.2,265540 of Cask telegram
Installing telegram has failed!
Using zoom
Using syncthing
Using vlc
Installing raycast
==> Downloading https://releases.raycast.com/releases/1.78.1/download?build=arm
Already downloaded: /Users/demian/Library/Caches/Homebrew/downloads/b6686687f181b0cfc5f5dbe0b9d6411d84c02f8444ae167a14cb339cb5a44c74--Raycast.dmg
==> Installing Cask raycast
Error: It seems there is already an App at '/Applications/Raycast.app'.
==> Purging files for version 1.78.1 of Cask raycast
Installing raycast has failed!
Installing google-chrome
==> Downloading https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg
Already downloaded: /Users/demian/Library/Caches/Homebrew/downloads/88881e66883c4776fff9b3019b
Warning: No checksum defined for cask 'google-chrome', skipping verification.
==> Installing Cask google-chrome
Error: It seems there is already an App at '/Applications/Google Chrome.app'.
==> Purging files for version 126.0.6478.127 of Cask google-chrome
Installing google-chrome has failed!
Installing 1password
Error: No downloads began
No downloads
Installing 1password has failed!
Installing wireguard
Error: No downloads began
No downloads
Installing wireguard has failed!
Homebrew Bundle failed! 8 Brewfile dependencies failed to install.
asdf_update_golang_env:2: command not found: asdf                            

There were some errors due to the old zsh config. I was getting errors that brew is already there so I just did sudo mv /opt/homebrew{,.bak} which broke my zshrc

Questions:

Demianeen commented 2 months ago

Okay, in my case the issue was that homebrew failed to install already existing apps so it failed and program stopped, I thought it would continue, the same behaviour as with mas cli. It is an unintuitive behaviour. I assume this is because I installed them not as the brew casks, so it was failing