diff --git a/pkgs/default.nix b/pkgs/default.nix index 1336019..ca46574 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -9,6 +9,7 @@ neomutt-export-patches = callPackage ./neomutt-export-patches { }; note-mark = callPackage ./note-mark { }; sway-background-image = callPackage ./sway-background-image.nix { }; + uptime-pretty = callPackage ./uptime-pretty { }; # Pin to older version until # https://github.com/nix-community/home-manager/pull/5918 diff --git a/pkgs/uptime-pretty/default.nix b/pkgs/uptime-pretty/default.nix new file mode 100644 index 0000000..a48c262 --- /dev/null +++ b/pkgs/uptime-pretty/default.nix @@ -0,0 +1,7 @@ +{ coreutils, writeShellApplication }: + +writeShellApplication { + name = "uptime-pretty"; + runtimeInputs = [ coreutils ]; + text = builtins.readFile ./uptime-pretty.sh; +} diff --git a/pkgs/uptime-pretty/uptime-pretty.sh b/pkgs/uptime-pretty/uptime-pretty.sh new file mode 100644 index 0000000..4c7c69f --- /dev/null +++ b/pkgs/uptime-pretty/uptime-pretty.sh @@ -0,0 +1,26 @@ +# shellcheck shell=bash + +HOUR=$((60 * 60)) +DAY=$((HOUR * 24)) +WEEK=$((DAY * 7)) + +raw=$(cut -d' ' -f1