Reputation: 4399
I have nix-darwin installed and created a flake.nix
file with content below. I have put that in a directory ~/x
and ran the following which gives no errors:
$ darwin-rebuild switch --dry-run --flake x/
building the system configuration...
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 nix-daemon...
waiting for nix-daemon
configuring networking...
setting up /Library/Fonts/Nix Fonts...
setting nvram variables...
However, if add the directory to git, it gives an error which gives me no clue how to fix
$ cp -r x y
$ cd y
$ git init && git add . && git commit -am 'initial'
$ darwin-rebuild switch --dry-run --flake y/
building the system configuration...
these 9 derivations will be built:
/nix/store/6q8gs4030fj613h1rc77qdd2vmsiydn7-options.json.drv
/nix/store/6i4fwbq03hrbsvw9skl60zz8w82z9mzp-options.json.drv
/nix/store/1213z7hj01zs50wsy3yjqsj6lcdvw4p7-darwin-manpages.drv
/nix/store/xdby0n64ijkcmyl1wf9dby5fgvmin03a-darwin-manual-html.drv
/nix/store/7m19k5gppfcbisdzk0rlyhqcq2kqsq88-darwin-help.drv
/nix/store/b35vswyff9pfd2a57y85zc8r326fsdq9-system-path.drv
/nix/store/ss6wmn08c1zp3snng97hs1qb7pl7x9my-system-applications.drv
/nix/store/z5c666bd7d5lrhg879n46hyl7mvp7a0j-darwin-version.json.drv
/nix/store/b1wjlf0rnzj84mv3w1yffqa1rph62jnc-darwin-system-24.05.20240621.201ed88+darwin4.29b3096.drv
don't know how to build these paths:
/nix/store/a2j86yi5rbprnq9wis88pq5n4qyfm0gq-darwin-system-24.05.20240621.201ed88+darwin4.29b3096
error: build of '/nix/store/a2j86yi5rbprnq9wis88pq5n4qyfm0gq-darwin-system-24.05.20240621.201ed88+darwin4.29b3096' failed
What am I doing wrong? Keen to know what's happening here not just how to fix it.
flake.nix
description = "Example Darwin system flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin";
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager }:
let
configuration = { pkgs, ... }: {
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages = [
pkgs.vim
];
system.stateVersion = 4;
# The platform the configuration will be used on.
nixpkgs.hostPlatform = "x86_64-darwin";
};
in
{
# Build darwin flake using:
# $ darwin-rebuild build --flake .#xx
darwinConfigurations = {
"xx" = nix-darwin.lib.darwinSystem {
modules = [
configuration
home-manager.darwinModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
];
};
};
# Expose the package set, including overlays, for convenience.
darwinPackages = self.darwinConfigurations."xx".pkgs;
};
Upvotes: 0
Views: 542
Reputation: 7464
To resolve, git add
the relevant items.
Here's a snippet I found regarding this:
When using the nix command with Nix flakes, it copies the flake into the Nix store first. (That’s why the filenames you saw were inside the Nix store instead of where you might have expected.) When doing so with a local path, it automatically determines what fetcher to use. If the path appears to be in a Git repository, a Git fetcher is used. The Git fetcher still keeps changes from the working directory intact if there are any, but any “untracked” files are omitted.
https://discourse.nixos.org/t/path-nix-store-does-not-exist/55413/4
Upvotes: 0