nix-community / impermanence

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

feature request: add wildcard matching #152

Open Sntx626 opened 7 months ago

Sntx626 commented 7 months ago

I would like to persist all directories that follow a specific pattern.

Here's an example:

environment.persistence."/nix/persist".users."testuser" = {
  files = [
    # persist all .txt files in the directory
    ".cache/test/*.txt"
  ];
  directories = [
    # persist all extension data, do not persist website data (which is stored in the same dir)
    ".mozilla/firefox/default/storage/default/moz-extension+++*"
  ];
};
IogaMaster commented 5 months ago

I would love to see this! What would I have to do to make this a reality @talyz?

Sntx626 commented 5 months ago

I've thought about it a bit more.

The only way I can think of realizing this is by creating a service for each wildcard that dynamically bindmounts matches at runtime - since we can't really know what would eventually get matched.

Since imperanence is all about "purity", would we even want to introduce such a feature?

Nonetheless, I'd love to see something like this working. Does anyone have an idea on how to solve this problem more elegantly?

mboyea commented 3 months ago

I would also love to see this! When I have the time I will look into implementing it, but I cannot make that time in the immediate future.