Home-manager not symlinking files made with home.file

{ config, lib, pkgs, ... }:

let
  YAZI = ".config/yazi";
in

{

  home.file = {

    "${YAZI}/keymap.toml" = {
      source = ./keymap.toml;
    };

    "${YAZI}/theme.toml" = {
      source = ./theme.toml;
    };

    "${YAZI}/yazi.toml" = {
      source = ./yazi.toml;
    };

  };

  home.packages = with pkgs; [
    # Yazi Dependencies
    jq
    poppler
    p7zip
    fd
    rq
    fzf
    ffmpegthumbnailer
    zoxide
    imagemagick
    yazi
    zed
  ];
}

Home manager builds without problem:

<<< /home/safri/.local/state/nix/profiles/home-manager
>>> /tmp/nh-home0P68LO/result
Added packages:
[A.]  #1  hm_keymap.toml  <none>
[A.]  #2  hm_theme.toml   <none>
[A.]  #3  hm_yazi.toml    <none>
Removed packages:
[R.]  #1  hm_homesafri.configyazikeymap.toml  <none>
Closure size: 1086 -> 1088 (5 paths added, 3 paths removed, delta +2, disk usage +39.7KiB).
> Activating configuration
replacing old 'home-manager-path'
installing 'home-manager-path'
ln: failed to create symbolic link '/home/safri/.config/fcitx5/conf': Read-only file system

No files are being made in ~/.config/yazi.

home manager has got to be doing something because:

safri@nixos:~/ > find / -type f -name "yazi.toml" 2>/dev/null
/nix/store/ix042f2qp24kim421b6mrhs2bpvrr38z-source/home/tui/yazi/yazi.toml
/nix/store/2rhs6s5w58ra1dxlb2d55mzkqymvkrfh-source/home/tui/yazi/yazi.toml
/nix/store/jwh66902z6m7bm2id5rpyyy3b268i687-source/home/tui/yazi/yazi.toml
/nix/store/ckm8mcpvy2frhinc201nfd4qw8dn0bi0-source/home/tui/yazi/yazi.toml
... (a lot more of these)

I have no idea why this wouldn’t be working, other home files are working fine,

  home.file = {

    "${DOOM}/init.el" = {
      source = ./init.el;
      onChange = ''${RELOAD}'';

    };
....

Is basically the same code and it works great.

any help would be appreciated.

I mean, it’s right there. The activation script fails, presumably because of an existing symlink pointing into the nix store that isn’t being cleaned up correctly, so after the fcitx5 conf link all other config changes fail to apply.

My guess would be that you switched from a recursive directory to a non-recursive one at some point and didn’t clean up the symlink, and home-manager lost track of it somehow, or maybe you have a file set in a non-recursive directory.

Perhaps it is better to use:

{ config, lib, pkgs, ... }:

let
  YAZI = "${config.xdg.configHome}/yazi";
in

Nicest would probably be:

{
  xdg.configFile."yazi".source = ./yazi;
}

With a yazi directory in ./. But definitely at least use xdg.configFile instead of binding a variable that points to configHome.

Thank you,

I think the problem was that I was modifying

i18n.inputMethod.fcitx5.settings.inputMethod

While also trying to home file a folder into the same directory.

1 Like