nixos-version --json: Use builtins.toJSON
This commit is contained in:
parent
f9392f04ae
commit
b98ea45608
|
@ -10,7 +10,7 @@ case "$1" in
|
|||
;;
|
||||
--json)
|
||||
cat <<EOF
|
||||
{"nixosVersion": "@version@", "nixpkgsRevision": "@revision@", "configurationRevision": "@configurationRevision@"}
|
||||
@json@
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
|
|
|
@ -49,6 +49,13 @@ let
|
|||
src = ./nixos-version.sh;
|
||||
inherit (config.system.nixos) version codeName revision;
|
||||
inherit (config.system) configurationRevision;
|
||||
json = builtins.toJSON ({
|
||||
nixosVersion = config.system.nixos.version;
|
||||
} // optionalAttrs (config.system.nixos.revision != null) {
|
||||
nixpkgsRevision = config.system.nixos.revision;
|
||||
} // optionalAttrs (config.system.configurationRevision != null) {
|
||||
configurationRevision = config.system.configurationRevision;
|
||||
});
|
||||
};
|
||||
|
||||
nixos-enter = makeProg {
|
||||
|
|
Loading…
Reference in a new issue