Compare commits

...

3 commits

Author SHA1 Message Date
eb81a1fedf
feat: count failed units in status
Some checks are pending
Continuous Integration / Checks (push) Waiting to run
2024-12-01 15:16:01 +01:00
dbb636e7df
fix: remove failing units 2024-12-01 14:43:32 +01:00
165c9822b9
chore(flake.lock): Update
Flake lock file updates:

• Updated input 'nixos-generators':
    'github:nix-community/nixos-generators/3280fdde8c8f0276c9f5286ad5c0f433dfa5d56c' (2024-11-21)
  → 'github:nix-community/nixos-generators/098e8b6ff72c86944a8d54b64ddd7b7e6635830a' (2024-11-25)
• Updated input 'nixos-generators/nixlib':
    'github:nix-community/nixpkgs.lib/b9f04e3cf71c23bea21d2768051e6b3068d44734' (2024-11-17)
  → 'github:nix-community/nixpkgs.lib/87b6978992e2eb605732fba842cad0a7e14b2047' (2024-11-24)
• Updated input 'nixos-hardware':
    'github:NixOS/nixos-hardware/672ac2ac86f7dff2f6f3406405bddecf960e0db6' (2024-11-16)
  → 'github:NixOS/nixos-hardware/45348ad6fb8ac0e8415f6e5e96efe47dd7f39405' (2024-11-24)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/9bbcb9a5a7e54369faaced5fb0ddad1fda21b751' (2024-11-22)
  → 'github:NixOS/nixpkgs/d44a276324b63ff7ca4254b7ea51d5bac7eb6c64' (2024-12-01)
• Updated input 'nixpkgs-full':
    'github:NixOS/nixpkgs/057f63b6dc1a2c67301286152eb5af20747a9cb4' (2024-11-16)
  → 'github:NixOS/nixpkgs/62c435d93bf046a5396f3016472e8f7c8e2aed65' (2024-11-30)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/705df92694af7093dfbb27109ce16d828a79155f' (2024-11-22)
  → 'github:numtide/treefmt-nix/6209c381904cab55796c5d7350e89681d3b2a8ef' (2024-11-29)
2024-12-01 14:12:39 +01:00
3 changed files with 42 additions and 57 deletions

36
flake.lock generated
View file

