I’m getting this error when using the crossLists
function, but it’s not clear how cartesianProductOfSets
is a replacement. Is this deprecation message correct?
Here’s what I’m doing:
nix-repl> region = [ "us-east-1" "us-east-2" "us-west-2" ]
nix-repl> env = [ "dev" "test" "prod" ]
nix-repl> :p lib.lists.crossLists (x: y: "${y}-${x}") [ region env ]
[ "dev-us-east-1" "test-us-east-1" "prod-us-east-1" "dev-us-east-2" "test-us-east-2" "prod-us-east-2" "dev-us-west-2" "test-us-west-2" "prod-us-west-2" ]
Now I can get to the same result with the suggested alternative, but not straight away.
nix-repl> xs = lib.attrsets.cartesianProductOfSets { inherit region env; }
nix-repl> lib.lists.map (x: "${x.env}-${x.region}") xs
[ "dev-us-east-1" "dev-us-east-2" "dev-us-west-2" "test-us-east-1" "test-us-east-2" "test-us-west-2" "prod-us-east-1" "prod-us-east-2" "prod-us-west-2" ]
Is this how it’s supposed to be done? or am I missing something?
$ nix --version
nix (Nix) 2.20.5