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

Parent directory permissions specification not only for files #111

Closed ivan770 closed 1 year ago

ivan770 commented 1 year ago

Hi! It seems that currently it's impossible to explicitly specify parent directory permissions for directories with impermanence module.

This can be useful, for example, when creating a persisted user home directory via environment.persistence.${dir}.users. Currently, the first user that exists in this list propagates its ownership onto the /home/ directory.

While this can be solved via dummy files with parentDirectory specified in them, I feel that such a solution is somewhat weird.

I also think that parentDirectory itself could be improved by providing a separate option to specify directory rights. This would allow the configuration of directory rights not only for parent directories, but for any directories that lie within a persisted path.

ivan770 commented 1 year ago

Oh, there's #109 already.

dschrempf commented 1 year ago

I think this issue is still not resolved. I had to use dummy files for the same purpose:

      files = [
        {
          file = ".config/dummy";
          parentDirectory = { mode = "0755"; user = "dominik"; group = "dominik"; };
        }
        {
          file = ".local/share/dummy";
          parentDirectory = { mode = "0755"; user = "dominik"; group = "dominik"; };
        }
      ];