MatthewCroughan / nixinate

Another NixOS Deployment Tool - Nixinate your systems 🕶️
MIT License
240 stars 32 forks source link

rsync to /run instead of /tmp #9

Closed MatthewCroughan closed 2 years ago

MatthewCroughan commented 2 years ago

On NixOS /tmp is not a tmpfs, so state hangs around. If the nixinate user is changed, it will try to rsync to /tmp/nixinate where it will no longer work since the file was created by a user without the permissions of the last user that performed the deployment. This can be fixed with mktemp -p /run/user/$(id -u). This would make a temporary directory in /run for the current user, which would truly be temporary.

MatthewCroughan commented 2 years ago

This turns out to be tricky, since we need to extract the UID of the remote, as we can't assume UID 1000 for example.

MatthewCroughan commented 2 years ago

Two solutions I've come up with are to move everything to mktemp -p /dev/shm/, or to somehow get Nix to copy the flake into the remote Nix store, such that we don't even need rsync.