Merge pull request #326162 from jopejoe1/vim-refactor

nixos/vim: add enable option and link `/share/vim-plugins` only when …
This commit is contained in:
Aleksana
2024-07-11 21:35:06 +08:00
committed by GitHub
3 changed files with 26 additions and 17 deletions

View File

@@ -182,6 +182,10 @@
- `keycloak` was updated to version 25, which introduces new hostname related options.
See [Upgrading Guide](https://www.keycloak.org/docs/25.0.1/upgrading/#migrating-to-25-0-0) for instructions.
- `programs.vim.defaultEditor` now only works if `programs.vim.enable` is enabled.
- `/share/vim-plugins` now only gets linked if `programs.vim.enable` is enabled
- The `tracy` package no longer works on X11, since it's moved to Wayland
support, which is the intended default behavior by Tracy maintainers.
X11 users have to switch to the new package `tracy-x11`.

View File

@@ -155,7 +155,6 @@ in
"/share/hunspell"
"/share/org"
"/share/themes"
"/share/vim-plugins"
"/share/vulkan"
"/share/kservices5"
"/share/kservicetypes5"

View File

@@ -1,25 +1,31 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.vim;
in {
in
{
options.programs.vim = {
defaultEditor = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
When enabled, installs vim and configures vim to be the default editor
using the EDITOR environment variable.
'';
};
enable = lib.mkEnableOption "Vi IMproved, an advanced text";
package = lib.mkPackageOption pkgs "vim" {
example = "vim-full";
};
defaultEditor = lib.mkEnableOption "vim as the default editor";
package = lib.mkPackageOption pkgs "vim" { example = "vim-full"; };
};
config = lib.mkIf cfg.defaultEditor {
environment.systemPackages = [ cfg.package ];
environment.variables = { EDITOR = lib.mkOverride 900 "vim"; };
# TODO: convert it into assert after 24.11 release
config = lib.mkIf (cfg.enable || cfg.defaultEditor) {
warnings = lib.mkIf (cfg.defaultEditor && !cfg.enable) [
"programs.vim.defaultEditor will only work if programs.vim.enable is enabled, will be encfored after the 24.11 release"
];
environment = {
systemPackages = [ cfg.package ];
variables.EDITOR = lib.mkIf cfg.defaultEditor (lib.mkOverride 900 "vim");
pathsToLink = [ "/share/vim-plugins" ];
};
};
}