waybar: remove flakestat script
Some checks failed
Run nix flake check / flake-check (push) Failing after 42s
Some checks failed
Run nix flake check / flake-check (push) Failing after 42s
This commit is contained in:
@@ -5,14 +5,6 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
flakestat = pkgs.writeShellApplication {
|
||||
name = "flakestat";
|
||||
runtimeInputs = with pkgs; [
|
||||
git
|
||||
jq
|
||||
];
|
||||
text = builtins.readFile ./flakestat.sh;
|
||||
};
|
||||
arrhist = pkgs.stdenv.mkDerivation {
|
||||
name = "arrhist";
|
||||
propagatedBuildInputs = [
|
||||
@@ -145,7 +137,6 @@ in
|
||||
#network,
|
||||
#battery,
|
||||
#custom-powermenu,
|
||||
#custom-flakestat,
|
||||
#custom-arrhist {
|
||||
padding-left: 12px;
|
||||
padding-right: 12px;
|
||||
@@ -167,7 +158,6 @@ in
|
||||
{
|
||||
"layer" = "top";
|
||||
"position" = "top";
|
||||
modules-left = [ "custom/flakestat" ];
|
||||
modules-center = [ "hyprland/workspaces" ];
|
||||
modules-right = [
|
||||
(lib.mkIf (withArrhist) "custom/arrhist")
|
||||
@@ -245,12 +235,6 @@ in
|
||||
""
|
||||
];
|
||||
};
|
||||
"custom/flakestat" = {
|
||||
"exec" = "${flakestat}/bin/flakestat";
|
||||
"format" = " {}";
|
||||
"return-type" = "json";
|
||||
"interval" = 600;
|
||||
};
|
||||
}
|
||||
// lib.optionalAttrs (withArrhist) {
|
||||
"custom/arrhist" = {
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
# Args:
|
||||
# $1 text
|
||||
# $2 tooltip
|
||||
# $3 error-code
|
||||
print_output() {
|
||||
local text="$1"
|
||||
local tooltip="$2"
|
||||
local error_code="$3"
|
||||
|
||||
if [ -z "$error_code" ]; then
|
||||
output=$(jq -n \
|
||||
--arg text "$text" \
|
||||
--arg tooltip "$tooltip" \
|
||||
--unbuffered \
|
||||
--compact-output \
|
||||
'{text: $text, tooltip: $tooltip}')
|
||||
else
|
||||
output=$(jq -n \
|
||||
--arg text "$text" \
|
||||
--arg tooltip "$tooltip" \
|
||||
--unbuffered \
|
||||
--compact-output \
|
||||
'{text: $text, tooltip: $tooltip}')
|
||||
fi
|
||||
|
||||
echo "$output"
|
||||
}
|
||||
|
||||
FLAKE_DIR="/home/torjus/nixos"
|
||||
NIXPKGS_DIR="/home/torjus/git/nixpkgs"
|
||||
|
||||
flake_metadata=$(nix flake metadata --json "$FLAKE_DIR" 2>/dev/null)
|
||||
|
||||
unstable_input=$(echo "$flake_metadata" | jq '.locks.nodes.root.inputs.nixpkgs')
|
||||
unstable_rev=$(echo "$flake_metadata" | jq -r ".locks.nodes.$unstable_input.locked.rev")
|
||||
unstable_branch=$(echo "$flake_metadata" | jq -r ".locks.nodes.$unstable_input.original.ref")
|
||||
|
||||
cd "$NIXPKGS_DIR" || print_output "?" "Could not find git repo dir" 1
|
||||
if ! git fetch -q --all; then
|
||||
print_output "?" "Unable to fetch commits" 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! unstable_commit_count=$(git rev-list --count "$unstable_rev..origin/$unstable_branch"); then
|
||||
print_output "?" "Unable to list commits" 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
text="$unstable_commit_count"
|
||||
tooltip="${unstable_branch}: ${unstable_commit_count}"
|
||||
|
||||
print_output "$text" "$tooltip" 0
|
||||
Reference in New Issue
Block a user