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

nixos: Fix collision detection logic #126

Closed alois31 closed 1 year ago

alois31 commented 1 year ago

The logic for detecting whether a file or directory is specified multiple times was not updated to account for the recent file/filePath and directory/dirPath changes. This can lead to spurious failures like the following if the same home-relative path is persisted for different users:

   Failed assertions:
   - environment.persistence:
       The following directories were specified two or more
       times:
         .cache
         .config
         .local/share
         .local/state
         .gnupg
         .ssh

In addition, the assertion may falsely not trigger in the contrived situation where the same entity is persisted both in a per-user configuration (using the relative path) and the global configuration (using the absolute path).

Fix these situations by checking the absolute paths again using filePath and dirPath.

talyz commented 1 year ago

Thanks!