2024-10-19 02:16:31 +02:00
|
|
|
with import <nixpkgs> {};
|
|
|
|
|
|
|
|
pkgs.writeShellScriptBin "nixos-edit" ''
|
|
|
|
#!/bin/sh
|
|
|
|
|
2024-10-19 02:39:35 +02:00
|
|
|
if [ "$1" = "init" ] ; then
|
|
|
|
sudo chown -R tudbut: /etc/nixos
|
|
|
|
echo dir setup done
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2024-10-19 02:16:31 +02:00
|
|
|
cd /etc/nixos
|
|
|
|
if [ "$1" = "pull" ] ; then
|
|
|
|
git pull
|
|
|
|
fi
|
|
|
|
if [ "$1" = "edit" ] || [ "$1" = "" ] ; then
|
|
|
|
sudo hx .
|
|
|
|
git add .
|
|
|
|
EDITOR=hx git commit -a
|
|
|
|
git push
|
|
|
|
fi
|
|
|
|
if [ "$1" = "update" ] ; then
|
|
|
|
git push
|
|
|
|
sudo nixos-rebuild switch --upgrade
|
|
|
|
else
|
|
|
|
sudo nixos-rebuild switch
|
|
|
|
fi
|
|
|
|
''
|
|
|
|
|