NOflake/users/tao/nushell/extras/nix.nu

53 lines
1.4 KiB
Text
Raw Normal View History

2025-02-20 14:55:55 -08:00
alias nd = nix develop
2025-03-06 00:20:30 -08:00
2025-04-01 13:27:41 -07:00
def ns [...packages: string] {
let packages = $packages | each {$"nixpkgs#($in)"}
nix shell ...$packages
2025-02-20 14:55:55 -08:00
}
2025-03-06 00:20:30 -08:00
2025-03-14 18:07:44 -07:00
# def nr [package] {
# nix search nixpkgs $package
# }
2025-02-20 14:55:55 -08:00
2025-03-14 18:07:44 -07:00
def rebuild [subcommand, --builders: string] {
2025-03-06 17:05:34 -08:00
mut builders = $builders;
2025-02-20 14:55:55 -08:00
if (open /etc/hostname --raw) == "NOlaptop\n" and ($builders != "") {
2025-03-06 17:05:34 -08:00
if (ping -c1 -W1 nocomputer | complete | $in.exit_code == 0) {
sudo nix store info --store ssh://nocomputer
} else {
$builders = ""
}
2025-02-20 14:55:55 -08:00
}
if ($builders == "") {
2025-03-14 18:07:44 -07:00
sudo systemd-inhibit nice -n19 nixos-rebuild $subcommand --flake . --impure --verbose --builders "" --log-format internal-json o+e>| nom --json
2025-02-20 14:55:55 -08:00
} else {
2025-03-14 18:07:44 -07:00
sudo systemd-inhibit nice -n19 nixos-rebuild $subcommand --flake . --impure --verbose --log-format internal-json o+e>| nom --json
2025-02-20 14:55:55 -08:00
}
toastify send rebuild done!
}
2025-03-06 00:20:30 -08:00
2025-02-20 14:55:55 -08:00
def post-rebuild [] {
rm -r ~/.config/helix/runtime/grammars/
hx --grammar fetch; hx --grammar build
rustup update
}
2025-03-06 00:20:30 -08:00
2025-03-14 18:07:44 -07:00
def bump [...rest] {
2025-02-20 14:55:55 -08:00
cd /home/tao/projects/NOflake/
2025-03-27 12:06:17 -07:00
mut r = "@"
if (jj log -r @ --no-pager --no-graph --template 'if(empty,"empty")' | $in == "empty") {
$r = "@-"
}
jj new -m "bump" -r $r
2025-02-20 14:55:55 -08:00
nix flake update
# rc2nix | save -f /home/tao/projects/NOflake/users/tao/plasma.nix;
# sudo nix store ping --store ssh://nocomputer
2025-03-14 18:07:44 -07:00
rebuild boot
2025-02-20 14:55:55 -08:00
jj new
}
2025-03-06 00:20:30 -08:00
2025-02-20 14:55:55 -08:00
alias rb = rebuild boot
alias rs = rebuild switch
alias gc = nh clean all