mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 09:53:10 +00:00
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 New Issue
Block a user