mirror of
https://github.com/nix-community/home-manager
synced 2024-11-30 06:59:45 +01:00
nix: fix package assertion
Sync it with the condition for generating nix.conf so that it triggers if `extraOptions` is set but `package` isn't.
This commit is contained in:
parent
c43d4a3d6d
commit
b70362bf9b
1 changed files with 17 additions and 18 deletions
|
@ -212,29 +212,28 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
(mkIf (cfg.registry != { }) {
|
||||||
|
xdg.configFile."nix/registry.json".source =
|
||||||
|
jsonFormat.generate "registry.json" {
|
||||||
|
version = cfg.registryVersion;
|
||||||
|
flakes =
|
||||||
|
mapAttrsToList (n: v: { inherit (v) from to exact; }) cfg.registry;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf (cfg.settings != { } || cfg.extraOptions != "") {
|
||||||
assertions = [{
|
assertions = [{
|
||||||
assertion = cfg.settings == { } || cfg.package != null;
|
assertion = cfg.package != null;
|
||||||
message = ''
|
message = ''
|
||||||
A corresponding Nix package must be specified via `nix.package` for generating
|
A corresponding Nix package must be specified via `nix.package` for generating
|
||||||
nix.conf.
|
nix.conf.
|
||||||
'';
|
'';
|
||||||
}];
|
}];
|
||||||
|
|
||||||
xdg.configFile = {
|
xdg.configFile."nix/nix.conf".source = nixConf;
|
||||||
"nix/registry.json" = mkIf (cfg.registry != { }) {
|
})
|
||||||
source = jsonFormat.generate "registry.json" {
|
]);
|
||||||
version = cfg.registryVersion;
|
|
||||||
flakes =
|
|
||||||
mapAttrsToList (n: v: { inherit (v) from to exact; }) cfg.registry;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
"nix/nix.conf" = mkIf (cfg.settings != { } || cfg.extraOptions != "") {
|
|
||||||
source = nixConf;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
meta.maintainers = [ maintainers.polykernel ];
|
meta.maintainers = [ maintainers.polykernel ];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue