Skip to content

Commit

Permalink
nix: add nufetch.nu
Browse files Browse the repository at this point in the history
  • Loading branch information
Schweber committed Sep 30, 2024
1 parent e10ffba commit 93e4151
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
17 changes: 17 additions & 0 deletions modules/nix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 │
╰──────────┴───────────────────────────────────╯
```
10 changes: 10 additions & 0 deletions modules/nix/nufetch.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export def main [] {

{
"kernel": (uname | get kernel-release),
"nu": (^nu -v),
"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": (open /proc/uptime | parse -r "(.*) " | get capture0.0 | into int | into duration -u sec)
}
}

0 comments on commit 93e4151

Please sign in to comment.