can someone help me move my /nix to an external drive

long story short: i have a surface tablet with an sd card in it. id like the sd card to hold /nix. i cant seem to rsync without (im guessing the links are expanding) the bigger drive (sdcard) filling up. thank you

6 points · 2 comments · view on lemmy.world

2 Comments

difficult@sh.itjust.works · 5 pts · 143d

rsync has -H flag for preserving hardlinks

FauxLiving@lemmy.world · 4 pts · 143d

Probably rsync -aH would do just fine, but Nix has a tool for this.

https://nix.dev/manual/nix/2.18/command-ref/new-cli/nix3-copy

Their closest direct example is using SSH:

Copy the entire current NixOS system closure to another machine via SSH:

# nix copy --substitute-on-destination --to ssh://server /run/current-system

The -s flag causes the remote machine to try to substitute missing store paths, which may be faster if the link between the local and remote machines is slower than the link between the remote machine and its substituters (e.g. https://cache.nixos.org/).