How to use `mkOutOfStoreSymlink` in modules ?
brboi opened this issue · comments
Hello ;-)
I am trying to use mkOutOfStoreSymlink
from home-manager
in my modules but I get this error:
error: attribute 'file' missing
at /nix/store/z4bfxx4ida05kgvfasa9q5pbam9dg5f0-xy5h7vw7zcajp7r724hh2w691qy94v8z-source/modules/nixos/desktop/awesome/default.nix:20:18:
19| awesome = {
20| source = lib.file.mkOutOfStoreSymlink ./config;
| ^
21| recursive = true;
Did you mean one of filter, fix, fix', fold or pipe?
Here's a short snippet of what I am trying to achieve
{config, lib}:
{
config.plusultra.home.configFile = {
awesome = {
source = lib.file.mkOutOfStoreSymlink ./config;
recursive = true;
};
};
}
Thanks a lot for any help ;-)
Hey! I think you're missing config
at the beginning of that call. It should be:
config.lib.file.mkOutOfStoreSymlink
Thank you for your reply, and sorry for the typo but I did not miss it in my file.
So the above snippet should have been.
{config, lib}:
{
config.plusultra.home.configFile = {
awesome = {
source = config.lib.file.mkOutOfStoreSymlink ./config;
recursive = true;
};
};
}
It seems that somehow the home-manager context is not available when the module is loaded.
EDIT: the traceback is still the same
error: attribute 'file' missing
at /nix/store/qb12m9pi2kjy0rsk4scs9k5ix4ris2sq-24cy873i8hj2djnhmcgf8bnsbg0wcsdv-source/modules/nixos/desktop/awesome/default.nix:20:18:
19| awesome = {
20| source = config.lib.file.mkOutOfStoreSymlink ./config;
| ^
21| recursive = true;
Oh I see, this is in your system configuration and not in a home manager module. I would suggest putting this into a home manager module since the config
is different. But you may be able to get away with using home-manager.users.${my-user}.lib.file.mkOutOfStoreSymlink
. I'm not entirely sure if that'll work, but it's worth a try.
This is happening because there are two different module system instances:
- NixOS
- Home Manager
Things can get confusing when you pass things down to the HM config from within the NixOS config. If you instead load a Home Manager module instead then you won't have this same context confusion.