add test and push mode to nixos-edit
This commit is contained in:
parent
86098a3122
commit
c6e4552e50
1 changed files with 11 additions and 2 deletions
|
@ -9,6 +9,8 @@ pkgs.writeShellScriptBin "nixos-edit" ''
|
|||
echo "supports commands:"
|
||||
echo " - pull -- pulls the changes and switches to them"
|
||||
echo " - edit -- edits the OS, pushes it, and switches"
|
||||
echo " - test -- edits the OS and switches"
|
||||
echo " - push -- commits edits from test and pushes them"
|
||||
echo " - update -- update the system"
|
||||
echo " - init -- initialize the system (only run once)"
|
||||
echo
|
||||
|
@ -72,18 +74,25 @@ pkgs.writeShellScriptBin "nixos-edit" ''
|
|||
exec sudo -iu tudbut nixos-edit $1 || exit 1
|
||||
fi
|
||||
|
||||
[ "$1" = "edit" ] || [ "$1" = "" ] || [ "$1" = "push" ]
|
||||
PUSH=$?
|
||||
|
||||
cd /etc/nixos
|
||||
if [ "$1" = "pull" ] ; then
|
||||
git pull
|
||||
fi
|
||||
if [ "$1" = "edit" ] || [ "$1" = "" ] ; then
|
||||
if [ "$1" = "edit" ] || [ "$1" = "" ] || [ "$1" = "test" ] ; then
|
||||
sudo hx .
|
||||
fi
|
||||
if [ $PUSH = 0 ] ; then
|
||||
git add .
|
||||
EDITOR=hx git commit -a
|
||||
git push
|
||||
if [ "$1" = "push" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
if [ "$1" = "update" ] ; then
|
||||
git push
|
||||
sudo nixos-rebuild switch --upgrade
|
||||
else
|
||||
sudo nixos-rebuild switch
|
||||
|
|
Loading…
Add table
Reference in a new issue