nixos-config/update.sh
Charlotte Van Petegem ad71bb0318
Remove sudo
2021-01-27 16:57:07 +01:00

21 lines
438 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
set -x
if [ -z "${NO_LOCAL:-}" ]
then
pushd ../nixpkgs
git fetch --all --prune
git rebase upstream/nixos-unstable-small || exit 1
git push || exit 1
popd
fi
nix flake update --recreate-lock-file
if [ -z "${OVERRIDE:-}" ]
then
su -c "nixos-rebuild --flake . switch"
else
su -c "nixos-rebuild --flake . --override-input nixpkgs ../nixpkgs --no-write-lock-file switch"
fi