mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
nixos-version --json: Use builtins.toJSON
This commit is contained in:
parent
f9392f04ae
commit
b98ea45608
2 changed files with 8 additions and 1 deletions
|
@ -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