Nixvim icon plugin error after tmux resurrect

Hello, Nixvim crashes after I resurrect tmux on NixOS. Here is the error:

Error detected while processing pre-vimrc command line:
E5107: Error loading lua [string ":lua"]:1: unexpected symbol near '^'
Error detected while processing /home/blckhrt/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /home/blckhrt/.config/nvim/init.lua:46: module 'nvim-web-devicons' not found:
        no field package.preload['nvim-web-devicons']
        no file './nvim-web-devicons.lua'
        no file '/nix/store/ljx348x00i555x6c89qa4l52yjgxyvg3-luajit-2.1.1741730670/share/luajit-2.1/nvim-web-devicons.lua'
        no file '/usr/local/share/lua/5.1/nvim-web-devicons.lua'
        no file '/usr/local/share/lua/5.1/nvim-web-devicons/init.lua'
        no file '/nix/store/ljx348x00i555x6c89qa4l52yjgxyvg3-luajit-2.1.1741730670/share/lua/5.1/nvim-web-devicons.lua'
        no file '/nix/store/ljx348x00i555x6c89qa4l52yjgxyvg3-luajit-2.1.1741730670/share/lua/5.1/nvim-web-devicons/init.lua'
        no file './nvim-web-devicons.so'
        no file '/usr/local/lib/lua/5.1/nvim-web-devicons.so'
        no file '/nix/store/ljx348x00i555x6c89qa4l52yjgxyvg3-luajit-2.1.1741730670/lib/lua/5.1/nvim-web-devicons.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        /home/blckhrt/.config/nvim/init.lua:46: in main chunk

Here is my nixvim plugins and tmux configuration, please let me know if you need other files. I do have the plugin it mentions installed so I’m not sure why I’m getting this error. I can see nvim for a brief second and everything appears normal, and then it crashes. I tried using mini icons as well but no luck.

{pkgs, ...}: {
  imports = [
    ./cmp.nix
    ./lsp.nix
    ./lualine/default.nix
    ./telescope.nix
    ./treesitter.nix
    ./toggleterm.nix
  ];

  programs.nixvim = {
    extraPlugins = with pkgs.vimPlugins; [
      gruvbox-material-nvim
    ];

    plugins = {
      web-devicons.enable = true;
      wakatime.enable = true;
      which-key.enable = true;
      render-markdown.enable = true;
      hop.enable = true;
      indent-blankline.enable = true;
      nvim-autopairs.enable = true;
      tmux-navigator.enable = true;
      guess-indent.enable = true;
      gitsigns.enable = true;
      nvim-tree.enable = true;
      auto-session.enable = true;

      noice = {
        enable = true;
        settings = {
          presets = {
            bottom_search = true;
            command_palette = true;
            long_message_to_split = true;
          };
        };
      };

      transparent = {
        enable = true;
        autoLoad = true;
      };

      telekasten = {
        enable = true;
        settings.home = "/home/blckhrt/doc/01 - Index/";
      };
    };
  };
}
{pkgs, ...}: let
  tmux2k = pkgs.tmuxPlugins.mkTmuxPlugin {
    pluginName = "tmux2k";
    version = "unstable-latest";
    src = pkgs.fetchFromGitHub {
      owner = "2KAbhishek";
      repo = "tmux2k";
      rev = "90707b93e4c4c3a20dc5dbff1cc9106057c70c71";
      hash = "sha256-AdKskM3gSIB+ysusNgQRp9Jb2rM2dldr/wtV2PUqTjo=";
    };
    rtpFilePath = "2k.tmux";
  };
in {
  programs.tmux = {
    enable = true;
    shell = "${pkgs.zsh}/bin/zsh";
    terminal = "tmux-256color";
    baseIndex = 1;
    prefix = "C-x";
    plugins = with pkgs.tmuxPlugins; [
      vim-tmux-navigator
      {
        plugin = tmux2k;
        extraConfig = ''
          set -g @tmux2k-theme 'gruvbox'
          set -g @tmux2k-icons-only true
        '';
      }
      {
        plugin = resurrect;
        extraConfig = ''
          resurrect_dir="$HOME/.tmux/resurrect"
          set -g @resurrect-dir $resurrect_dir
          set -g @resurrect-hook-post-save-all "sed -i 's/--cmd lua.*--cmd set packpath/--cmd \"lua/g; s/--cmd set rtp.*\$/\"/' $resurrect_dir/last"
          set -g @resurrect-capture-pane-contents 'on'
          set -g @resurrect-processes '"~nvim"'
          set -g @resurrect-save-zsh-history 'on'
        '';
      }
      {
        plugin = continuum;
        extraConfig = ''
          set -g @continuum-restore 'on'
          set -g @continuum-boot 'on'
          set -g @continuum-save-interval '5'
        '';
      }
    ];

    extraConfig = ''
      set -ga terminal-overrides ",xterm-256color:Tc"
      set -as terminal-features ",xterm-256color:RGB"
      set -g set-clipboard on
      set -g detach-on-destroy on
      set -g escape-time 0
      set -g history-limit 1000000
      set -g mouse on
      set -g status-interval 3
      set -g allow-passthrough on
      set -g status-position top
      set -g base-index 1
      set -g pane-base-index 1
      set -g renumber-windows on

      unbind %
      bind | split-window -h -c "#{pane_current_path}"
      unbind '"'
      bind - split-window -v -c "#{pane_current_path}"
      bind c new-window -c "#{pane_current_path}"

      bind -r j resize-pane -D 5
      bind -r k resize-pane -U 5
      bind -r h resize-pane -L 5
      bind -r l resize-pane -R 5
      bind -r m resize-pane -Z

      set -g status-position top
    '';
  };
}

Also, here is the line in the generated config that it points to. Not sure why other plugins load but this one fails.

require("nvim-web-devicons").setup({})

I figured it out. Either I copied something wrong or the original tmux + nixvim fix I used didn’t work, but here is the fix that ended up working, from this post:

      {
        plugin = resurrect;
        extraConfig = ''
          set -g @resurrect-processes 'ssh "~nvim"'
          set -g @resurrect-strategy-nvim 'session'
          resurrect_dir=~/.local/share/tmux/resurrect
          set -g @resurrect-dir $resurrect_dir
          set -g @resurrect-hook-post-save-all "sed -i 's| --cmd .*-vim-pack-dir||g; s|/etc/profiles/per-user/$USER/bin/||g; s|/nix/store/.*/bin/||g' $(readlink -f $resurrect_dir/last)"
        '';
      }