30 Nov 2026
Planet Debian
Sergio Cipriano: Mixing Debian-packaged Neovim plugins with Lazy.nvim
Mixing Debian-packaged Neovim plugins with Lazy.nvim
I've been packaging Neovim plugins for Debian for some time, and a few other people are doing the same. Debian unstable now ships a good number of Neovim plugins. I wanted my config to use these packages, both to dogfood and test them and to gradually migrate to them.
However, I still rely on plugins that aren't available in the archive. So I figured out how to make Lazy work with Debian packages.
Why are we packaging plugins in the first place?
The main advantage of packaging plugins in Debian is that it takes some of the maintenance burden off users.
Many Neovim plugins don't have formal releases, so it's not always obvious when it's safe to upgrade. Sometimes, a needed fix comes bundled with new features that require a newer Neovim version than the one available in Debian.
By packaging them, we can ensure they're tested and work with the Neovim version shipped in Debian. That way, users get stable, compatible updates without having to track upstream changes themselves.
I'm already doing this work whenever I need to update plugins or Neovim on my machine, so packaging them just formalizes the process and makes the benefits available to everyone.
Here's the full list of plugins I'm planning to package to complete my goal of having my Neovim-as-IDE setup available in Debian:
https://people.debian.org/~cipriano/nvim-as-ide-plugins/neovim-plugins.html
Where Debian puts the plugins
First, a bit of context. Every neovim-* package installs its plugin into Neovim's system-wide package directory:
/usr/share/nvim/site/pack/dist-bundle/start/<name>
Normally, Neovim automatically loads plugins found under start/ at startup. If I weren't using plugins that aren't packaged yet, my configuration would be pretty straightforward.
The layout
This is how I organize my configuration:
├── init.lua
├── lazy-lock.json
├── lua
│ ├── helpers
│ │ ├── debian.lua
│ │ ├── icons.lua
│ │ ├── language_servers.lua
│ │ └── treesitter_langs.lua
│ ├── keymaps.lua
│ ├── keymaps_plugins.lua
│ ├── Lazy.lua
│ ├── options.lua
│ ├── plugins
│ │ └── <plugin-name>.lua
│ └── plugins_debian
│ ├── libs.lua
│ └── <plugin-name>.lua
lua/plugins holds the plugins that don't have a Debian package, while lua/plugins_debian holds the ones that do. Lazy imports both directories:
require("lazy").setup({
{ import = "plugins" },
{ import = "plugins_debian" }, -- Uses the .deb when installed, see lua/helpers/debian.lua
}, {...}This separation isn't strictly necessary, as we'll see later. I just find it useful for keeping track of which plugins are already packaged and which ones still need work.
The whole trick
Lazy supports a dir field in a plugin spec, which is intended for local plugins. When dir is set, Lazy loads the plugin from that directory instead of cloning its repository.
When dir is nil, Lazy behaves as if the field wasn't set and uses the repository specified in the plugin spec instead.
That's why I have lua/helpers/debian.lua, which contains a single helper function. It returns the dist-bundle directory if the package is installed, and nil otherwise:
return function(name)
local dir = "/usr/share/nvim/site/pack/dist-bundle/start/" .. name
return vim.uv.fs_stat(dir) and dir or nil
endWith this function, we can write something like this:
local deb = require("helpers.debian")
return {
"tpope/vim-fugitive",
dir = deb("fugitive"),
event = "BufReadPre",
}If the Debian package is installed, Lazy uses it. Otherwise, it falls back to cloning the repository as usual.
This also means I can use the same configuration on my work machine, which runs Ubuntu and doesn't have all the packages available in Debian unstable.
To check where each plugin is coming from, just open :Lazy and look at its path. After installing a new Debian package, I can manually run :Lazy clean to remove the old Git clone.
Optional packages
Another useful feature is being able to enable plugins only when certain packages are installed.
For example, vimtex will only work if I have the vim-vimtex package installed. I use Lazy's enabled field to enforce this:
local deb = require("helpers.debian")
local vimtex_dir = deb("vimtex")
return {
"lervag/vimtex",
dir = vimtex_dir,
enabled = vimtex_dir ~= nil,
...
}This way, Lazy won't try to clone or load vimtex on machines where the Debian package isn't installed.
Lazy does not load start packages automatically
There's one more thing to keep in mind: every plugin I want to use needs a spec, even the ones that don't require any configuration.
This is what plugins_debian/libs.lua is for:
-- Plugins without configuration, used as dependencies by others.
local deb = require("helpers.debian")
return {
-- neovim-plenary
{ "nvim-lua/plenary.nvim", dir = deb("plenary") },
-- neovim-promise-async
{ "kevinhwang91/promise-async", dir = deb("promise-async") },
-- neovim-telescope-fzf-native
{ "nvim-telescope/telescope-fzf-native.nvim", dir = deb("telescope-fzf-native.nvim"), build = "make" },
}The reason for this is that Lazy takes over the plugin loading process and sets loadplugins=false, effectively disabling Neovim's normal plugin loading mechanism.
As a result, the plugin/ scripts inside dist-bundle/start aren't automatically sourced. Lazy needs to manage these plugins itself, which is why they must be included in its specs.
neovim-treesitter caveats
There are a few additional details worth mentioning when using Debian-packaged plugins.
The Debian package for nvim-treesitter disables the :TSInstall and :TSUpdate commands through a patch, but the Lua API for installing parsers is still available.
I use the get_installed() function to check which parsers are missing and install them automatically.
This is another part of the setup I still want to improve, I'd like to use parsers packaged in Debian instead of downloading and compiling them separately.
Here's my nvim-treesitter configuration:
local deb = require("helpers.debian")
-- Lua install() still works: it downloads each parser tarball with curl, extracts
-- it with tar and compiles it with `tree-sitter build` (which calls cc).
local required_executables = { "curl", "tar", "tree-sitter", "cc" }
local function install_parser()
local ts = require("nvim-treesitter")
local installed = ts.get_installed("parsers")
local missing = vim.tbl_filter(function(lang)
return not vim.list_contains(installed, lang)
end, require("helpers.treesitter_langs"))
if #missing == 0 then
return
end
local missing_exes = vim.tbl_filter(function(exe)
return vim.fn.executable(exe) == 0
end, required_executables)
if #missing_exes > 0 then
vim.notify(
(
"nvim-treesitter: cannot install parsers (%s), missing executables: %s\n"
.. "sudo apt install curl tree-sitter-cli gcc libc6-dev"
):format(table.concat(missing, ", "), table.concat(missing_exes, ", ")),
vim.log.levels.WARN
)
return
end
ts.install(missing)
end
return {
"nvim-treesitter/nvim-treesitter",
dir = deb("nvim-treesitter"),
...
config = function()
install_parser()
vim.api.nvim_create_autocmd("FileType", {...})
end,
}I also check for the required executables before attempting installation. Otherwise, the installation can fail silently without making it particularly obvious why.
It's not necessarily the best solution, but it works for now.
What's left
Maybe we can have a Debian package called neovim-as-ide or something similar in the future. Who knows? It would be useful to have an easy way to set up a complete Neovim environment by simply running apt install.
The end goal is to get rid of Lazy entirely. Once everything is packaged, Neovim can load the plugins directly from dist-bundle/start, and the configuration will just consist of setup() calls.
Until then, a dir field and a four-line helper are enough to make apt and Lazy work together.
30 Nov 2026 5:14pm GMT
Russell Coker: Links November 2026
Elvira Bary wrote an insightful article about the Russian slave mentality [4].
Paul Krugman makes the case for nationalising Starlink [9].
TheDailyWTF has an ammusing and insightful article about how to avoid being honeypotted [22].
Bruce Schneier wrote an insightful article Humans Have Rights Machines Do Not [23].
- [1] https://tinyurl.com/25ybnfem
- [2] https://tinyurl.com/2257wz3o
- [3] https://tinyurl.com/2afhdbfq
- [4] https://tinyurl.com/23kocvfz
- [5] https://www.youtube.com/watch?v=UytYrhYLOKI
- [6] https://www.thedial.world/articles/news/ai-book-scams
- [7] https://tinyurl.com/24fqfunq
- [8] https://longnow.org/ideas/to-save-it-eat-it/
- [9] https://tinyurl.com/27yvvajo
- [10] https://tinyurl.com/27r4xg4y
- [11] https://tinyurl.com/2ckqyj76
- [12] https://tinyurl.com/2ycopp9b
- [13] https://tinyurl.com/27nqwodu
- [14] https://tinyurl.com/292xlv7l
- [15] https://tinyurl.com/26wqo55p
- [16] https://tinyurl.com/27xp8h8q
- [17] https://tinyurl.com/2davcvl5
- [18] https://tinyurl.com/26sjzrqv
- [19] https://tinyurl.com/23j3p2of
- [20] https://tinyurl.com/27s5r3qr
- [21] https://tinyurl.com/2dbvumxg
- [22] https://tinyurl.com/24bd9p2r
- [23] https://tinyurl.com/2bcnl4h3
30 Nov 2026 3:53am GMT
29 Nov 2026
Planet Debian
Sam Hartman: AI and Sexuality: ORPO Alignment
When I last wrote about my work on AI and sexuality back in September of 2023, I was talking about emotional safety and interacting with AI and how devastating it can be to be told again and again by guardrails that you are triggering that the work you are doing is wrong and should not be done.
Since then, I have continued to work on exploring what sex-positive AI would look like. I have taught classes, put together a lot of code, and I have been so busy working that I have not had much of a chance to write about it. So I have built up a series of posts that I need to write. This is the first of those posts.
Aligning Models for Niche Domains
The first area I want to go into is what I have learned about aligning and fine-tuning models to fit the needs of a niche domain. For example, the intimacy-positive community.
I want to talk about an amazing tool that I found called Odds Ratio Preference Optimization (ORPO). The goal of ORPO is to provide results similar to reinforcement learning (RL) to better align models with a specific domain without needing the huge memory of other methods of reinforcement learning.
The Challenge of Reinforcement Learning
One of the big challenges of reinforcement learning is the amount of resources required both in terms of memory and data. You need a policy model and a reference model, which means that you are doubling the memory footprint of training, which is already an unbelievable memory hog.
But what is even worse is that you need enough data to construct a classifier that can figure out whether a particular training example is good in your environment. For example, in the work I am doing, I would need to come up with a classifier that was able to say, yes, some particular interaction with a model represented intimacy in the kind of constructive way I am looking for, or to say that it did not.
Having such a classifier would be a really great tool, but developing it is a lot of work in an area where finding good high-quality data is already difficult. Once I had such a classifier, I would then need enough training data to effectively use the classifier and move the model forward.
Supervised Fine-Tuning
What people often do instead when they are looking at low data training is something called supervised fine-tuning.
In supervised fine-tuning, you simply run a series of training examples through the model and effectively tell the model, yes, produce more examples like this. Effectively, what happens in training is that there is a loss function that identifies how far the actual behavior of the model is differing from the desired behavior of the model.
In supervised fine-tuning, all we give the model is an example showing what we wish it did. But we do not give it any information about what it is doing wrong. Let us say that I had an example where I asked a question about intimacy and the model, rather than answering my question, said that guardrails prevented the model from answering the question.
And then in my training, I had an example that was a response to the question that was a bulleted list rather than a refusal. With supervised fine-tuning, the trainer does not actually know whether the thing I wish the model would do differently is respond to my question or respond in a bulleted list rather than in straight prose. And so supervised fine-tuning is going to distribute the loss among all of those differences, rather than focusing the changes it makes to the model on the differences that actually matter to the training I want to achieve.
How ORPO Takes a Different Approach
ORPO takes a different approach. Instead, ORPO datasets include a positive example-so, a question you ask the model and its response-as well as a negative example-the same question and a response that you do not like. The loss function focuses on the difference between the positive and the negative example.
For example, if you ask a model to write a story and all of the model's stories about intimacy tend to involve alcohol, then by producing some examples where you provide similar stories to what the model would have written on its own, without the emphasis on alcohol as a way to approach vulnerability, you can focus the loss energy on changing the model to have less of an emphasis on approaching intimacy from altered states.
Democratizing AI Fine-Tuning
In my mind, ORPO provides an amazing way to democratize AI fine-tuning. We can use it even with relatively small datasets to change the behavior of models and start aligning them to our needs. By requiring less data and less memory for training, ORPO allows us to make training of open-weight models available to a larger group of people and allows us to take control of AI in ways that other training techniques make more difficult.
comments
29 Nov 2026 9:10pm GMT