Hi!
Asked about help with fixing the symlinks errors
This is source configuration: GitHub - art1es23/nixos
And related topic to this: Correctly running cloned flake - #15 by art1es23
Hi!
Asked about help with fixing the symlinks errors
This is source configuration: GitHub - art1es23/nixos
And related topic to this: Correctly running cloned flake - #15 by art1es23
Looking over the code, I think the issue may be with the way you construct the symlinks. I think the issue is with the functions linkHostApp
and linkSharedApp
. They are using mkOutOfStoreSymlink
to create “live” symlinks. It’s a neat trick, but it is also a bit finicky and it may be what’s causing your issue. Try looking around a bit with readlink
.
Sorry, you mean smth like this?
It’s from /nix/store/ppvlmxdlalzr3z9h17xf46nkxbrllc9m-home-manager-files/.config/ :
As I understand it not created in intermediary?
It’s from yazi:
With absolute paths it’s working but with symlinks which created relative - no (
I don’t understand
Why use mkOutOfStoreSymlink
with a relative path? It should just use the path directly
Perhaps, I said incorrectly.
I mean this:
buildHomeManagerConfig =
hostname:
let
rootPath = "~/nixos/modules/home-manager";
hostPath = "${rootPath}/hosts/${hostname}";
sharedPath = "${rootPath}/shared";
in
{
linkHostApp = config: app: config.lib.file.mkOutOfStoreSymlink "${hostPath}/${app}/config";
linkSharedApp = config: app: config.lib.file.mkOutOfStoreSymlink "${sharedPath}/${app}/config";
};
home.file.".config/zsh".source = homeManagerConfig.linkSharedApp config "zsh";
Try replacing all uses of linkHostApp
and linkSharedApp
with relative paths. For example, this:
home.file.".config/kitty".source = homeManagerConfig.linkSharedApp config "kitty";
…should become this:
home.file.".config/kitty".source = ./config;
This is removing a layer of indirection. Instead of having a structure that looks like ~/.config/kitty -> /nix/store/...-config -> ~/nixos/modules/home-manager/shared/kitty/config
, you would end up with a structure of ~/.config/kitty -> /nix/store/...-source/.../kitty/config
.
This is of course not the same behavior: the symlinks are no longer “live” and you must run darwin-rebuild
every time you change your configuration. Arguably this is the more “correct” (idiomatic) approach.