From dfddcb42b6b9128661b3e037553d0b20240cf91a Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Tue, 27 Jun 2023 20:14:08 -0600 Subject: [PATCH] xin-status: update to show system diff when reboot is needed --- bins/xin-status.nix | 7 ++++++- flake.lock | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bins/xin-status.nix b/bins/xin-status.nix index bbc054b..d0861df 100644 --- a/bins/xin-status.nix +++ b/bins/xin-status.nix @@ -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; '' diff --git a/flake.lock b/flake.lock index 0ebc255..50e1853 100644 --- a/flake.lock +++ b/flake.lock @@ -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": {