Skip to content

Commit

Permalink
home.nix: use --use-remote-sudo for nixos-rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerschtli committed Aug 25, 2024
1 parent 945375c commit 5d71277
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion home/development/nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ in
inherit nixConfigDir;
buildCmd = "${buildWithDiff
"n-rebuild-build"
"sudo nix build --log-format internal-json --verbose \"${nixConfigDir}#nixosConfigurations.$(hostname).config.system.build.toplevel\" |& nom --json"
"nix build --log-format internal-json --verbose \"${nixConfigDir}#nixosConfigurations.$(hostname).config.system.build.toplevel\" |& nom --json"
"/nix/var/nix/profiles/system"
}/bin/n-rebuild-build";
_doNotClearPath = true;
Expand Down
4 changes: 2 additions & 2 deletions home/development/nix/n-rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ _usage() {
echo "$0 <debug|dev|boot|build|test|switch>"
}

args=(--flake "@nixConfigDir@")
args=(--use-remote-sudo --flake "@nixConfigDir@")
case "${mode}" in
debug) args+=(test --fast --show-trace) ;;
dev) args+=(test --fast) ;;
Expand All @@ -23,7 +23,7 @@ esac

before_date=$(date +"%Y-%m-%d %H:%M:%S")

sudo nixos-rebuild "${args[@]}"; result=$?
nixos-rebuild "${args[@]}"; result=$?

for user in root tobias; do
echo
Expand Down
4 changes: 2 additions & 2 deletions home/misc/util-bins/system-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ _pull_changes "pass" "${HOME}/.password-store"
# TODO: use scripts defined in home/development/nix
if _is_nixos; then
_log "nix" "build nixos configuration"
sudo nix build --log-format internal-json --verbose "${nix_config}#nixosConfigurations.$(hostname).config.system.build.toplevel" |& nom --json
nix build --log-format internal-json --verbose "${nix_config}#nixosConfigurations.$(hostname).config.system.build.toplevel" |& nom --json
_show_result_diff "/nix/var/nix/profiles/system"

_log "nix" "switch nixos configuration"
sudo nixos-rebuild switch --flake "${nix_config}"
nixos-rebuild switch --use-remote-sudo --flake "${nix_config}"
fi

if [[ "${USER}" == "nix-on-droid" ]] && _available nix-on-droid; then
Expand Down

0 comments on commit 5d71277

Please sign in to comment.