xin-status: update to show system diff when reboot is needed

This commit is contained in:
Aaron Bieber 2023-06-27 20:14:08 -06:00
parent 1651d36746
commit dfddcb42b6
No known key found for this signature in database
2 changed files with 9 additions and 4 deletions

View File

@ -5,12 +5,17 @@
use strict; use strict;
use warnings; use warnings;
use Data::Dumper; use MIME::Base64;
use lib "${perlPackages.JSON}/${perl.libPrefix}/${perl.version}/"; use lib "${perlPackages.JSON}/${perl.libPrefix}/${perl.version}/";
use JSON qw{ decode_json encode_json }; use JSON qw{ decode_json encode_json };
my $info = decode_json(`nixos-version --json`); my $info = decode_json(`nixos-version --json`);
$info->{needs_restart} = system('check-restart >/dev/null') == 0 ? JSON::false : JSON::true; $info->{needs_restart} = system('check-restart >/dev/null') == 0 ? JSON::false : JSON::true;
my $sys_diff = `nix store diff-closures /run/booted-system /run/current-system`;
$sys_diff =~ s/\e\[[0-9;]*m(?:\e\[K)?//g;
$info->{system_diff} = encode_base64($sys_diff);
print encode_json $info; print encode_json $info;
'' ''

6
flake.lock generated
View File

@ -495,11 +495,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1686054616, "lastModified": 1687918035,
"narHash": "sha256-nBvQL3pSFZTBM0kM+/HVNFNbsa/It+OzQSlgKdIkgAY=", "narHash": "sha256-bSvfoTFaKHJvY0rILLSEdp6qh1A6873HttfEXWhg9DU=",
"owner": "qbit", "owner": "qbit",
"repo": "xintray", "repo": "xintray",
"rev": "04dfd6b23e165c2e5495eeaf2b5ba2818a683bb2", "rev": "249015115c30115f028e856e983a7838dfba2d7e",
"type": "github" "type": "github"
}, },
"original": { "original": {