23 lines
372 B
Nix
23 lines
372 B
Nix
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
|
|
''
|
|
|