I am new to nixos and trying to create a local configurable to config if add vim extension to vscode package.
{ config, pkgs, lib, …}:
with pkgs;
let
options.vscode = {
vim = mkOption {
type= types.bool;
default = false;
description = “If add vscode vim extension”;
};
};
extensions = (with pkgs.vscode-extensions; [
ms-vscode.cpptools
ms-python.python
]) ++ (config.vscode.vim [ pkgs.vscode-extensions.vscodevim.vim])
vscode-with-extensions = pkgs.vscode-with-extensions.override {
vscodeExtensions = extensions;
};
in {
environment.systemPackages = with pkgs; [
vscode-with-extensions
];
}
I was trying to use config.vscode.vim = true/false to add or ingore vim plugin. However it does not work.
I searched some wiki page and tutorial, it mentions the option = {} is declaration however config = {} is definition. However, I found most example seems tend to use the declared option to init the already existing system options. I am not sure how to fit the case to my usage.
What the best way to add some simple Flags in configuration.nix?
Thanks