Rice laptop
Some checks failed
pre-commit / pre-commit (push) Failing after 23s
pre-commit / pre-commit (pull_request) Failing after 14m39s

This commit is contained in:
2024-04-21 11:46:33 +02:00
parent 8d151534b1
commit e1049f0a16
16 changed files with 312 additions and 19 deletions

View File

@@ -1,4 +1,15 @@
{ pkgs, lib, ... }: {
{ pkgs, lib, ... }:
let
flakestat = pkgs.writeShellApplication {
name = "flakestat";
runtimeInputs = with pkgs; [
git
jq
];
text = builtins.readFile ./flakestat.sh;
};
in
{
xdg.configFile."waybar/macchiato.css" = {
source = pkgs.fetchFromGitHub
{
@@ -96,6 +107,7 @@
#network,
#battery,
#custom-powermenu,
#custom-flakestat,
#custom-cava-internal {
padding-left: 10px;
padding-right: 10px;
@@ -143,7 +155,7 @@
modules-left = [ "custom/launcher" "hyprland/workspaces" ];
modules-center = [ "clock" ];
modules-right =
[ "pulseaudio" "pulseaudio#microphone" "memory" "cpu" "tray" ];
[ "custom/flakestat" "pulseaudio" "pulseaudio#microphone" "memory" "cpu" "tray" "battery" ];
"custom/launcher" = {
"format" = " ";
"on-click" = "pkill rofi || ~/.config/rofi/launcher.sh";
@@ -190,6 +202,25 @@
"icon-size" = 15;
"spacing" = 6;
};
"battery" = {
"interval" = 60;
"states" = {
"warning" = 20;
"critical" = 5;
};
"format" = "{icon} {capacity}%";
"format-icons" = [
""
""
""
""
""
];
};
"custom/flakestat" = {
"exec" = "${flakestat}/bin/flakestat";
"interval" = 600;
};
}];
};
}

View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
FLAKE_DIR="/home/torjus/nixos"
NIXPKGS_DIR="/home/torjus/git/nixpkgs"
flake_metadata=$(nix flake metadata --json "$FLAKE_DIR" 2>/dev/null)
stable_input=$(echo "$flake_metadata" | jq '.locks.nodes.root.inputs.nixpkgs')
stable_rev=$(echo "$flake_metadata" | jq -r ".locks.nodes.$stable_input.locked.rev")
stable_branch=$(echo "$flake_metadata" | jq -r ".locks.nodes.$stable_input.original.ref")
unstable_input=$(echo "$flake_metadata" | jq '.locks.nodes.root.inputs."nixpkgs-unstable"')
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" || exit 1
git fetch -q
git switch -q "$stable_branch"
git pull -q
stable_commit_count=$(git rev-list "$stable_rev..HEAD"|wc -l)
git switch -q "$unstable_branch"
git pull -q
unstable_commit_count=$(git rev-list "$unstable_rev..HEAD"|wc -l)
echo "$stable_commit_count|$unstable_commit_count"

View File

@@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
programs.waybar = {
enable = true;
systemd = {
@@ -133,7 +134,7 @@
modules-left = [ "custom/launcher" "hyprland/workspaces" ];
modules-center = [ "clock" ];
modules-right =
[ "pulseaudio" "pulseaudio#microphone" "memory" "cpu" "tray" ];
[ "pulseaudio" "pulseaudio#microphone" "memory" "cpu" "tray" "battery" ];
"custom/launcher" = {
"format" = " ";
"on-click" = "pkill rofi || ~/.config/rofi/launcher.sh";
@@ -180,6 +181,21 @@
"icon-size" = 15;
"spacing" = 6;
};
"battery" = {
"interval" = 60;
"states" = {
"warning" = 30;
"critical" = 5;
};
"format" = "{icon} {capacity}%";
"format-icons" = [
""
""
""
""
""
];
};
}];
};
}