-
-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fish: Unknown command: darwin-rebuild, even after installing. #1286
Comments
Hi, I ran into the same issue as well MacOS Version: Sequoia 15.2 arm64 My {
description = "Example nix-darwin system flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:LnL7/nix-darwin/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nix-darwin, nixpkgs }:
let
configuration = { pkgs, ... }: {
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages =
[ pkgs.vim
];
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
# Enable alternative shell support in nix-darwin.
# programs.fish.enable = 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";
};
in
{
# Build darwin flake using:
# $ darwin-rebuild build --flake .#zhangchis-MacBook-Pro
darwinConfigurations."zhangchis-MacBook-Pro" = nix-darwin.lib.darwinSystem {
modules = [ configuration ];
};
};
} |
Does it work after opening a new terminal window? Note that you need to uncomment the |
I am using zsh. It should be enabled by default according to #1134. I have checked my |
Yeah, if you’re using Zsh then a new terminal window should have the correct |
This is the
and also nix is gone as well
uninstalling |
Do you perhaps have a |
I have uncommented that line now:
Then ran: building the system configuration...
warning: Git tree '/Users/evan/.config/nix-darwin' is dirty
Password:
user defaults...
setting up user launchd services...
setting up /Applications/Nix Apps...
setting up pam...
applying patches...
setting up /etc...
system defaults...
setting up launchd services...
reloading service org.nixos.activate-system
reloading nix-daemon...
waiting for nix-daemon
configuring networking...
configuring power...
setting up /Library/Fonts/Nix Fonts...
setting nvram variables... However, the issue still persists |
Thanks for pointing this out! In my case I had the following in my
removing these lines solves the issue |
If it helps, for me, I have this in my
|
@zhangchi0104 Great! Feel free to open another issue if you have any other problems :) @esn89 Thanks. It looks like that snippet shouldn’t be causing problems by itself (though it will mean that MacPorts executables are preferred over ones from nix-darwin, which may have confusing consequences). Can you run |
Here is the $PATH:
I installed Fish from macports |
Any other ideas? :( |
Can you try fish from nixpkgs, just to see if it works? |
@Samasaur1 no luck here either. |
I would try with nothing in ~/.config/fish The issue seems to me to be /run/current-system/sw/bin is not on the path. |
@bestlem Thanks. adding |
@ngaxavi does it still work after a reboot? I just upgraded to sequoia (without a proper nix uninstall) and reinstalled nix. Is that the case for you as well? @bestlem what is supposed to create this symlink? |
This sounds like a different issue. Creating |
There's an issue (#1219) tracking improving the current launchd situation, which includes making those services show up with descriptive names. |
Ah, many thanks! Yes, the daemon is not running, and I indeed turned off some of the 'sh' entries. Thought they where duplicate skhd & yabai entries, that kept duplicating on nix switch (which looks like it is fixed now). @Samasaur1 many thanks for pointing me in this direction!! |
@patmuk Can you tell me what you configured so that the nix-daemon starts on reboot? |
@ngaxavi Here is my journey: I had troubles with one local project ... and did not upgraded to Sequoia. As a second project with the same setup worked, and I couldn't figure the difference, I decided to upgrade to sequoia and install nix again. While trying to get the project to work I deactivated the 'sh' entries in login items and forgot to enable them again. Additionally I ran the installer again without deinstalling nix first. After upgrading MacOS I couldn't unlock the nix store virtual drive anymore. As it is on my main drive, which is encrypted (standard Mac setup), it did not needed to be encrypted in the first place. So I deleted it and ran the installer without encrypting the nix store: Nothing worked, so I began to eliminate one mistake after another until I got the last hint here - that the four 'sh' processes are from nix and are needed. Hope that helped! |
I found the problem: every time I run Does anyone know why the Nix daemon gets unloaded when running darwin-rebuild? Here is my configuration. {
description = "Mac Darwin system flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
mac-app-util.url = "github:hraban/mac-app-util";
nix-darwin.url = "github:LnL7/nix-darwin/master";
nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/0.1";
};
outputs = inputs@{ self, nix-darwin, nixpkgs, mac-app-util, nix-homebrew, determinate }:
let
configuration = { pkgs, config, ... }: {
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages =
[ pkgs.vim
pkgs.neovim
pkgs.alacritty
pkgs.fish
pkgs.magic-wormhole
pkgs.jdk21_headless
pkgs.jdk17_headless
pkgs.jdk23_headless
];
services.nix-daemon.enable = true;
launchd.daemons.nix-daemon.serviceConfig = {
KeepAlive = true;
Program = "/run/current-system/sw/bin/nix-daemon";
};
homebrew = {
enable = true;
brews = [
"stow"
"ykman"
"libfido2"
"gnupg"
"openssl@3"
"fish"
"nvm"
"pnpm"
"npm"
];
casks = [
"ghostty"
"jetbrains-toolbox"
"docker"
"microsoft-teams"
"logi-options+"
];
masApps = {
"Windows App" = 1295203466;
"CopyClip" = 595191960;
};
onActivation.cleanup = "zap";
onActivation.autoUpdate = true;
onActivation.upgrade = true;
};
# Set fish as the default shell
users.knownUsers = [ "test" ];
users.users.test.uid = 501;
users.users.test.shell = pkgs.fish;
nixpkgs.config.allowUnfree = true;
system.defaults = {
dock.autohide = true;
finder.AppleShowAllExtensions = true;
finder.FXPreferredViewStyle = "clmv";
};
# https://samasaur1.github.io/blog/jdks-on-nix-darwin
system.activationScripts.extraActivation.text = ''
ln -sf "${pkgs.jdk17_headless}/zulu-17.jdk" "/Library/Java/JavaVirtualMachines/"
ln -sf "${pkgs.jdk21_headless}/zulu-21.jdk" "/Library/Java/JavaVirtualMachines/"
ln -sf "${pkgs.jdk23_headless}/zulu-23.jdk" "/Library/Java/JavaVirtualMachines/"
'';
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
# Enable alternative shell support in nix-darwin.
programs.zsh.enable = true;
programs.fish.enable = 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";
};
in
{
# Build darwin flake using:
# $ darwin-rebuild build --flake .#simple
darwinConfigurations."mini" = nix-darwin.lib.darwinSystem {
modules = [
configuration
mac-app-util.darwinModules.default
determinate.darwinModules.default
nix-homebrew.darwinModules.nix-homebrew
{
nix-homebrew = {
enable = true;
# Apple Silicon Only: Also install Homebrew under the default Intel prefix for Rosetta 2
enableRosetta = true;
# User owning the Homebrew prefix
user = "ngaxavi";
autoMigrate = true;
};
}
];
};
};
} |
Note this is nothing to do with the original issue. re 'Does anyone know why the Nix daemon gets unloaded when running darwin-rebuild?" As for your issue - I don't know. To debug I would start from an empty configuration - just the inputs and a darwinConfiguration without any modules and minimal everything else - just get zsh working |
It shows:
|
![]() @Samasaur1 this is the 4 sh files we're talking about, right? |
Is this the fix? I mean I do see the Was it supposed to be automated but automation failed somewhere? |
I've added But getting:
I did some googling and applied this fix: But to no avail |
@ngaxavi Did you pass the If you did, then you installed the Determinate distribution, which has its own daemon to manage Nix that currently doesn’t interoperate well with nix-darwin even when using their module. #1313 should provide a better user experience for users of Determinate, but hasn’t yet been reviewed and merged. |
@emilazy Thanks! it works |
I have installed nix via determinate systems like so:
My
~/.config/nix-darwin/flake.nix
looks like this:When I run:
nix run nix-darwin -- switch --flake ~/.config/nix-darwin
it succeeds, but:Error message:
I am using fish shell and my $PATH is:
The text was updated successfully, but these errors were encountered: