nix-community / impermanence

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

Feature disparity between the NixOS and h-m modueles #142

Open SrEstegosaurio opened 1 year ago

SrEstegosaurio commented 1 year ago

I've found that there's an abysmal difference between the feature set of the both modules provided by this flake.

Why is it that you cannot change the permission, the persistentStorage path, etc... while in the home-manager module?

The most frustrating part is that, by default, all directory paths in the m-m mod. are relative to the the user home. Is there a reason for this?

It is a problem if you want to, for example, so things like this one:

home.impermanence."/nix/persistence" = {
  directories = [
    config.xdg.dataHome;
  ]:
};

Which can be very useful in a lot of situations.

Thanks for you're time and this project. :)

nocha1n commented 1 year ago

I was just discovering the lack of persistentStoragePath in the home-manager module myself... I wanted to declare my persistent setup in home-manager.sharedModules, name the attrs in home.persistence to "state" and then set the persistentStoragePath individually based on config.user.username but this is proving non-trivial due to the differences.

SrEstegosaurio commented 1 year ago

@nocha1n I mean, this is what I had to do in order to avoid putting specific paths instead of just using config.xdg.dataHome:

    # Persists the requiered gpg directories.
    persistence."/nix/persistent${config.home.homeDirectory}" = {
      directories = [
        (builtins.toString (lib.path.removePrefix (/. + config.home.homeDirectory) (/. + (config.programs.gpg.homedir + "/private-keys-v1.d"))))
      ];
    };

The previous chunk of code "relativises" paths to the user home directory. I'm currently working in making a function that does this exact thing since I need it in a lot of places.


EDIT: And regarding the persistentStoragePath issue; there's already a PR about it: #135

eyJhb commented 12 months ago

If anyone wants to test out #135 , I would appreciate it.

I've been running it for some time, and AFAIK it works well :)

SrEstegosaurio commented 11 months ago

I'm going to test it right now! I'll post an update if my computer explodes.