lift sane-battery-estimate out of conky, rename to sane-sysinfo

This commit is contained in:
Colin 2024-06-15 06:52:54 +00:00
parent a78b840215
commit aafcf7b478
6 changed files with 21 additions and 16 deletions

View File

@ -1,36 +1,24 @@
{ pkgs, ... }:
{
sane.programs.sane-battery-estimate = {
packageUnwrapped = pkgs.static-nix-shell.mkBash {
pname = "sane-battery-estimate";
srcRoot = ./.;
};
sandbox.method = "bwrap";
sandbox.extraPaths = [
"/sys/class/power_supply"
"/sys/devices"
];
};
sane.programs.conky = {
sandbox.method = "bwrap";
sandbox.net = "clearnet"; #< for the scripts it calls (weather)
sandbox.extraPaths = [
"/sys/class/power_supply"
"/sys/devices" # needed by battery_estimate
"/sys/devices" # needed by sane-sysinfo
# "/sys/devices/cpu"
# "/sys/devices/system"
];
sandbox.whitelistWayland = true;
suggestedPrograms = [
"sane-battery-estimate"
"sane-sysinfo"
"sane-weather"
];
fs.".config/conky/conky.conf".symlink.target = pkgs.substituteAll {
src = ./conky.conf;
bat = "sane-battery-estimate";
bat = "sane-sysinfo";
weather = "timeout 20 sane-weather";
};

View File

@ -114,6 +114,7 @@
./sane-open.nix
./sane-screenshot.nix
./sane-scripts.nix
./sane-sysinfo.nix
./sane-theme.nix
./sanebox.nix
./schlock.nix

View File

@ -0,0 +1,10 @@
{ ... }:
{
sane.programs.sane-sysinfo = {
sandbox.method = "bwrap";
sandbox.extraPaths = [
"/sys/class/power_supply"
"/sys/devices"
];
};
}

View File

@ -0,0 +1,5 @@
{ static-nix-shell }:
static-nix-shell.mkBash {
pname = "sane-sysinfo";
srcRoot = ./.;
}

View File

@ -2,7 +2,7 @@
#!nix-shell -i bash
usage() {
echo "usage: battery_estimate [options...]"
echo "usage: sane-sysinfo [options...]"
echo
echo "pretty-prints a battery estimate (icon to indicate state, and a duration estimate)"
echo

View File

@ -84,6 +84,7 @@ let
sane-open = callPackage ./additional/sane-open { };
sane-screenshot = callPackage ./additional/sane-screenshot { };
sane-scripts = lib.recurseIntoAttrs (callPackage ./additional/sane-scripts { });
sane-sysinfo = callPackage ./additional/sane-sysinfo { };
sane-weather = callPackage ./additional/sane-weather { };
sanebox = callPackage ./additional/sanebox { };
schlock = callPackage ./additional/schlock { };