I want to set a home manager config in one system module (I don’t want to manage two separate files and include them in different places). But it fails with an error, that
The code for bar.nix:
{ config, pkgs, ... }: {
imports = [
# ...
];
options = { };
config = {
home-manager.users.mobergmann = {
xdg.configFile."foo".source =
config.lib.mkOutOfStoreSymlink /home/mobergmann/nixos/configs/foo;
};
};
}
Is imported like so in default.nix
{ pkgs, ... }:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
../../modules/bar.nix
];
# ...
}
fails with the error:
error: attribute 'mkOutOfStoreSymlink' missing
at /nix/store/fl33ji7l2sgy16mqakbyyz36m2j5amc9-source/modules/bar.nix:34:9:
33| xdg.configFile."foo".source =
34| config.lib.mkOutOfStoreSymlink /home/mobergmann/nixos/configs/foo;
| ^
35| };
I could not figure out why this error occurs. My guess is, that nix tries to use config not from home manager, but from the system, which doesn’t have lib.file.mkOutOfStoreSymlink. But I could not figure out how to solve this.
I hope some of you can help me.