Why do we use merge // when we can just use imports in home-manager? #107
-
Experience with this template is awesome so far! I am just curious why author did this this way. In the template, darwin home-manager config uses // syntax to merge shared and darwin configs: home-manager = {
useGlobalPkgs = true;
users.${user} = { pkgs, config, lib, ... }:
{
home = {
enableNixpkgsReleaseCheck = false;
packages = pkgs.callPackage ./packages.nix { };
file = lib.mkMerge [
sharedFiles
additionalFiles
{ "emacs-launcher.command".source = myEmacsLauncher; }
];
stateVersion = "23.11";
};
# FIXME:
programs.man.enable = false;
} // import ../shared/home-manager.nix {
inherit config pkgs lib catppuccin;
};
}; I had a trouble with // overriding some of my darwin specific properties today, and found that I can just use imports instead of merging with //: home-manager = {
useGlobalPkgs = true;
users.${user} = { pkgs, config, lib, ... }: {
imports =
[ ../shared/home-manager.nix catppuccin.homeManagerModules.catppuccin ];
home = {
enableNixpkgsReleaseCheck = false;
packages = pkgs.callPackage ./packages.nix { };
file = lib.mkMerge [
sharedFiles
additionalFiles
{ "emacs-launcher.command".source = myEmacsLauncher; }
];
stateVersion = "23.11";
};
# disable Home Manager's man in favor of Nix-Darwin's
programs.man.enable = false;
};
}; The only issue I has so far with So, considering that they even have a bit different behaviour, I am curious what is the advantage of the approach with merging? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I think, at the time, I liked the idea of enabling overrides from Both implementations are fine with tradeoffs. |
Beta Was this translation helpful? Give feedback.
I think, at the time, I liked the idea of enabling overrides from
shared
modules within each platform-specific module. It's easy to override stuff in line with //. Moreover, I was running into infinite recursion errors and not solving them so easily. So I went this route.Both implementations are fine with tradeoffs.