nix-community / impermanence

Modules to help you handle persistent state on systems with ephemeral root storage [maintainer=@talyz]
MIT License
1.03k stars 77 forks source link

Mount already exists, ignoring #96

Open clownhelmet opened 2 years ago

clownhelmet commented 2 years ago

I have impermanence installed as a NixOS module.

When I try to persist files inside arbitrary folders in ~, they get initially linked after nixos-rebuild switch, but disappear after a reboot.

Relevant config:

environment.persistence."/persist" = {
      users.myUsername = {
        files = [
          ".zsh/TESTING"
        ];

I create the file /persist/home/myUsername/.zsh/TESTING, and then rebuild switch. This is the output:

Jun 11 15:22:20 workstation systemd[1]: Starting Bind mount or link '/persist/home/myUsername/.zsh/TESTING' to '/home/myUsername/.zsh/TESTING'...
Jun 11 15:22:20 workstation 7pb9vnfn766rdd87dlhsd56ibacwdsrd-impermanence-mount-file[23599]: mount already exists at /home/myUsername/.zsh/TESTING, ignoring
Jun 11 15:22:20 workstation systemd[1]: Finished Bind mount or link '/persist/home/myUsername/.zsh/TESTING' to '/home/myUsername/.zsh/TESTING'.

The file then appears in /home/myUsername/.zsh/TESTING. However, once I reboot, the file is gone. I can persist files fine in ~ itself, like /home/myUsername/TESTFILE, but when I try to add them in different directories, it doesn't work.

nakoo commented 2 years ago

Have you tried to unmount /path/to/folder, delete /persist/path/to/folder, and rebuild again? In general, you don't have to create the directory yourself. impermanence takes care about it.

Note, I think zsh related file is better to handle by home-manager like this:

programs.zsh = {
  enable = true;
  initExtra = ''
    PROMPT='%~ %# '
    alias \
      cp="cp -iv" \
      mv="mv -iv" \
  '';
};
talyz commented 1 year ago

I would guess that more of your configuration is relevant. Maybe you're trying to persist a file in an already persisted directory or something similar? Is this still an issue affecting you?