From a859ffe3c6aebdd5add93f889c1953ea27175094 Mon Sep 17 00:00:00 2001 From: Schweber <64630479+Schweber@users.noreply.github.com> Date: Mon, 30 Sep 2024 08:17:47 +0000 Subject: [PATCH] nix: add nufetch.nu --- modules/nix/README.md | 17 +++++++++++++++++ modules/nix/nufetch.nu | 8 ++++++++ 2 files changed, 25 insertions(+) create mode 100644 modules/nix/nufetch.nu diff --git a/modules/nix/README.md b/modules/nix/README.md index e603e79e6..b01d04602 100644 --- a/modules/nix/README.md +++ b/modules/nix/README.md @@ -49,3 +49,20 @@ Shows changed packages after running `nixos-rebuild switch/boot` and change in t ╰────┴──────────────────┴───────────────────────┴────────┴────────────╯ ``` +### nufetch + +nu alternative to `neofetch`/`hyfetch`. +``` +╭──────────┬───────────────────────────────────╮ +│ kernel │ 6.11.0 │ +│ nu │ 0.98.0 │ +│ │ ╭─────────────┬────────┬────────╮ │ +│ packages │ │ environment │ number │ size │ │ +│ │ ├─────────────┼────────┼────────┤ │ +│ │ │ system │ 825 │ 5.7 GB │ │ +│ │ │ sperber │ 352 │ 1.5 GB │ │ +│ │ │ steam │ 929 │ 5.4 GB │ │ +│ │ ╰─────────────┴────────┴────────╯ │ +│ uptime │ 3hr 1min 18sec │ +╰──────────┴───────────────────────────────────╯ +``` diff --git a/modules/nix/nufetch.nu b/modules/nix/nufetch.nu new file mode 100644 index 000000000..4a35c0595 --- /dev/null +++ b/modules/nix/nufetch.nu @@ -0,0 +1,8 @@ +export def main [] { +{ +"kernel": $nu.os-info.kernel_version, +"nu": $env.NU_VERSION, +"packages": (ls /etc/profiles/per-user | select name | prepend [[name];["/run/current-system/sw"]] | each { insert "number" (nix path-info --recursive ($in | get name) | lines | length) | insert "size" ( nix path-info -S ($in | get name) | parse -r '\s(.*)' | get capture0.0 | into filesize) | update "name" ($in | get name | parse -r '.*/(.*)' | get capture0.0 | if $in == "sw" {"system"} else {$in}) | rename "environment"}), +"uptime": (sys host).uptime +} +}