nix-community / impermanence

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

impermanence home-manager module does not work #51

Closed lambdaclan closed 2 years ago

lambdaclan commented 2 years ago

Hello there, first of all thanks to all the contributors for this awesome project.

I am a new NixOS user and have been playing around within a VM trying to setup tmpfs as root and home based on the blog from elis (https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/). All seems to be working fine with the exception of the home-manager module.

Whenever I activate the home-manager module as explained (https://github.com/nix-community/impermanence#home-manager) and do a nixos-rebuild it fails with:

attribute 'dag' missing --> home-manager.nix line 206

I tried various home-manager releases (19.03 onwards) as well as stable/unstable NixOS but the issue persists.

I wonder if it has anything to do with this commit? There are also some notes from that release:

image

I also tried the open PR that enables file management with systemd services and whereas that works fine it messes up the permissions for anything under home (chown fixes it but it is tedious to do it on every boot).

Here are some snippets of my config;

image

image

and the error itself:

image

Commenting out the home-manager module works meaning that the nixos module has no issues (checking the source i can see that there are no references to dag).

It could be something wrong with my setup so apologies if that is the case, any help would be appreciated.

Thank you.

bbjubjub2494 commented 2 years ago

I believe that the issue is that you're importing the HM module as if it was a NixOS module. Try putting imports = [ /path/to/impermanence/home-manager.nix ]; under home-manager.users.mars instead.

For the record, I know the hm.dag business is a utility library provided by HM, so if it's missing, that's a sign that some code expects to be in the HM context but isn't.

lambdaclan commented 2 years ago

Hello @lourkeur thank you very much for your reply.

I believe that the issue is that you're importing the HM module as if it was a NixOS module. Try putting imports = [ /path/to/impermanence/home-manager.nix ]; under home-manager.users.mars instead.

Indeed, that was the reason I was getting the weird error. I blame my OCD for wanting to nicely organize the imports on top of my configuration. Since the nixos module was working fine it did not cross my mind that the import statement could be the issue. I guess I have some reading up to do on nix to further my understanding.

I will keep things simple and in a working state for now and optimize/beatify later.

Thank you again for your help, really appreciated.