add basic neovim config skeleton

This commit is contained in:
Charlotte 🦝 Delenk 2023-04-13 07:57:08 +01:00
parent 89f50d5a76
commit 3f44f068ae
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
8 changed files with 142 additions and 4 deletions

View file

@ -4,6 +4,7 @@ desktop: {pkgs, ...}: {
(import ../programs/zsh.nix desktop)
../programs/tmux.nix
../programs/taskwarrior.nix
(import ../programs/vim desktop)
]
++ (
if desktop
@ -30,13 +31,12 @@ desktop: {pkgs, ...}: {
home.file.".p10k.zsh".source = ./.p10k.zsh;
systemd.user.sessionVariables = {
EDITOR = "hx";
EDITOR = "vim";
};
home = {
shellAliases = {
vi = "hx";
vim = "hx";
nvim = "hx";
vi = "nvim";
vim = "nvim";
cat = "bat";
less = "bat";
};

View file

@ -0,0 +1,51 @@
# Taken from https://github.com/syberant/nix-config/tree/master/configuration/home-manager/modules/neovim
desktop: {
pkgs,
lib,
config,
...
}:
with lib;
with builtins; let
getNixFiles = dir: let
recu = n: k:
if k == "directory"
then getNixFiles "${dir}/${n}"
else if hasSuffix "nix" n
then ["${dir}/${n}"]
else [];
in
flatten (mapAttrsToList recu (readDir dir));
in {
imports =
getNixFiles ./modules
++ (
if desktop
then [./desktop.nix]
else []
);
config = {
output.path.style = "impure";
output.makeWrapper = "--set LUA_PATH '${./modules/lua}/?.lua;;'";
isDesktop = lib.mkDefault false;
extraLua = builtins.concatStringsSep "\n" (map (f: "require('${f}')") config.extraLuaModules);
output.extraConfig = ''
lua << EOF_991fbac8c1efc440
${config.extraLua}
EOF_991fbac8c1efc440
'';
};
options.isDesktop = lib.options.mkEnableOption "desktop integration and LSP";
options.extraLua = lib.options.mkOption {
type = lib.types.lines;
default = "";
description = "Extra lua configuration to add";
};
options.extraLuaModules = lib.options.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
description = "Extra lua modules to require";
};
}

View file

@ -0,0 +1,20 @@
desktop: {
pkgs,
nix-neovim,
...
}: let
myNeovim = nix-neovim.buildNeovim {
configuration = import ./configuration.nix desktop;
inherit pkgs;
};
in {
home.packages = [
myNeovim
];
systemd.user.tmpfiles.rules = [
"d %h/.cache/nvim/undo-files 0700 %u %g mM:1w -"
"d %h/.cache/nvim/swap-files 0700 %u %g mM:1w -"
"d %h/.cache/nvim/backup-files 0700 %u %g mM:1w -"
];
}

View file

@ -0,0 +1,11 @@
{pkgs, ...}: {
output.path.path = with pkgs; [wl-clipboard xclip];
isDesktop = true;
output.extraConfig = ''
" Clipboard settings, always use clipboard for all delete, yank, change, put
" operation, see https://stackoverflow.com/q/30691466/6064933
if !empty(provider#clipboard#Executable())
set clipboard+=unnamedplus
endif
'';
}

View file

View file

View file

@ -1232,6 +1232,26 @@
"type": "github"
}
},
"nix-neovim": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1650651888,
"narHash": "sha256-2lC6oeQMTke7/bx8VxLNJr54A/WGkdAv2H0iebTmACY=",
"owner": "syberant",
"repo": "nix-neovim",
"rev": "6f03a1c206ff2c5bea209c73f861ebd8088de53b",
"type": "github"
},
"original": {
"owner": "syberant",
"repo": "nix-neovim",
"type": "github"
}
},
"nix-packages": {
"inputs": {
"attic": [
@ -1767,6 +1787,7 @@
"home-manager": "home-manager",
"hosts-list": "hosts-list",
"hydra": "hydra",
"nix-neovim": "nix-neovim",
"nix-packages": "nix-packages",
"nixos-config-for-netboot": "nixos-config-for-netboot",
"nixos-hardware": "nixos-hardware_2",

View file

@ -59,6 +59,10 @@ rec {
#inputs.nix.follows = "nix";
#inputs.nixpkgs.follows = "nixpkgs";
};
nix-neovim = {
url = "github:syberant/nix-neovim";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-packages = {
url = "git+https://git.chir.rs/darkkirb/nix-packages.git?ref=main";
inputs.attic.follows = "attic";
@ -193,6 +197,36 @@ rec {
];
};
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
packages.x86_64-linux = let
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [self.overlays.x86_64-linux];
};
in {
neovim-base = args.nix-neovim.buildNeovim {
inherit pkgs;
configuration = import ./config/programs/vim/configuration.nix false;
};
neovim = args.nix-neovim.buildNeovim {
inherit pkgs;
configuration = import ./config/programs/vim/configuration.nix true;
};
};
packages.aarch64-linux = let
pkgs = import nixpkgs {
system = "aarch64-linux";
overlays = [self.overlays.aarch64-linux];
};
in {
neovim-base = args.nix-neovim.buildNeovim {
inherit pkgs;
configuration = import ./config/programs/vim/configuration.nix false;
};
neovim = args.nix-neovim.buildNeovim {
inherit pkgs;
configuration = import ./config/programs/vim/configuration.nix true;
};
};
hydraJobs =
(builtins.listToAttrs (map
({
@ -208,6 +242,7 @@ rec {
systems))
// {
inherit devShell;
inherit packages;
# Uncomment the line to build an installer image
# This is EXTREMELY LARGE and will make builds take forever
# installer.x86_64-linux = nixosConfigurations.installer.config.system.build.isoImage;