29 lines
472 B
Nix
29 lines
472 B
Nix
with import <nixpkgs> {};
|
|
|
|
pkgs.writeShellScriptBin "nixos-edit" ''
|
|
#!/bin/sh
|
|
|
|
if [ "$1" = "init" ] ; then
|
|
sudo chown -R tudbut: /etc/nixos
|
|
echo dir setup done
|
|
exit 0
|
|
fi
|
|
|
|
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
|
|
''
|
|
|