Changed . token to _dot

This change allows the dotfiles to work with chezmoi (e.g: on windows)
and improves grepability with neovim/telescope
This commit is contained in:
2024-11-07 13:52:17 +00:00
parent 83b02bd753
commit 896af887ca
2351 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
# Nix
Commands for working with [nix/nixos](https://nixos.org/).
### ns
Shorthand search (`nix search nixpkgs ...`) with much nicer output.
```shell
> nix search nixpkgs diesel
* legacyPackages.x86_64-linux.diesel-cli (2.1.0)
Database tool for working with Rust projects that use Diesel
* legacyPackages.x86_64-linux.diesel-cli-ext (0.3.13)
Provides different tools for projects using the diesel_cli
```
```shell
> ns diesel
╭───┬────────────────┬──────────────────────────────────────────────────────────────┬─────────╮
# │ package │ description │ version │
├───┼────────────────┼──────────────────────────────────────────────────────────────┼─────────┤
0 │ diesel-cli │ Database tool for working with Rust projects that use Diesel │ 2.1.0 │
1 │ diesel-cli-ext │ Provides different tools for projects using the diesel_cli │ 0.3.13 │
├───┼────────────────┼──────────────────────────────────────────────────────────────┼─────────┤
# │ package │ description │ version │
╰───┴────────────────┴──────────────────────────────────────────────────────────────┴─────────╯
```
### activation-script
Shows changed packages after running `nixos-rebuild switch/boot` and change in total size of installed packages. Changes that don't affect the installed size are filtered out. Intended to be added to `configuration.nix` of `NixOS`.
```
╭────┬──────────────────┬───────────────────────┬────────┬────────────╮
│ # │ Package │ Old │ New │ Diff │
├────┼──────────────────┼───────────────────────┼────────┼────────────┤
│ 0 │ nushell │ 0.94.1 │ 0.95.0 │ 192.1 KiB │
│ 1 │ hyprland │ 0.41.1 │ 0.41.2 │ 52.9 KiB │
│ 2 │ qtdeclarative │ 6.7.1 │ 6.7.2 │ 36.2 KiB │
│ 3 │ linux │ 6.9.6 │ 6.9.7 │ 17.7 KiB │
│ 4 │ qtbase │ 6.7.1 │ 6.7.2 │ 16.1 KiB │
│ 5 │ networkmanager │ 1.48.0 │ 1.48.2 │ 8.3 KiB │
│ 6 │ wireplumber │ 0.5.3 │ 0.5.4 │ -21.4 KiB │
│ 7 │ libbacktrace │ 0-unstable-2024-03-02 │ ∅ │ -110.4 KiB │
│ 8 │ woff2 │ 1.0.2 │ ∅ │ -155.5 KiB │
│ 9 │ libmanette │ 0.2.7 │ ∅ │ -226.0 KiB │
│ 10 │ webkitgtk │ 2.44.2+abi=6.0 │ ∅ │ -147.6 MiB │
│ 11 │ telegram-desktop │ 5.1.8 │ ∅ │ -219.4 MiB │
│ 12 │ │ │ │ │
│ 13 │ │ │ Total: │ -367.2 MiB │
╰────┴──────────────────┴───────────────────────┴────────┴────────────╯
```
### 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 │
╰──────────┴───────────────────────────────────╯
```

View File

@@ -0,0 +1,10 @@
### add to configuration.nix
nix.settings.experimental-features = ["nix-command"];
system.activationScripts.diff = ''
if [[ -e /run/current-system ]]; then
${pkgs.nushell}/bin/nu -c "let diff_closure = (${pkgs.nix}/bin/nix store diff-closures /run/current-system '$systemConfig'); let table = (\$diff_closure | lines | where \$it =~ KiB | where \$it =~ → | parse -r '^(?<Package>\S+): (?<Old>[^,]+)(?:.*) → (?<New>[^,]+)(?:.*), (?<DiffBin>.*)$' | insert Diff { get DiffBin | ansi strip | into filesize } | sort-by -r Diff | reject DiffBin); if (\$table | get Diff | is-not-empty) { print \"\"; \$table | append [[Package Old New Diff]; [\"\" \"\" \"\" \"\"]] | append [[Package Old New Diff]; [\"\" \"\" \"Total:\" (\$table | get Diff | math sum) ]] | print; print \"\" }"
fi
'';

View File

@@ -0,0 +1,18 @@
# Search nixpkgs and provide table output
export def ns [
term: string # Search target.
] {
let info = (
sysctl -n kernel.arch kernel.ostype
| lines
| {arch: ($in.0|str downcase), ostype: ($in.1|str downcase)}
)
nix search --json nixpkgs $term
| from json
| transpose package description
| flatten
| select package description version
| update package {|row| $row.package | str replace $"legacyPackages.($info.arch)-($info.ostype)." ""}
}

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