mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-11 17:39:37 +08:00
nh: fixes and addition to warnings/assertions (#6470)
* nh: fix auto clean - ~Fix `PATH` variable~ - Remove flake path assertion - Add warning when HM's `nix.gc.automatic` is enabled * nh: simplify logic for warning related to cfg.clean --------- Co-authored-by: Nikita Pedorich <pedorich.n@gmail.com>
This commit is contained in:
@@ -52,15 +52,11 @@ in {
|
||||
};
|
||||
|
||||
config = {
|
||||
warnings = lib.optionals
|
||||
(osConfig != null && !(cfg.clean.enable -> !osConfig.nix.gc.automatic)) [
|
||||
"programs.nh.clean.enable and nix.gc.automatic (system-wide in configuration.nix) are both enabled. Please use one or the other to avoid conflict."
|
||||
];
|
||||
|
||||
assertions = [{
|
||||
assertion = (cfg.flake != null) -> !(lib.hasSuffix ".nix" cfg.flake);
|
||||
message = "nh.flake must be a directory, not a nix file";
|
||||
}];
|
||||
warnings = (lib.optional
|
||||
(cfg.clean.enable && osConfig != null && osConfig.nix.gc.automatic)
|
||||
"programs.nh.clean.enable and nix.gc.automatic (system-wide in configuration.nix) are both enabled. Please use one or the other to avoid conflict.")
|
||||
++ (lib.optional (cfg.clean.enable && config.nix.gc.automatic)
|
||||
"programs.nh.clean.enable and nix.gc.automatic (Home-Manager) are both enabled. Please use one or the other to avoid conflict.");
|
||||
|
||||
home = lib.mkIf cfg.enable {
|
||||
packages = [ cfg.package ];
|
||||
|
||||
Reference in New Issue
Block a user