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

home-manager: add persistentStoragePath option #135

Closed eyJhb closed 9 months ago

eyJhb commented 1 year ago

Add persistentStoragePath to the home-manager module, to be in line with #134 .

Would allow to do things such as...

home.persistence.main = {
  persistentStoragePath = "/persistent";
  files = [ ... ]
  directories = [ ... ]
};

cc @talyz :)

EDIT: this is not tested yet. Trying to use it now. EDIT2: I've been running this for months now, without any issues. EDIT3: I do however have patched the following line, to always use symlink getDirMethod = v: v.method or "bindfs";

eyJhb commented 1 year ago

I'm really unsure, if this is the way to go. I've tried not to edit too much in the module, but only the base things.

eyJhb commented 11 months ago

@SrEstegosaurio keep in mind, I've mostly only tested it with symlink, as I don't like bindfs. Hopefully your PC does not explode.

SrEstegosaurio commented 11 months ago

Sorry for my late response, I've been busy. :/

I've decided to test it out following the example and got an error.

The nix expression:
{pkgs, lib, config, ...}:
{
    # Element matrix client configuration file.
    home = {
        # There is an element-desktop-wayland which currently does not spawn a window in wayland.
        # Maybe more testing?
        packages = [pkgs.element-desktop];

        persistence.main = lib.mkIf (builtins.elem pkgs.element-desktop config.home.packages) {
            persistentStoragePath = "/nix/persistent${config.home.username}"; 
            directories = [
                "${config.xdg.configHome}/Element"
            ];
        };
    };
}
The error:
       error: The option `home-manager.users.srestegosaurio.home.persistence.main.persistentStoragePath' does not exist. Definition values:
       - In `/nix/store/9q12xmgzj1jifzy6gbl824ainfp649x3-source/modules/coms/element': "/nix/persistentsrestegosaurio"
eyJhb commented 11 months ago

How are you importing the patch? It seems weird that you would get that error.

I've been running it since I made this pr, and haven't gotten that error. I can try to post my config once I get home.

But it just smells very much like the patch isn't imported/used.

On 21 October 2023 15.15.12 CEST, "Sr.Estegosaurio" @.***> wrote:

Sorry for my late response, I've been busy. :/

I've decided to test it out following the example and got an error.

The nix expression:
{pkgs, lib, config, ...}:
{
  # Element matrix client configuration file.
  home = {
      # There is an element-desktop-wayland which currently does not spawn a window in wayland.
      # Maybe more testing?
      packages = [pkgs.element-desktop];

      persistence.main = lib.mkIf (builtins.elem pkgs.element-desktop config.home.packages) {
          persistentStoragePath = "/nix/persistent${config.home.username}"; 
          directories = [
              "${config.xdg.configHome}/Element"
          ];
      };
  };
}
The error:
      error: The option `home-manager.users.srestegosaurio.home.persistence.main.persistentStoragePath' does not exist. Definition values:
      - In `/nix/store/9q12xmgzj1jifzy6gbl824ainfp649x3-source/modules/coms/element': "/nix/persistentsrestegosaurio"

-- Reply to this email directly or view it on GitHub: https://github.com/nix-community/impermanence/pull/135#issuecomment-1773788407 You are receiving this because you authored the thread.

Message ID: @.***>

eyJhb commented 9 months ago

@talyz do you have time to look at this PR? :)

talyz commented 9 months ago

Looks good! Thanks! :)