如何安装 vscode 的扩展?

Man*_*idt 4 nixos nixpkgs

这是一个初学者的问题。所以有一个包vscode-with-extensions。该说:

与编辑器一起安装的一组 vscode 扩展。下面是一个例子:

vscode-with-extensions.override {
  # When the extension is already available in the default extensions set.
  vscodeExtensions = with vscode-extensions; [
    bbenoist.Nix
  ]
  # Concise version from the vscode market place when not available in the default set.
  ++ vscode-utils.extensionsFromVscodeMarketplace [
    {
      name = "code-runner";
      publisher = "formulahendry";
      version = "0.6.33";
      sha256 = "166ia73vrcl5c9hm4q1a73qdn56m0jc7flfsk5p5q41na9f10lb0";
    }
  ];
}
Run Code Online (Sandbox Code Playgroud)

凡在configuration.nix我必须把这个表情?我已经有了

  environment.systemPackages = with pkgs; [
     wget 
     vim 
     vscode-with-extensions
  ];
Run Code Online (Sandbox Code Playgroud)

其中。

Imm*_*mae 5

您应该直接在 configuration.nix 中使用它,例如

  environment.systemPackages = with pkgs; [
     wget 
     vim 
     (vscode-with-extensions.override {
  # When the extension is already available in the default extensions set.
  vscodeExtensions = with vscode-extensions; [
    bbenoist.Nix
  ]
  # Concise version from the vscode market place when not available in the default set.
  ++ vscode-utils.extensionsFromVscodeMarketplace [
    {
      name = "code-runner";
      publisher = "formulahendry";
      version = "0.6.33";
      sha256 = "166ia73vrcl5c9hm4q1a73qdn56m0jc7flfsk5p5q41na9f10lb0";
    }
  ];
})
  ];
Run Code Online (Sandbox Code Playgroud)

或者,在更易读的版本中:

environment.systemPackages = with pkgs;
  let
    vcsodeWithExtension = vscode-with-extensions.override {
      # When the extension is already available in the default extensions set.
      vscodeExtensions = with vscode-extensions; [
        bbenoist.Nix
      ]
      # Concise version from the vscode market place when not available in the default set.
      ++ vscode-utils.extensionsFromVscodeMarketplace [
        {
          name = "code-runner";
          publisher = "formulahendry";
          version = "0.6.33";
          sha256 = "166ia73vrcl5c9hm4q1a73qdn56m0jc7flfsk5p5q41na9f10lb0";
        }
      ];
    })
  in
    [
      wget
      vim
      vcsodeWithExtension
    ];
Run Code Online (Sandbox Code Playgroud)

  • 通常的方法是在那里放一个随机字符串(“0000000000000000000000000000000000000000000000000000”)并让nix抱怨它,它会告诉你实际计算的字符串 (3认同)