I use this custom option to work with mkOutOfStoreSymlink:
# home.nix
options = {
dotfiles = lib.mkOption {
type = lib.types.path;
apply = toString;
default = "${config.home.homeDirectory}/.config/home-manager/dotfiles";
example = "${config.home.homeDirectory}/.config/home-manager/dotfiles";
description = "Location of the dotfiles working copy";
};
};
config = {
home = rec {
username = "sharpchen";
homeDirectory = "/home/${username}";
stateVersion = "24.05"; # Please read the comment before changing.
};
};
And then use the it as interpolation:
home.file.".config/nvim" = {
source = config.lib.file.mkOutOfStoreSymlink "${config.dotfiles}/nvim-config";
};
But suddenly it no longer work, looks like the interpolation was evaluated as empty string. I am pretty sure it works fine in previous build and I didn’t made relevant change
Error installing file '.config/nvim/init.lua' outside $HOME