dot

vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks

eb2c84a

backup-to-sata: find nix under sudo

By Gustaf Granström

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

1 file changed +4 −1

@@ -14,6 +14,9 @@
1414 repo=$home/git/dot
1515 wow="$home/Games/battlenet/drive_c/Program Files (x86)/World of Warcraft/_retail_"
1616
17+# sudo's PATH leaves out Nix (installed with the official installer here).
18+export PATH="$PATH:/nix/var/nix/profiles/default/bin"
19+
1720 if [ "$EUID" -ne 0 ]; then
1821 echo "Run it with sudo: sudo $0" >&2
1922 exit 1
@@ -46,7 +49,7 @@
4649 install -d -o "$user" "$mnt/nix-cache" "$mnt/wow"
4750
4851 echo "== Saving the built system and the disko script"
49-sudo -u "$user" bash -euo pipefail -c '
52+sudo -u "$user" env PATH="$PATH" bash -euo pipefail -c '
5053 cd "$1"
5154 sys=$(nix build --no-link --print-out-paths .#nixosConfigurations.desktop.config.system.build.toplevel)
5255 disko=$(nix build --no-link --print-out-paths .#nixosConfigurations.desktop.config.system.build.diskoScript)