1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-07-30 13:47:46 +00:00

nix: add nufetch.nu (#963)

Adds nufetch, a simple neofetch/hyfetch alternative
This commit is contained in:
Schweber 2024-09-30 12:45:33 +00:00 committed by GitHub
parent e10ffbaaa7
commit 7211896e27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 0 deletions

View file

@ -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 │
╰──────────┴───────────────────────────────────╯
```

8
modules/nix/nufetch.nu Normal file
View file

@ -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
}
}