added podman and shortcut for nixos rebuilds
This commit is contained in:
44
home/zsh.nix
44
home/zsh.nix
@@ -107,8 +107,12 @@
|
||||
setup = "source ./setup_env.sh";
|
||||
gpuenv = "__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia";
|
||||
digital = "$HOME/Tools/Digital/Digital.sh";
|
||||
nixos_test = "sudo nixos_rebuild test --flake $HOME/NixOS-Configs#hades";
|
||||
nixos_switch = "sudo nixos_rebuild switch --flake $HOME/NixOS-Configs#hades";
|
||||
nixos_test = "rebuild test";
|
||||
nixos_switch = "rebuild switch";
|
||||
"rebuild-switch" = "rebuild switch";
|
||||
"rebuild-test" = "rebuild test";
|
||||
"rebuild-boot" = "rebuild boot";
|
||||
"rebuild-build" = "rebuild build";
|
||||
};
|
||||
|
||||
initContent = lib.mkMerge [
|
||||
@@ -166,6 +170,42 @@
|
||||
fi
|
||||
|
||||
# Custom helper functions
|
||||
rebuild () {
|
||||
local action="''${1:-switch}"
|
||||
shift 2>/dev/null || true
|
||||
|
||||
local config_dir="''${FLAKE_CONFIG:-$HOME/NixOS-Configs}"
|
||||
local host="hades"
|
||||
local target="$config_dir#$host"
|
||||
|
||||
case "$action" in
|
||||
switch|test|boot)
|
||||
echo "==> Running: sudo nixos-rebuild $action --flake $target $*"
|
||||
sudo nixos-rebuild "$action" --flake "$target" "$@"
|
||||
;;
|
||||
build|dry-build|dry-run|dry-activate)
|
||||
local act="$action"
|
||||
[[ "$action" == "dry-run" ]] && act="dry-build"
|
||||
echo "==> Running: nixos-rebuild $act --flake $target $*"
|
||||
nixos-rebuild "$act" --flake "$target" "$@"
|
||||
;;
|
||||
help|-h|--help)
|
||||
echo "Usage: rebuild [switch|test|boot|build|dry-build] [extra nixos-rebuild options]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " switch Build, activate, and make default boot entry (default)"
|
||||
echo " test Build and activate without creating a boot entry"
|
||||
echo " boot Build and make default boot entry without activating"
|
||||
echo " build Build system to ./result without activating or sudo"
|
||||
echo " dry-build Show what would be built/fetched"
|
||||
;;
|
||||
*)
|
||||
echo "==> Running: sudo nixos-rebuild $action --flake $target $*"
|
||||
sudo nixos-rebuild "$action" --flake "$target" "$@"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
perlmutter_pass () {
|
||||
echo -n 'bw master password: '
|
||||
read -s MASTER_PASS
|
||||
|
||||
Reference in New Issue
Block a user