bins: add xin-status for single shot status over ssh
This commit is contained in:
parent
7067e9b9a5
commit
c379b6237f
@ -5,6 +5,8 @@ let
|
||||
ix = pkgs.writeScriptBin "ix" (import ./ix.nix { inherit (pkgs) perl; });
|
||||
checkRestart = pkgs.writeScriptBin "check-restart"
|
||||
(import ./check-restart.nix { inherit (pkgs) perl; });
|
||||
xinStatus = pkgs.writeScriptBin "xin-status"
|
||||
(import ./xin-status.nix { inherit (pkgs) perl perlPackages; });
|
||||
|
||||
sfetch = pkgs.writeScriptBin "sfetch" (import ./sfetch.nix {
|
||||
inherit gosignify;
|
||||
@ -12,7 +14,13 @@ let
|
||||
});
|
||||
|
||||
in {
|
||||
environment.systemPackages = with pkgs; [ ix sfetch xclip checkRestart ];
|
||||
environment.systemPackages = with pkgs; [
|
||||
ix
|
||||
sfetch
|
||||
xclip
|
||||
checkRestart
|
||||
xinStatus
|
||||
];
|
||||
environment.etc = {
|
||||
"signify/openbsd-72-base.pub".text =
|
||||
builtins.readFile ./pubs/openbsd-72-base.pub;
|
||||
|
16
bins/xin-status.nix
Normal file
16
bins/xin-status.nix
Normal file
@ -0,0 +1,16 @@
|
||||
{ perl, perlPackages, ... }:
|
||||
|
||||
''
|
||||
#!${perl}/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Data::Dumper;
|
||||
|
||||
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;
|
||||
print encode_json $info;
|
||||
''
|
Loading…
Reference in New Issue
Block a user