Comments (6)
@oscarvarto you may look at this option if you ever get back to Nix
https://daiderd.com/nix-darwin/manual/index.html#opt-homebrew.onActivation.autoUpdate
from nixos-config.
Hi, the video is out of date. I just moved the script to run under nix run .#build-switch
.
Nix is self-contained, it only knows about what is defined in flake.nix
. So if you're running brew
commands Nix will have no knowledge of those. Adversely, it will mutate your system in a way that is not conducive to Nix (being self contained, defined by a flake.nix
declaration). So you'll see weird behavior.
If you want to use Nix and brew, let Nix manage brew for you (like this config).
There is a big "leap" in Nix in that you're moving from imperative commands (typing commands into your terminal to do something), to defining what you're configuration should be and letting Nix do it for you (nix flake update
; nix run .#build-switch
).
Over the past year, I only run nix flake update
and nix run .#build-switch
to alter my system, outside of a few throw away applications.
from nixos-config.
For example, I don't run brew
commands. I run my main nix run .#build-switch
command that runs brew for me.
See this link of where I define what brew
package I want Nix to install for me:
https://github.com/dustinlyons/nixos-config/blob/main/modules/darwin/home-manager.nix#L26
from nixos-config.
I installed several (homebrew) things using your repo code. However, I didn't noticed that doing nix flake update
then nix run .#build-switch
upgraded my homebrew installed packages. For example, I have this in my modules/darwin/home-manager.nix
:
homebrew = {
enable = true;
brews = [
{
name = "d12frosted/emacs-plus/emacs-plus";
args = [ "with-xwidgets" "with-native-comp" "with-poll" ];
link = true;
}
];
casks = pkgs.callPackage ./casks.nix {};
onActivation = {
extraFlags = [ "--verbose" ];
};
masApps = {
"Amazon Prime Video" = 545519333;
"WhatsApp Messenger" = 310633997;
};
};
In a different (Mac OS X, intel Sonoma, no nix, used for work activities) computer with homebrew, I noticed my Emacs Plus formula was updated from 29.1 to 29.2. Even when I have been regularly "upgrading" (doing nix flake update
then nix run .#build-switch
) my nix installation, I never noticed that it tried to recompile my Emacs Plus installation, for example, until I manually executed brew upgrade && brew update && brew update --cask && brew cleanup
today in the morning (CST time zone).
I have a section like this in my flake.nix:
nix-homebrew = {
enable = true;
user = "${user}";
taps = {
"homebrew/homebrew-core" = homebrew-core;
"homebrew/homebrew-cask" = homebrew-cask;
"homebrew/homebrew-cask-versions" = homebrew-cask-versions;
"homebrew/homebrew-bundle" = homebrew-bundle;
"d12frosted/homebrew-emacs-plus" = homebrew-emacs-plus;
};
mutableTaps = false;
autoMigrate = true;
};
Could I possibly be missing something @dustinlyons ?
Edit: Here is my current configuration, based on your code: https://github.com/oscarvarto/nixos-config
from nixos-config.
Okay, sorry I left some previous comments but I don't think I understood the problem. Now I see. You're saying there are updates available, but Nix can't see them; only if you run brew do you see them.
I honestly don't know much about the internals of nix-homebrew. If you run nix flake update, my understanding is that your flake lock file gets updated with the latest hash for brew packages, casks, etc. You might ask this question over there.
In general, I try not to use brew packages and keep things in Nix land. When I do use brew or mas, I generally let those packages update however they want (auto update, or not using Nix.) But your question still stands-- why doesn't nix flake update bring in the latest brew versions, but using brew update does?
from nixos-config.
Exactly, this is my actual question:
why doesn't nix flake update bring in the latest brew versions, but using brew update does?
However, I've decided to not use nix on Mac OSX, and use traditional installation of my stuff. Not worth the additional overhead/complexity for my use cases.
from nixos-config.
Related Issues (20)
- Installation issues on Linux HOT 6
- Fresh install issues HOT 25
- Define user context in `flake.nix` and refactor install scripts
- MacOS M2 - install issue HOT 11
- Fix chmod command in README
- aarch64-darwin/create-keys: cannot execute: No such file or directory (MacBook Pro M3 Max chip) HOT 15
- Question [Help] HOT 11
- Issue with Adding Homebrew Tap HOT 5
- dustinlyons/nix-secrets.git dependency HOT 6
- NixOS install `./bin/apply: No such file or directory` HOT 8
- Installation issue on NixOS with xvda boot disk HOT 3
- Installed new NixOS install using this repo, no GUI on reboot HOT 13
- macOS - User does not own "system" or "default" profile HOT 8
- error: selector 'bash' matches no derivations HOT 21
- Purpose of mail and name? HOT 2
- Networking wireless device fails to start HOT 3
- Add -b backup to `home-manager switch` HOT 2
- error: experimental Nix feature 'nix-command' is disabled HOT 8
- starter config appears to expect secrets repo HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nixos-config.