1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00: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:
Naïm Favier 2023-02-07 11:35:12 +01:00
parent c43d4a3d6d
commit b70362bf9b
No known key found for this signature in database
GPG key ID: 95AFCE8211908325

View file

@ -212,29 +212,28 @@ in {
};
};
config = mkIf cfg.enable {
assertions = [{
assertion = cfg.settings == { } || cfg.package != null;
message = ''
A corresponding Nix package must be specified via `nix.package` for generating
nix.conf.
'';
}];
xdg.configFile = {
"nix/registry.json" = mkIf (cfg.registry != { }) {
source = jsonFormat.generate "registry.json" {
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;
};
};
})
"nix/nix.conf" = mkIf (cfg.settings != { } || cfg.extraOptions != "") {
source = nixConf;
};
};
};
(mkIf (cfg.settings != { } || cfg.extraOptions != "") {
assertions = [{
assertion = cfg.package != null;
message = ''
A corresponding Nix package must be specified via `nix.package` for generating
nix.conf.
'';
}];
xdg.configFile."nix/nix.conf".source = nixConf;
})
]);
meta.maintainers = [ maintainers.polykernel ];
}