3

This is a beginner question. So there is a package vscode-with-extensions. The package says:

A set of vscode extensions to be installed alongside the editor. Here's a an example:

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";
    }
  ];
}

Where in configuration.nix do I have to put this expression? I already have

  environment.systemPackages = with pkgs; [
     wget 
     vim 
     vscode-with-extensions
  ];

therein.

Manuel Schmidt
  • 2,227
  • 1
  • 14
  • 29

2 Answers2

5

You’re supposed to use it as in the configuration.nix directly, like for instance

  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";
    }
  ];
})
  ];

Or, in a more readable version:

enviornment.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
    ];
Immae
  • 313
  • 1
  • 2
  • 6
0

So, apparently it can go directly into environment.systemPackages, but requires parentheses:

  environment.systemPackages = with pkgs; [
    wget 
    vim 
    (vscode-with-extensions.override {
      vscodeExtensions = with vscode-extensions; [
        bbenoist.Nix
      ];
    })
  ];
Manuel Schmidt
  • 2,227
  • 1
  • 14
  • 29