From a649086767928e5c3f3f10c552d6baf951c08e50 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 13 Apr 2018 12:25:38 +0200 Subject: Refine rebuild-system --- rebuild-system | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'rebuild-system') diff --git a/rebuild-system b/rebuild-system index 8f116e3..cd99ae5 100644 --- a/rebuild-system +++ b/rebuild-system @@ -1,11 +1,12 @@ -#!/usr/bin/env bash +#!@zsh@/bin/zsh -if [[ "$USER" != "root" ]]; then +set -o errexit + +if [[ $(whoami) != "root" ]]; then exec sudo -- $0 $@ fi -path=/etc/nixos +configPath=$(nix-instantiate --eval --expr '') -git -C $path pull && \ - git -C $path submodule update && \ - nixos-rebuild $@ +@git@/bin/git -C ${configPath:h} pull +nixos-rebuild $@ -- cgit v1.2.3