2022-10-26 16:16:34 -06:00
|
|
|
{ perl, perlPackages, ... }:
|
|
|
|
|
|
|
|
''
|
|
|
|
#!${perl}/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
2023-06-27 20:14:08 -06:00
|
|
|
use MIME::Base64;
|
2022-10-26 16:16:34 -06:00
|
|
|
|
|
|
|
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;
|
2023-06-27 20:14:08 -06:00
|
|
|
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);
|
|
|
|
|
2022-10-26 16:16:34 -06:00
|
|
|
print encode_json $info;
|
|
|
|
''
|