lib.types.unique: Check inner type deeply
This doesn't change uniq. Why not? - In NixOS it seems that uniq is only used with simple types that are fully checked by t.check. - It exists for much longer and is used more widely. - I believe we should deprecate it, because unique was already better. - unique can be a proving ground.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
options.examples = mkOption {
|
||||
type = types.lazyAttrsOf
|
||||
(types.unique
|
||||
{ message = "We require a single definition, because seeing the whole value at once helps us maintain critical invariants of our system."; }
|
||||
(types.attrsOf types.str));
|
||||
};
|
||||
imports = [
|
||||
{ examples.merged = { b = "bee"; }; }
|
||||
{ examples.override = lib.mkForce { b = "bee"; }; }
|
||||
];
|
||||
config.examples = {
|
||||
merged = {
|
||||
a = "aye";
|
||||
};
|
||||
override = {
|
||||
a = "aye";
|
||||
};
|
||||
badLazyType = {
|
||||
a = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user