fix: Configure Neovim using a wrappers

This commit is contained in:
Madeleine Sydney
2024-12-29 19:59:56 -07:00
parent 4f3d5579e7
commit 8b86c01550
2 changed files with 50 additions and 12 deletions

View File

@@ -15,6 +15,23 @@ A second try at NixOS, now that I have a better idea of what I'm doing. The effo
Modules, but lightweight.
* Principles
** User configuration
In order of descending preference, user programs should be configured by...
1. Wrappers, with config files optionally living somewhere under =/persist/dots=.
2. home-manager's modules.
3. ~home.file~ and similar.
4. Mutable symlinks using ~home.file~ and ~mkOutOfStoreSymlink~.
* Conventions
** Impermanence and persistence
- Persistent files to be linked into ~/~ go under ~/persist/root~
* Tasks
** Emacs
@@ -166,6 +183,10 @@ Or Qtile
Or Niri
** TODO Convenient way to wrap programs
[[https://github.com/viperML/wrapper-manager][wrapper-manager]] looks like it will be really annoying to integrate into my config without a NixOS/HM module.
** TODO tf2.nix
- declaratively configure tf2
@@ -228,10 +249,6 @@ https://discourse.nixos.org/t/what-to-do-with-a-full-boot-partition/2049
Remove a given host from =~/.ssh/known_hosts=. Something like =sed -i -e '/192.168.122.54/d' .ssh/known_hosts=.
* Impermanence and persistence
- Persistent files to be linked into ~/~ go under ~/persist/root~
* References
Following is a subset of the many places I've learnt from.
@@ -242,3 +259,5 @@ Following is a subset of the many places I've learnt from.
- [[https://github.com/hlissner/dotfiles/][hlissner/dotfiles]]
- [[https://github.com/Shawn8901/nix-configuration/tree/af71d51998a6772a300f842795b947e27202fa73][Shawn8901/nix-configuration]]
- [cite:@christensen2020erase]
- [cite:@ayats2024dropping]
- [cite:@zaynetdinov2024you]

View File

@@ -1,12 +1,31 @@
{ config, lib, pkgs, ... }:
{
home.file.".vimrc".text = ''
let
my-vimrc =
pkgs.writeTextFile {
name = "vimrc";
text = ''
imap jk <ESC>
xmap JK <ESC>
set number
set relativenumber
'';
};
xdg.configFile."nvim/init.vim".text = ''
so ~/.vimrc
my-neovim =
pkgs.symlinkJoin {
name = "neovim";
paths = [ pkgs.neovim ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/nvim \
--add-flags "-u ${my-vimrc}"
# Symlink {v,vi,vim} to nvim.
for i in {v,vi,vim}; do
ln -s $out/bin/nvim $out/bin/$i
done
'';
};
in {
home.packages = [ my-neovim ];
}