Maybe my system will stop freezing during rebuilds

This commit is contained in:
Emmet 2023-08-24 16:30:38 -05:00
parent b1e8f4efa4
commit ca9a4e5820
2 changed files with 6 additions and 4 deletions

View file

@ -46,14 +46,14 @@ let
pushd ''+dotfilesDir+'' &> /dev/null; pushd ''+dotfilesDir+'' &> /dev/null;
if [ "$1" = "verbose" ]; then if [ "$1" = "verbose" ]; then
echo "Syncing system configuration (stack traces will be shown):" echo "Syncing system configuration (stack traces will be shown):"
sudo nixos-rebuild switch --flake .#system --show-trace; sudo systemd-run --no-ask-password --uid=0 --system --scope -p MemoryLimit=16000M -p CPUQuota=60% nixos-rebuild switch --flake .#system --show-trace;
else else
sudo bash -c ' sudo bash -c '
RED="\033[0;31m"; RED="\033[0;31m";
GREEN="\033[0;32m"; GREEN="\033[0;32m";
NC="\033[0m" NC="\033[0m"
FRAMES="/ | \\ -"; FRAMES="/ | \\ -";
nixos-rebuild switch --flake .#system &> /dev/null & systemd-run --no-ask-password --uid=0 --system --scope -p MemoryLimit=16000M -p CPUQuota=60% nixos-rebuild switch --flake .#system &> /dev/null &
pid=$!; pid=$!;
while ps -p $pid > /dev/null; while ps -p $pid > /dev/null;
do do
@ -85,13 +85,13 @@ let
if [ "$1" = "verbose" ]; then if [ "$1" = "verbose" ]; then
echo "Syncing user configuration (stack traces will be shown):" echo "Syncing user configuration (stack traces will be shown):"
echo "Running home-manager switch --flake .#user --show-trace" echo "Running home-manager switch --flake .#user --show-trace"
home-manager switch --flake .#user --show-trace; systemd-run --no-ask-password --uid=1000 --user --scope -p MemoryLimit=16000M -p CPUQuota=60% home-manager switch --flake .#user --show-trace;
which xmobar &> /dev/null && echo "Killing old xmobar instances" && echo "Running killall xmobar" && killall xmobar &> /dev/null; which xmobar &> /dev/null && echo "Killing old xmobar instances" && echo "Running killall xmobar" && killall xmobar &> /dev/null;
which xmonad &> /dev/null && echo "Recompiling xmonad" && echo "Running xmonad --recompile && xmonad --restart" && xmonad --recompile && xmonad --restart; which xmonad &> /dev/null && echo "Recompiling xmonad" && echo "Running xmonad --recompile && xmonad --restart" && xmonad --recompile && xmonad --restart;
which emacsclient &> /dev/null && echo "Reloading emacs stylix theme" && echo "Running emacsclient --no-wait --eval \"(load-theme 'doom-stylix t nil)\"" && emacsclient --no-wait --eval "(load-theme 'doom-stylix t nil)"; which emacsclient &> /dev/null && echo "Reloading emacs stylix theme" && echo "Running emacsclient --no-wait --eval \"(load-theme 'doom-stylix t nil)\"" && emacsclient --no-wait --eval "(load-theme 'doom-stylix t nil)";
[ -f ~/.fehbg-stylix ] &> /dev/null && echo "Reapplying background from stylix via feh" && echo "Running ~/.fehbg-stylix" && ~/.fehbg-stylix; [ -f ~/.fehbg-stylix ] &> /dev/null && echo "Reapplying background from stylix via feh" && echo "Running ~/.fehbg-stylix" && ~/.fehbg-stylix;
else else
home-manager switch --flake .#user &> /dev/null & systemd-run --no-ask-password --uid=1000 --user --scope -p MemoryLimit=16000M -p CPUQuota=60% home-manager switch --flake .#user &> /dev/null &
animate_msg "Syncing user configuration..." animate_msg "Syncing user configuration..."
which xmobar &> /dev/null && killall xmobar &> /dev/null & which xmobar &> /dev/null && killall xmobar &> /dev/null &
which xmonad &> /dev/null && xmonad --recompile &> /dev/null & which xmonad &> /dev/null && xmonad --recompile &> /dev/null &

View file

@ -8,6 +8,8 @@ let
htop = "btm"; htop = "btm";
fd = "fd -Lu"; fd = "fd -Lu";
w3m = "w3m -no-cookie -v"; w3m = "w3m -no-cookie -v";
nixos-rebuild = "systemd-run --no-ask-password --uid=0 --system --scope -p MemoryLimit=16000M -p CPUQuota=60% nixos-rebuild";
home-manager = "systemd-run --no-ask-password --uid=1000 --user --scope -p MemoryLimit=16000M -p CPUQuota=60% home-manager";
}; };
in in
{ {