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 warnings;
use Data::Dumper;
use MIME::Base64;
use lib "${perlPackages.JSON}/${perl.libPrefix}/${perl.version}/";
use JSON qw{ decode_json encode_json };
my $info = decode_json(`nixos-version --json`);
$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;
''

6
flake.lock generated
View File

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