add vim module

This commit is contained in:
Joseph Hanson 2024-07-29 12:53:31 -05:00
parent e7352f9530
commit dc8a2322fc
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o
5 changed files with 96 additions and 71 deletions

View file

@ -48,7 +48,6 @@ with config;
python3
fzf
ripgrep
vim
lsd
unstable.atuin
@ -89,12 +88,6 @@ with config;
# nix tools
nvd
];
sessionVariables = {
EDITOR = "vim";
};
};
};
}

View file

@ -1,66 +1,6 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.mySystem.editor.vscode;
# VSCode Community Extensions. These are updated daily.
vscodeCommunityExtensions = [
"dracula-theme.theme-dracula"
"esbenp.prettier-vscode"
"jnoortheen.nix-ide"
"mikestead.dotenv"
"ms-azuretools.vscode-docker"
# Python extensions *required* for redhat.ansible/vscode-yaml
"ms-python.python"
"ms-python.vscode-pylance"
"ms-vscode-remote.remote-ssh"
"ms-vscode-remote.remote-ssh-edit"
"pkief.material-icon-theme"
"redhat.ansible"
"redhat.vscode-yaml"
"signageos.signageos-vscode-sops"
"tamasfe.even-better-toml"
"tyriar.sort-lines"
"yzhang.markdown-all-in-one"
"mrmlnc.vscode-json5"
"editorconfig.editorconfig"
];
# Nixpkgs Extensions. These are updated whenver they get around to it.
vscodeNixpkgsExtensions = [
# Continue ships with a binary that requires the patchelf fix which is done by default in nixpkgs.
"continue.continue"
];
# Straight from the VSCode marketplace.
marketplaceExtensions = [
{
name = "copilot";
publisher = "github";
version = "1.219.0";
sha256 = "Y/l59JsmAKtENhBBf965brSwSkTjSOEuxc3tlWI88sY=";
}
{
name = "copilot-chat";
publisher = "github";
version = "0.17.1";
sha256 = "Aa4gmHJCveP18v6CAvmkxmqf1JV1LygyQFNpzDz64Gw=";
}
imports = [
./vim.nix
./vscode.nix
];
# Extract extension strings and coerce them to a list of valid attribute paths.
vscodeCommunityExtensionsPackages = map (ext: getAttrFromPath (splitString "." ext) pkgs.vscode-marketplace) vscodeCommunityExtensions;
nixpkgsExtensionsPackages = map (ext: getAttrFromPath (splitString "." ext) pkgs.vscode-extensions) vscodeNixpkgsExtensions;
marketplaceExtensionsPackages = pkgs.vscode-utils.extensionsFromVscodeMarketplace marketplaceExtensions;
in
{
options.mySystem.editor.vscode.enable = mkEnableOption "vscode";
config = mkIf cfg.enable {
# Enable vscode & addons
environment.systemPackages = with pkgs; [
(vscode-with-extensions.override {
inherit (unstable) vscode;
# Merge all the extension packages together.
vscodeExtensions =
vscodeCommunityExtensionsPackages ++ nixpkgsExtensionsPackages ++ marketplaceExtensionsPackages;
})
];
};
}

View file

@ -0,0 +1,25 @@
# /home/jahanson/projects/mochi/nixos/modules/nixos/editor/vim.nix
{ config, lib, ... }:
with lib;
let
cfg = config.mySystem.editor.vim;
users = [ "jahanson" ];
in
{
options.mySystem.editor.vim.enable = mkEnableOption "vim";
config = mkIf cfg.enable {
# Enable vim and set as default editor
programs.vim.defaultEditor = true;
# Visual mode off and syntax highlighting on
home-manager.users = mapAttrs
(user: _: {
home.file.".vimrc".text = ''
set mouse-=a
syntax on
'';
})
(listToAttrs (map (u: { name = u; value = { }; }) users));
};
}

View file

@ -0,0 +1,66 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.mySystem.editor.vscode;
# VSCode Community Extensions. These are updated daily.
vscodeCommunityExtensions = [
"dracula-theme.theme-dracula"
"esbenp.prettier-vscode"
"jnoortheen.nix-ide"
"mikestead.dotenv"
"ms-azuretools.vscode-docker"
# Python extensions *required* for redhat.ansible/vscode-yaml
"ms-python.python"
"ms-python.vscode-pylance"
"ms-vscode-remote.remote-ssh"
"ms-vscode-remote.remote-ssh-edit"
"pkief.material-icon-theme"
"redhat.ansible"
"redhat.vscode-yaml"
"signageos.signageos-vscode-sops"
"tamasfe.even-better-toml"
"tyriar.sort-lines"
"yzhang.markdown-all-in-one"
"mrmlnc.vscode-json5"
"editorconfig.editorconfig"
];
# Nixpkgs Extensions. These are updated whenver they get around to it.
vscodeNixpkgsExtensions = [
# Continue ships with a binary that requires the patchelf fix which is done by default in nixpkgs.
"continue.continue"
];
# Straight from the VSCode marketplace.
marketplaceExtensions = [
{
name = "copilot";
publisher = "github";
version = "1.219.0";
sha256 = "Y/l59JsmAKtENhBBf965brSwSkTjSOEuxc3tlWI88sY=";
}
{
name = "copilot-chat";
publisher = "github";
version = "0.17.1";
sha256 = "Aa4gmHJCveP18v6CAvmkxmqf1JV1LygyQFNpzDz64Gw=";
}
];
# Extract extension strings and coerce them to a list of valid attribute paths.
vscodeCommunityExtensionsPackages = map (ext: getAttrFromPath (splitString "." ext) pkgs.vscode-marketplace) vscodeCommunityExtensions;
nixpkgsExtensionsPackages = map (ext: getAttrFromPath (splitString "." ext) pkgs.vscode-extensions) vscodeNixpkgsExtensions;
marketplaceExtensionsPackages = pkgs.vscode-utils.extensionsFromVscodeMarketplace marketplaceExtensions;
in
{
options.mySystem.editor.vscode.enable = mkEnableOption "vscode";
config = mkIf cfg.enable {
# Enable vscode & addons
environment.systemPackages = with pkgs; [
(vscode-with-extensions.override {
inherit (unstable) vscode;
# Merge all the extension packages together.
vscodeExtensions =
vscodeCommunityExtensionsPackages ++ nixpkgsExtensionsPackages ++ marketplaceExtensionsPackages;
})
];
};
}

View file

@ -18,6 +18,7 @@ with lib;
boot.tmp.cleanOnBoot = true;
mySystem = {
# basics for all devices
editor.vim.enable = true;
time.timeZone = "America/Chicago";
security.increaseWheelLoginLimits = true;
system.packages = [ pkgs.bat ];