If I have a set, I can get easily a element of this set.
{ a = 1; b = 2; c = 3; }
{ a = 1; b = 2; c = 3; }
builtins.typeOf {a = 1; b = 2; c = 3; }
"set"
{ a = 1; b = 2; c = 3; }.a
1
Now I have another set
builtins.typeOf (let f= builtins.getFlake "github:informalsystems/cosmos.nix"; in let ff= f.outputs.devShells.x86_64-linux; in ff.cosmos-shell)
"set"
Ok that a set but it doesn't really look like a set ( «» instead of{})
let f= builtins.getFlake "github:informalsystems/cosmos.nix"; in let ff= f.outputs.devShells.x86_64-linux; in ff.cosmos-shell
«derivation /nix/store/drfgr6zlkbv70wmml5n8h9x2wj29kk39-nix-shell.drv»
and I can't take the field derivation
builtins.attrNames (let f= builtins.getFlake "github:informalsystems/cosmos.nix"; in let ff= f.outputs.devShells.x86_64-linux; in ff.cosmos-shell
give others field. That are the elements used to build cosmos-shell
My question is why this command
let f= builtins.getFlake "github:informalsystems/cosmos.nix"; in let ff= f.outputs.devShells.x86_64-linux; in ff.cosmos-shell
doesn't return a set with the element defining cosmos-shell
or
another type giving the derivation where cosmos-shell is defined and with method to get the element defining cosmos-shell
Why am I asking this question
Normally I can easily export a set as a json string
builtins.toJSON { a = 1; b = 2; c = 3; }
"{"a":1,"b":2,"c":3}"
But in this case I can't.
builtins.toJSON (let f= builtins.getFlake "github:informalsystems/cosmos.nix"; in let ff= f.outputs.devShells.x86_64-linux; in ff.cosmos-shell)
'>""/nix/store/wf3inmq4x93s3z32m90xz8d10gkz55zb-nix-shell""'
A derivation is little more than an attribute set with the name type
having the value "derivation"
. (Whether such a set can be used as a derivation is meant to be used is another matter.) The Nix repl recognizes all such sets and diplays them in a special way.
> { type = "derivation"; }
«derivation ???»