配置通过 NixOS 的 home-manager 安装的 vim

配置通过 NixOS 的 home-manager 安装的 vim

我刚刚开始使用 NixOS,我试图home-manager以声明方式控制我安装的软件包并将其配置部署到我的主目录。

我告诉home-manager安装vim_configurable

# ~/.config/nixpkgs/home.nix
{ config, pkgs, ... }:
{
  home.packages = [
    pkgs.vim_configurable
    #...
  ]
  #...

效果很好,但是当我尝试时遇到了错误用于program.vim配置它

  #...
  programs.vim = {
    enable = true;
    settings = {
      expandtab = true;
      tabstop = 2;
    };
  };

home-manager switch由于版本冲突,运行时出现错误gvimdiff

; home-manager switch
these 3 derivations will be built:
  /nix/store/z8imrylbxzmk161gc1jjj2nsjdaiv0ca-home-manager-path.drv
  /nix/store/2wwz04y7yqrzizicc160n630a6kja778-activation-script.drv
  /nix/store/pyx34c22lz2f6nw2pdjgddsg8sy5wz0c-home-manager-generation.drv
building '/nix/store/z8imrylbxzmk161gc1jjj2nsjdaiv0ca-home-manager-path.drv'...
error: collision between `/nix/store/vvb9a43fpmsijx42k3jvrr1a8l6jq6da-vim_configurable-8.2.5172/bin/gvimdiff' and `/nix/store/xyhfc9g3qk3i42gqmp05r0lsab7nng14-vim/bin/gvimdiff'
error: builder for '/nix/store/z8imrylbxzmk161gc1jjj2nsjdaiv0ca-home-manager-path.drv' failed with exit code 25;
       last 1 log lines:
       > error: collision between `/nix/store/vvb9a43fpmsijx42k3jvrr1a8l6jq6da-vim_configurable-8.2.5172/bin/gvimdiff' and `/nix/store/xyhfc9g3qk3i42gqmp05r0lsab7nng14-vim/bin/gvimdiff'
       For full logs, run 'nix log /nix/store/z8imrylbxzmk161gc1jjj2nsjdaiv0ca-home-manager-path.drv'.
error: 1 dependencies of derivation '/nix/store/pyx34c22lz2f6nw2pdjgddsg8sy5wz0c-home-manager-generation.drv' failed to build

我猜这是因为programs.vim.enable = true指示home-manager添加系统vim之类的东西,这是冲突的?

删除enable = true可以消除错误,但似乎没有任何配置设置能够通过,这使得指定programs.vim块变得毫无意义。

难道我做错了什么?这是否应该有效,或者这种配置是否期望我通过更新来安装软件包/etc/nixos/configuration.nix

答案1

问题是您需要选择一种方法:要么自己安装 vim/vim_configurable,要么让家庭管理员为您安装。

相关内容