nix-setup/nixos-edit.script.nix

24 lines
372 B
Nix
Raw Normal View History

with import <nixpkgs> {};
pkgs.writeShellScriptBin "nixos-edit" ''
#!/bin/sh
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
''