rsync to /run instead of /tmp #9

Closed
opened 2022-02-27 10:19:14 +00:00 by MatthewCroughan · 2 comments
MatthewCroughan commented 2022-02-27 10:19:14 +00:00 (Migrated from github.com)

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.

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 2022-02-27 10:24:30 +00:00 (Migrated from github.com)

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.

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 2022-02-27 22:14:17 +00:00 (Migrated from github.com)

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.

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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: tristan/nixinate#9
No description provided.