I’m a Nix noob, incrementally managing my macOS setup with Nix. Having successfully started using nix-darwin and home-manager separately (with darwin-rebuild switch
and home-manager switch
), I’m now trying to combine them, using the nix-darwin module home-manager provides. When I do, darwin-rebuild
fails due to conflicting definitions. Could someone please cast an eye over my configuration and point out what I’m sure is the stupid mistake I’ve made? If you notice other idiocy in passing, please feel free to point it out (e.g. I’ve currently got a massive vimrc inlined into a configuration file, and I should definitely pull that into a separate file; but there are doubtless many other things I’m doing wrongly).
My configuration is specified in the following two files:
- nix-dotfiles/darwin-configuration.nix at 268515fdf9b330b68f4ca9e5a18df49de501506f · Smaug123/nix-dotfiles · GitHub
-
nix-dotfiles/home.nix at 268515fdf9b330b68f4ca9e5a18df49de501506f · Smaug123/nix-dotfiles · GitHub (of which you can safely ignore lines 73 onwards: that is all
neovim
configuration)
When I darwin-rebuild switch
, I get the following error:
➜ darwin-rebuild switch
building the system configuration...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: The option `home-manager.users.Patrick.home.homeDirectory' has conflicting definition values:
- In `/Users/Patrick/.nix-defexpr/channels/home-manager/nix-darwin': "/var/empty"
- In `/Users/Patrick/.nixpkgs/darwin-configuration.nix': "/Users/Patrick"
(use '--show-trace' to show detailed location information)
The detailed location information can be found below the fold.
I understand what this is saying: the default home-manager
-provided module for nix-darwin
specifies a home directory of /var/empty
, but my own darwin-configuration.nix
specifies /Users/Patrick
. I have a mental model in which it makes sense for home-manager
's module to have a default home directory that’s completely separate from anything it might blat when installing into an existing setup; is that indeed why it specifies this home directory?
I have the general impression that it’s possible to set the priority of one definition over the other, e.g. from Conflicting definitions for programs.ssh.askPassword in plasma5 and seahorse · Issue #75867 · NixOS/nixpkgs · GitHub. Is that the right thing to do here?
Thanks in advance,
Patrick
Detailed location information:
➜ darwin-rebuild switch --show-trace
building the system configuration...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: while evaluating the attribute 'config.system.build.toplevel' at undefined position:
while evaluating 'g' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/attrsets.nix:298:19, called from undefined position:
while evaluating anonymous function at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:140:72, called from /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pr
e299952.7918dc5148d/nixpkgs/lib/attrsets.nix:301:20:
while evaluating the attribute 'value' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:525:9:
while evaluating the option `system.build':
while evaluating the attribute 'mergedValue' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:557:5:
while evaluating 'merge' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/types.nix:386:20, called from /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918d
c5148d/nixpkgs/lib/modules.nix:559:59:
while evaluating 'filterAttrs' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/attrsets.nix:124:23, called from /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299
952.7918dc5148d/nixpkgs/lib/types.nix:387:35:
while evaluating anonymous function at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/attrsets.nix:125:29, called from /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11p
re299952.7918dc5148d/nixpkgs/lib/attrsets.nix:125:18:
while evaluating anonymous function at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/types.nix:387:51, called from /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre2
99952.7918dc5148d/nixpkgs/lib/attrsets.nix:125:62:
while evaluating the attribute 'toplevel' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/attrsets.nix:366:7:
while evaluating anonymous function at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/types.nix:387:86, called from /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/attrsets.nix:366:15:
while evaluating the attribute 'optionalValue' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:569:5:
while evaluating the attribute 'values' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:551:9:
while evaluating the attribute 'values' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:650:7:
while evaluating anonymous function at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:537:28, called from /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:537:17:
while evaluating definitions from `/nix/store/syidmwxgh41rmxqrmh6vm1h6wwihw5xd-darwin/darwin/modules/system':
while evaluating 'dischargeProperties' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:609:25, called from /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:538:137:
while evaluating the attribute 'value' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/types.nix:391:60:
while evaluating 'throwAssertions' at /nix/store/syidmwxgh41rmxqrmh6vm1h6wwihw5xd-darwin/darwin/modules/system/default.nix:13:21, called from /nix/store/syidmwxgh41rmxqrmh6vm1h6wwihw5xd-darwin/darwin/modules/system/default.nix:73:29:
while evaluating anonymous function at /nix/store/syidmwxgh41rmxqrmh6vm1h6wwihw5xd-darwin/darwin/modules/system/default.nix:11:50, called from undefined position:
while evaluating the attribute 'assertion' at /Users/Patrick/.nix-defexpr/channels/home-manager/nix-darwin/default.nix:110:32:
while evaluating the attribute 'assertion' at /Users/Patrick/.nix-defexpr/channels/home-manager/modules/home-environment.nix:417:9:
while evaluating the attribute 'home.homeDirectory' at undefined position:
while evaluating 'g' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/attrsets.nix:298:19, called from undefined position:
while evaluating anonymous function at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:140:72, called from /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/attrsets.nix:301:20:
while evaluating the attribute 'value' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:525:9:
while evaluating the option `home-manager.users.Patrick.home.homeDirectory':
while evaluating the attribute 'mergedValue' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:557:5:
while evaluating 'mergeEqualOption' at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/options.nix:137:27, called from /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/modules.nix:559:59:
while evaluating anonymous function at /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/options.nix:143:26, called from /nix/store/0zgv90z5sii3hphzr1zlvdvchrlcwwy6-nixpkgs-21.11pre299952.7918dc5148d/nixpkgs/lib/options.nix:143:11:
The option `home-manager.users.Patrick.home.homeDirectory' has conflicting definition values:
- In `/Users/Patrick/.nix-defexpr/channels/home-manager/nix-darwin': "/var/empty"
- In `/Users/Patrick/.nixpkgs/darwin-configuration.nix': "/Users/Patrick"