@ -211,11 +211,11 @@
},
"nixlib": {
"locked": {
"lastModified": 1731805462,
"narHash": "sha256-yhEMW4MBi+IAyEJyiKbnFvY1uARyMKJpLUhkczI49wk=",
"lastModified": 1732410305,
"narHash": "sha256-/hxIKRTBsdrnudJWDGaBN8wIjHovqVAVxXdi8ByVtck=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "b9f04e3cf71c23bea21d2768051e6b3068d44734",
"rev": "87b6978992e2eb605732fba842cad0a7e14b2047",
"type": "github"
},
"original": {
@ -232,11 +232,11 @@
]
},
"locked": {
"lastModified": 1732151224,
"narHash": "sha256-5IgpueM8SGLOadzUJK6Gk37zEBXGd56BkNOtoWmnZos=",
"lastModified": 1732496924,
"narHash": "sha256-/MNhZLR0eh9z/d3l+ammq+F5XxHln0RHgO4Bhtjr0IM=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "3280fdde8c8f0276c9f5286ad5c0f433dfa5d56c",
"rev": "098e8b6ff72c86944a8d54b64ddd7b7e6635830a",
"type": "github"
},
"original": {
@ -247,11 +247,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1731797098,
"narHash": "sha256-UhWmEZhwJZmVZ1jfHZFzCg+ZLO9Tb/v3Y6LC0UNyeTo=",
"lastModified": 1732483221,
"narHash": "sha256-kF6rDeCshoCgmQz+7uiuPdREVFuzhIorGOoPXMalL2U=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "672ac2ac86f7dff2f6f3406405bddecf960e0db6",
"rev": "45348ad6fb8ac0e8415f6e5e96efe47dd7f39405",
"type": "github"
},
"original": {
@ -263,11 +263,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1732237847,
"narHash": "sha256-WwtrPxym9sQtwZkemxUfT00iCWfXxzuVAC7uFP1m1Y0=",
"lastModified": 1733040108,
"narHash": "sha256-x48Dv2n8d0Ebk0Pp6qk5TW4b+oUfkOpl16ick+npjD0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9bbcb9a5a7e54369faaced5fb0ddad1fda21b751",
"rev": "d44a276324b63ff7ca4254b7ea51d5bac7eb6c64",
"type": "github"
},
"original": {
@ -279,11 +279,11 @@
},
"nixpkgs-full": {
"locked": {
"lastModified": 1731755305,
"narHash": "sha256-v5P3dk5JdiT+4x69ZaB18B8+Rcu3TIOrcdG4uEX7WZ8=",
"lastModified": 1732981179,
"narHash": "sha256-F7thesZPvAMSwjRu0K8uFshTk3ZZSNAsXTIFvXBT+34=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "057f63b6dc1a2c67301286152eb5af20747a9cb4",
"rev": "62c435d93bf046a5396f3016472e8f7c8e2aed65",
"type": "github"
},
"original": {
@ -332,11 +332,11 @@
]
},
"locked": {
"lastModified": 1732292307,
"narHash": "sha256-5WSng844vXt8uytT5djmqBCkopyle6ciFgteuA9bJpw=",
"lastModified": 1732894027,
"narHash": "sha256-2qbdorpq0TXHBWbVXaTqKoikN4bqAtAplTwGuII+oAc=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "705df92694af7093dfbb27109ce16d828a79155f",
"rev": "6209c381904cab55796c5d7350e89681d3b2a8ef",
"type": "github"
},
"original": {

View file

@ -5,6 +5,7 @@ import sys
import time
import requests
import logging
import subprocess
from datetime import datetime
@ -25,7 +26,7 @@ class Cat(Status):
catwalk = " " * (cat_width - index) + 1 * "🐈🏳️‍🌈" + " " * index
self.index = (index + 1) % cat_width
return catwalk
return {"full_text": catwalk}
class Space(Status):
@ -37,7 +38,7 @@ class Space(Status):
if self.backoff == 0:
self.update()
return self.c_status
return {"full_text": self.c_status}
def update(self):
spacestatus_url = "https://status.stratum0.org/status.json"
@ -65,12 +66,26 @@ class Battery(Status):
battery = f"{status} {capacity}%"
return battery
return {"full_text": battery}
class Time(Status):
def status(state):
return datetime.now().strftime("%Vth %A %H:%M")
def status(self):
return {"full_text": datetime.now().strftime("%Vth %A %H:%M") }
class FailedUnits(Status):
def status(self):
proc = subprocess.run(["systemctl", "list-units", "--failed"], capture_output = True)
stdout = proc.stdout.decode('utf-8')
failed = 0
for line in stdout:
if 'failed' in line:
failed += 1
if failed is 0:
return {"full_text": f"No failed units"}
else:
return {"full_text": f"There are {failed} failed units", "color": "#ff0000"}
def print_header():
@ -94,7 +109,7 @@ def run(interval, widgets):
except Exception as e:
logger.error(e)
if status:
body += {"full_text": f"{status}"},
body += status,
print(json.dumps(body), ",", flush=True)
@ -108,6 +123,6 @@ if __name__ == "__main__":
# Interval in seconds
interval = 1.0
widgets = [Cat(), Space(), Battery(), Time()]
widgets = [Cat(), FailedUnits(), Space(), Battery(), Time()]
run(interval, widgets)

View file

@ -34,6 +34,8 @@ in
./hardware-configuration.nix
];
dadada.backupClient.bs.enable = false;
dadada.backupClient.backup1.enable = true;
dadada.backupClient.backup2 = {
enable = true;
passphrasePath = config.age.secrets."${config.networking.hostName}-backup-passphrase".path;
@ -178,38 +180,6 @@ in
"127.0.0.2" = [ "kanboard.dadada.li" ];
};
# https://lists.zx2c4.com/pipermail/wireguard/2017-November/002028.html
systemd.timers.wg-reresolve-dns = {
wantedBy = [ "timers.target" ];
partOf = [ "wg-reresolve-dns.service" ];
timerConfig.OnCalendar = "hourly";
};
systemd.services.wg-reresolve-dns =
let
vpnPubKey = "x/y6I59buVzv9Lfzl+b17mGWbzxU+3Ke9mQNa1DLsDI=";
in
{
serviceConfig.Type = "oneshot";
script = ''
${pkgs.wireguard-tools}/bin/wg set dadada peer ${vpnPubKey} endpoint vpn.dadada.li:51234 persistent-keepalive 25 allowed-ips fd42:9c3b:f96d::/48
'';
};
#networking.wg-quick.interfaces.mullvad = {
# address = [ "10.68.15.202/32" "fc00:bbbb:bbbb:bb01::5:fc9/128" ];
# privateKeyFile = "/var/lib/wireguard/mullvad";
# peers = [
# {
# publicKey = "Ec/wwcosVal9Kjc97ZuTTV7Dy5c0/W5iLet7jrSEm2k=";
# allowedIPs = [ "0.0.0.0/0" "::0/0" ];
# endpoint = "193.27.14.66:51820";
# persistentKeepalive = 25;
# }
# ];
# postUp = "${pkgs.iproute2}/bin/ip rule add to 193.27.14.66 lookup main";
#};
services.gnome.gnome-keyring.enable = lib.mkForce false;
programs.gnupg.agent.enable = true;