Compare commits

..

16 commits

Author SHA1 Message Date
af6d975129 make quarto load optional on r or markdown cat 2026-05-21 21:15:50 +10:00
6226a1c9b1 make lua package loading conditional on cat 2026-05-21 21:10:30 +10:00
d23c7f6f51 load packages only if installed 2026-05-21 20:04:45 +10:00
74600519a5 Simplified codebase 2026-05-21 18:45:36 +10:00
ad9473a916 different ls 2026-05-19 13:28:40 +10:00
bfd4ba417d remove languageserver package from config 2026-05-19 13:18:29 +10:00
4d28d0d490 fix for codecompanion 2026-05-19 13:15:29 +10:00
8811591fe0 Move to bundled R.nvim + rnvimserver without override 2026-05-14 00:52:03 +10:00
22809d94cd update 2026-05-13 13:28:55 +10:00
55866137ba cleanup 2026-05-13 12:30:36 +10:00
1055522af9 moved r-nvim to flake build 2026-05-13 12:30:17 +10:00
07d2156dfb fixed R.nvim 2026-05-12 15:58:31 +10:00
4884bf685f up 2026-05-07 10:48:37 +10:00
ed24f176bc feat(r): add R languageserver for Neovim LSP
- Add languageserver to settings.lang_packages.r
- Enable r_language_server in LSP config (plugin/25_lsp.lua)
2026-05-03 16:58:11 +10:00
e9c99811d4 feat(devshell): add language tools conditionally based on cats
- Extract mkWrapperConfig to share cats/settings between package and devshell
- Add python, R, julia, and markdown packages to devShells when their cats are enabled
- Reuse same package construction logic as specs/deps.nix for consistency
- Keep lang_packages overridable via lib.mkDefault for downstream flakes
2026-05-03 16:35:56 +10:00
603a02b627
Merge pull request #7 from dwinkler1/copilot/fix-quarto-functionality-with-r
fix: load quarto-nvim and otter-nvim when only R spec is active
2026-04-29 17:40:57 +10:00
21 changed files with 341 additions and 395 deletions

5
.Rprofile Normal file
View file

@ -0,0 +1,5 @@
if (Sys.getenv("RNVIM_TMPDIR") == "") {
options(defaultPackages = c("utils", "grDevices", "graphics", "stats", "methods"))
} else {
options(defaultPackages = c("utils", "grDevices", "graphics", "stats", "methods", "nvimcom"))
}

View file

@ -0,0 +1,9 @@
# nix
- For R.nvim in the Nix wrapper, both RNVIM_COMPLDIR (C server compilation) and a writable R_LIBS_USER directory (nvimcom R package installation) must be configured — fixing only one leaves permission errors in the other. Confidence: 0.65
- For R.nvim writable directories (RNVIM_COMPLDIR, R_LIBS_USER, TMPDIR), prefer project-local paths (e.g., $PWD/.Rlibs) over global cache paths — the cache approach may let the build succeed but still fail at runtime. Confidence: 0.70
- Do not use lib.mkDefault on values consumed by lib.optionals or other boolean-checking functions — mkDefault wraps values in a priority set that fails "expected a Boolean" at evaluation time. Use plain booleans for inline conditionals, reserving mkDefault for module options resolved by the merge system. Confidence: 0.70
# Taste (Continuously Learned by [CommandCode][cmd])
[cmd]: https://commandcode.ai/

45
flake.lock generated
View file

@ -22,11 +22,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1776169885, "lastModified": 1778869304,
"narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=", "narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9", "rev": "d233902339c02a9c334e7e593de68855ad26c4cb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -55,19 +55,43 @@
"plugins-r": { "plugins-r": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1776340770, "lastModified": 1776905071,
"narHash": "sha256-o/8UZIc/Bq9dWTjA+MpSR5uMUpE7KHTErk+TwWID8Ww=", "narHash": "sha256-dXox6qEs1VDE7vPNDoN8bY4g06uj1IEs6uki72w8lpA=",
"owner": "R-nvim", "owner": "R-nvim",
"repo": "R.nvim", "repo": "R.nvim",
"rev": "b9cfffeb9b4e484aa9e13f01c0eb80230aada455", "rev": "582f2af11290ac067e49018db38e12a511325556",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "R-nvim", "owner": "R-nvim",
"ref": "v0.99.4",
"repo": "R.nvim", "repo": "R.nvim",
"type": "github" "type": "github"
} }
}, },
"r-nvim-nix": {
"inputs": {
"nixpkgs": [
"rixpkgs"
],
"rnvimsrc": [
"plugins-r"
]
},
"locked": {
"lastModified": 1778684156,
"narHash": "sha256-Z4y1tQfkIsPK4NRxGn668HMDfWxnxNxSJ0CAOOXiIfY=",
"owner": "dwinkler1",
"repo": "r_nvim_nix",
"rev": "2f49dfee27886068e2f49cbd54558ce4cc424c82",
"type": "github"
},
"original": {
"owner": "dwinkler1",
"repo": "r_nvim_nix",
"type": "github"
}
},
"rixpkgs": { "rixpkgs": {
"locked": { "locked": {
"lastModified": 1771303851, "lastModified": 1771303851,
@ -79,8 +103,8 @@
}, },
"original": { "original": {
"owner": "dwinkler1", "owner": "dwinkler1",
"ref": "nixpkgs",
"repo": "rixpkgs", "repo": "rixpkgs",
"rev": "af2dd3f7b4b172077747c0869d4e30702fb71b0e",
"type": "github" "type": "github"
} }
}, },
@ -90,6 +114,7 @@
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"plugins-cmp-pandoc-references": "plugins-cmp-pandoc-references", "plugins-cmp-pandoc-references": "plugins-cmp-pandoc-references",
"plugins-r": "plugins-r", "plugins-r": "plugins-r",
"r-nvim-nix": "r-nvim-nix",
"rixpkgs": "rixpkgs", "rixpkgs": "rixpkgs",
"wrappers": "wrappers" "wrappers": "wrappers"
} }
@ -101,11 +126,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1776375800, "lastModified": 1779297405,
"narHash": "sha256-/SSAR77Brr9fbapsh1cb2K47JXCbvwS1GjM4yyDxle8=", "narHash": "sha256-VFoBwH7ZjVxCnvZTb5ODRXt70sLtWMxstive0N+RS50=",
"owner": "BirdeeHub", "owner": "BirdeeHub",
"repo": "nix-wrapper-modules", "repo": "nix-wrapper-modules",
"rev": "f11469ca69068bac13d9e163b2bd268cc06dff57", "rev": "e7ed7a1205945befdf2e0d73ba7df91d935e5af1",
"type": "github" "type": "github"
}, },
"original": { "original": {

197
flake.nix
View file

@ -1,16 +1,19 @@
# Copyright (c) 2026 BirdeeHub # Copyright (c) 2026 Daniel
# Licensed under the MIT license # Licensed under the MIT license
{ {
description = "Daniel's NixCats"; description = "Daniel's NixCats";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
#nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
wrappers = { wrappers = {
url = "github:BirdeeHub/nix-wrapper-modules"; url = "github:BirdeeHub/nix-wrapper-modules";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
rixpkgs.url = "github:dwinkler1/rixpkgs/nixpkgs"; rixpkgs.url = "github:dwinkler1/rixpkgs/af2dd3f7b4b172077747c0869d4e30702fb71b0e";
r-nvim-nix.url = "github:dwinkler1/r_nvim_nix";
r-nvim-nix.inputs.rnvimsrc.follows = "plugins-r";
r-nvim-nix.inputs.nixpkgs.follows = "rixpkgs";
fran = { fran = {
url = "github:dwinkler1/fran"; url = "github:dwinkler1/fran";
@ -20,7 +23,7 @@
}; };
"plugins-r" = { "plugins-r" = {
url = "github:R-nvim/R.nvim"; url = "github:R-nvim/R.nvim/v0.99.4";
flake = false; flake = false;
}; };
@ -36,45 +39,34 @@
wrappers, wrappers,
... ...
} @ inputs: let } @ inputs: let
mkWrapperConfig = pkgs: {
cats = {
clickhouse = false;
gitPlugins = true;
julia = false;
lua = true;
markdown = true;
nix = true;
optional = false;
python = false;
r = true;
};
settings = {
lang_packages = {
python = [];
r = [];
julia = [];
};
};
binName = "vv";
};
wrapperSettings = pkgs: let wrapperSettings = pkgs: let
def = pkgs.lib.mkDefault; cfg = mkWrapperConfig pkgs;
in in
wrapper.config.wrap { wrapper.config.wrap {
inherit pkgs; inherit pkgs;
cats = { inherit (cfg) settings binName;
clickhouse = def false;
gitPlugins = def true;
julia = def false;
lua = def true;
markdown = def false;
nix = def true;
optional = def false;
python = def false;
r = def false;
};
settings = {
lang_packages = {
python = with pkgs.python3Packages; [
duckdb
polars
];
r = with pkgs.rpkgs.rPackages; [
arrow
broom
data_table
janitor
styler
];
julia = ["DataFramesMeta" "QuackIO"];
};
colorscheme = def "cyberdream";
background = def "dark";
wrapRc = def true;
};
binName = def "vv";
}; };
systems = [ systems = [
@ -85,54 +77,39 @@
forAllSystems = nixpkgs.lib.genAttrs systems; forAllSystems = nixpkgs.lib.genAttrs systems;
extra_pkg_config = {
# allowUnfree = true;
};
overlayDefs = import ./overlays inputs; overlayDefs = import ./overlays inputs;
dependencyOverlays = overlayDefs.dependencyOverlays;
dependencyOverlay = overlayDefs.dependencyOverlay;
mkPkgs = system: mkPkgs = system:
import nixpkgs { import nixpkgs {
inherit system; inherit system;
config = extra_pkg_config; config = { allowUnfree = true; };
overlays = [dependencyOverlay]; overlays = [ overlayDefs.dependencyOverlay ];
}; };
module = nixpkgs.lib.modules.importApply ./modules/neovim.nix inputs; module = (import ./modules/neovim.nix) inputs;
wrapper = wrappers.lib.evalModule module; wrapper = wrappers.lib.evalModule module;
in { in {
overlays = { overlays = {
# overlay `vv` wraps the module with default settings only.
# For the fully-configured binary (including mkWrapperConfig overrides),
# use `packages.<system>.default` instead.
default = nixpkgs.lib.composeManyExtensions [ default = nixpkgs.lib.composeManyExtensions [
dependencyOverlay overlayDefs.dependencyOverlay
(final: prev: { (final: prev: {
vv = wrapper.config.wrap {pkgs = final;}; vv = wrapper.config.wrap {pkgs = final;};
}) })
]; ];
dependencies = dependencyOverlay; dependencies = overlayDefs.dependencyOverlay;
vv = self.overlays.default;
}; };
wrapperModules = { wrapperModules.default = module;
default = module; wrapperConfigs.default = wrapper.config;
neovim = self.wrapperModules.default;
};
wrappers = {
default = wrapper.config;
neovim = self.wrappers.default;
};
packages = forAllSystems ( packages = forAllSystems (
system: let system: let
pkgs = mkPkgs system; pkgs = mkPkgs system;
nvimPkg = wrapperSettings pkgs;
in { in {
default = nvimPkg; default = wrapperSettings pkgs;
vv = nvimPkg;
} }
); );
@ -147,13 +124,79 @@
system: let system: let
pkgs = mkPkgs system; pkgs = mkPkgs system;
nvimPkg = wrapperSettings pkgs; nvimPkg = wrapperSettings pkgs;
pythonPkgs = with pkgs.python3Packages; [
duckdb
polars
];
rPkgs = (with pkgs.rpkgs.rPackages; [
arrow
broom
data_table
janitor
languageserver
styler
]) ++ [ pkgs.nvimcom ];
juliaPkgs = ["DataFramesMeta" "QuackIO"];
pythonPackages = let
python_packages_fn =
if pkgs ? basePythonPackages
then ps: pkgs.basePythonPackages ps ++ pythonPkgs
else _: pythonPkgs;
in
with pkgs; [
(python3.withPackages python_packages_fn)
nodejs
ruff
basedpyright
uv
];
rPackages = let
r_packages = (pkgs.baseRPackages or []) ++ rPkgs;
in
with pkgs; [
(rWrapper.override {packages = r_packages;})
radianWrapper
(quarto.override {extraRPackages = r_packages;})
air-formatter
yaml-language-server
updateR
nvimcom
rnvimserver
];
juliaPackages = let
julia_with_packages = pkgs.julia-bin.withPackages juliaPkgs;
in [julia_with_packages];
markdownPackages = with pkgs; [
python313Packages.pylatexenc
quarto
zk
];
shellPackages =
[nvimPkg]
++ pkgs.lib.optionals wrapper.config.cats.python pythonPackages
++ pkgs.lib.optionals wrapper.config.cats.r rPackages
++ pkgs.lib.optionals wrapper.config.cats.julia juliaPackages
++ pkgs.lib.optionals wrapper.config.cats.markdown markdownPackages;
in { in {
default = pkgs.mkShell { default = pkgs.mkShell {
name = "vShell"; name = "vShell";
packages = [nvimPkg]; packages = shellPackages;
nativeBuildInputs = with pkgs; [] ++ (pkgs.lib.optionals self.wrappers.default.cats.optional [devenv]); nativeBuildInputs = pkgs.lib.optionals wrapper.config.cats.optional [ pkgs.devenv ];
inputsFrom = []; shellHook = ''
shellHook = ""; echo 'I am a NixShell'
export R_HOME=$(R RHOME)
export R_LIBS_SITE=$(strings "$(command -v R)" | grep -oP '/nix/store/[^:]+/library' | sort -u | paste -sd: -)
export R_LIBS_USER="$PWD/.r-libs"
mkdir -p "$R_LIBS_USER"
'';
}; };
} }
); );
@ -163,18 +206,11 @@
pkgs = mkPkgs system; pkgs = mkPkgs system;
nvimPkg = wrapperSettings pkgs; nvimPkg = wrapperSettings pkgs;
in { in {
default = nvimPkg; default = pkgs.runCommand "check-vv" {} ''
module-eval = let
_ = wrapper.config;
in
pkgs.runCommand "check-module-eval" {} ''
echo "Module evaluation successful" > $out
'';
package-build = pkgs.runCommand "check-vv" {} ''
BINARY_PATH="${nvimPkg}/bin/vv" BINARY_PATH="${nvimPkg}/bin/vv"
if [ ! -x "$BINARY_PATH" ]; then if [ ! -x "$BINARY_PATH" ]; then
echo "Error: Binary n not found or not executable" echo "Error: Binary not found or not executable"
exit 1 exit 1
fi fi
@ -187,6 +223,11 @@
cat version_output.txt >> $out cat version_output.txt >> $out
fi fi
''; '';
module-eval =
let _ = wrapper.config;
in pkgs.runCommand "check-module-eval" {} ''
echo "Module evaluation successful" > $out
'';
} }
); );

View file

@ -1,4 +1,6 @@
-- Add the key mappings only for Markdown files in a zk notebook. -- Add the key mappings only for Markdown files in a zk notebook.
local nix = require("config.nix")
if nix.get_cat("markdown", false) then
if require("zk.util").notebook_root(vim.fn.expand('%:p')) ~= nil then if require("zk.util").notebook_root(vim.fn.expand('%:p')) ~= nil then
local map = vim.keymap.set local map = vim.keymap.set
-- Open the link under the caret. -- Open the link under the caret.
@ -30,3 +32,4 @@ if require("zk.util").notebook_root(vim.fn.expand('%:p')) ~= nil then
{ noremap = true, silent = false, buffer = true, desc = "Code actions" }) { noremap = true, silent = false, buffer = true, desc = "Code actions" })
end end
end

View file

@ -14,7 +14,6 @@
Available categories: Available categories:
- clickhouse: Clickhouse client and tools - clickhouse: Clickhouse client and tools
- customPlugins: local plugin specs
- external: external tools and integrations - external: external tools and integrations
- general: core Neovim plugins/features - general: core Neovim plugins/features
- gitPlugins: git-related plugins - gitPlugins: git-related plugins
@ -25,7 +24,6 @@
- optional: optional tools and utilities - optional: optional tools and utilities
- python: Python tooling and plugins - python: Python tooling and plugins
- r: R tooling and plugins - r: R tooling and plugins
- test: test-only tooling (disabled by default)
- treesitterParsers: Treesitter parsers - treesitterParsers: Treesitter parsers
- utils: general utilities - utils: general utilities
''; '';
@ -33,18 +31,16 @@
config.cats = { config.cats = {
clickhouse = lib.mkDefault false; clickhouse = lib.mkDefault false;
customPlugins = lib.mkDefault true;
external = lib.mkDefault true; external = lib.mkDefault true;
general = lib.mkDefault true; general = lib.mkDefault true;
gitPlugins = lib.mkDefault true; gitPlugins = lib.mkDefault true;
julia = lib.mkDefault false; julia = lib.mkDefault false;
lua = lib.mkDefault true; lua = lib.mkDefault true;
markdown = lib.mkDefault false; markdown = lib.mkDefault true;
nix = lib.mkDefault true; nix = lib.mkDefault true;
optional = lib.mkDefault false; optional = lib.mkDefault false;
python = lib.mkDefault false; python = lib.mkDefault false;
r = lib.mkDefault false; r = lib.mkDefault true;
test = lib.mkDefault false;
treesitterParsers = lib.mkDefault true; treesitterParsers = lib.mkDefault true;
utils = lib.mkDefault true; utils = lib.mkDefault true;
}; };

View file

@ -16,7 +16,7 @@
# Lua packages available to neovim (for :lua require()) # Lua packages available to neovim (for :lua require())
config.settings.nvim_lua_env = lp: config.settings.nvim_lua_env = lp:
lib.optionals (config.cats.general or false) [ lp.tiktoken_core ]; lib.optionals (config.cats.general or true) [ lp.tiktoken_core ];
# Binary name for the wrapper # Binary name for the wrapper
config.binName = lib.mkDefault "vv"; config.binName = lib.mkDefault "vv";
@ -25,10 +25,10 @@
config.settings.block_normal_config = true; config.settings.block_normal_config = true;
# Don't symlink the config (we wrap it instead) # Don't symlink the config (we wrap it instead)
config.settings.dont_link = false; config.settings.dont_link = lib.mkDefault false;
# Create additional aliases for the binary # Create additional aliases for the binary
config.settings.aliases = [ "vvim" ]; config.settings.aliases = lib.mkDefault [ "vvim" ];
# Enable wrapper handling of spec runtimeDeps (template pattern). # Enable wrapper handling of spec runtimeDeps (template pattern).
config.settings.autowrapRuntimeDeps = true; config.settings.autowrapRuntimeDeps = true;

View file

@ -7,16 +7,21 @@
# Environment variables set for the wrapper. # Environment variables set for the wrapper.
# These are available when running neovim. # These are available when running neovim.
config.env = lib.mkMerge [ config.env = lib.mkMerge [
(lib.mkIf (config.cats.python or false) { (lib.mkIf (config.cats.python or true) {
UV_PYTHON_DOWNLOADS = "never"; UV_PYTHON_DOWNLOADS = "never";
UV_PYTHON = pkgs.python.interpreter; UV_PYTHON = pkgs.python.interpreter;
}) })
(lib.mkIf (config.cats.r or true) {
RNVIM_COMPLDIR = "$PWD/.r-compl";
R_LIBS_USER = "${pkgs.nvimcom}/library:$PWD/.Rlibs";
TMPDIR = "$PWD/.r-tmp";
})
]; ];
# Environment variables with defaults (can be overridden by user) # Environment variables with defaults (can be overridden by user)
config.envDefault = lib.mkMerge [ config.envDefault = lib.mkMerge [
(lib.mkIf (config.cats.r or false) { (lib.mkIf (config.cats.r or true) {
R_LIBS_USER = "./.Rlibs"; R_LIBS_USER = "${pkgs.nvimcom}/library:$PWD/.Rlibs";
}) })
]; ];
} }

View file

@ -15,7 +15,7 @@
nvim-host.enable = true; nvim-host.enable = true;
nvim-host.package = "${pkgs.neovide}/bin/neovide"; nvim-host.package = "${pkgs.neovide}/bin/neovide";
nvim-host.argv0 = "neovide"; nvim-host.argv0 = "neovide";
nvim-host.flags."--neovim-bin" = "${placeholder "out"}/bin/${config.binName}"; nvim-host.flags."--neovim-bin" = "${builtins.placeholder "out"}/bin/${config.binName}";
}; };
m = { m = {

View file

@ -26,7 +26,7 @@
}; };
default = { }; default = { };
description = '' description = ''
Language-specific package overrides appended to each language spec's extraPackages. Language-specific package overrides appended to each language spec's runtimePackages.
Intended for flake.nix overrides via wrapper.config.wrap. Intended for flake.nix overrides via wrapper.config.wrap.
''; '';
}; };

View file

@ -10,14 +10,13 @@ let
let let
is_enabled = if spec ? enable then spec.enable else true; is_enabled = if spec ? enable then spec.enable else true;
has_runtime_deps = (spec.runtimeDeps or false) == runtime_deps_type; has_runtime_deps = (spec.runtimeDeps or false) == runtime_deps_type;
packages = spec.extraPackages or [ ]; packages = spec.runtimePackages or [ ];
in in
acc ++ lib.optionals (is_enabled && has_runtime_deps) packages acc ++ lib.optionals (is_enabled && has_runtime_deps) packages
) )
[ ]; [ ];
prefix_packages = collect_runtime_packages "prefix"; prefix_packages = collect_runtime_packages "prefix";
suffix_packages = collect_runtime_packages "suffix";
to_path_specs = packages: [ to_path_specs = packages: [
{ {
@ -31,5 +30,4 @@ let
in in
{ {
config.prefixVar = lib.optionals (prefix_packages != [ ]) (to_path_specs prefix_packages); config.prefixVar = lib.optionals (prefix_packages != [ ]) (to_path_specs prefix_packages);
config.suffixVar = lib.optionals (suffix_packages != [ ]) (to_path_specs suffix_packages);
} }

View file

@ -1,51 +0,0 @@
{ config, lib, ... }:
{
# This module implements category-based enabling of specs.
# It runs early (order 200) so other specMaps can see the enable flags.
#
# How it works:
# 1. For each spec, extract its name (removing -lazy suffix if present)
# 2. Check if there's a corresponding cats.<name> toggle
# 3. Set spec.value.enable based on the cats toggle (default: true)
# 4. This allows specs to be conditionally included based on config.cats settings
#
# Example: If config.cats.python = false, then specs.python.enable = false
config.specMaps = lib.mkOrder 200 [
{
name = "CATS_ENABLE";
data =
list:
map (
v:
if v.type == "spec" || v.type == "parent" then
let
# Extract spec name, handling lazy specs (remove -lazy suffix)
specName =
if v.name == null then
null
else if lib.hasSuffix "-lazy" v.name then
lib.removeSuffix "-lazy" v.name
else
v.name;
# Check if this spec has a corresponding cat toggle
catEnabled =
if specName != null && builtins.hasAttr specName config.cats then
config.cats.${specName}
else
true; # Default to enabled if no cat toggle exists
in
v
// {
value = v.value // {
# Use explicit enable if set, otherwise use cat toggle
enable = if v.value ? enable then v.value.enable else catEnabled;
};
}
else
v
) list;
}
];
}

View file

@ -5,24 +5,14 @@
wlib, wlib,
... ...
}: { }: {
# ============================================================================
# SPEC MODULE DEFAULTS
# ============================================================================
# Define default options available to all specs
config.specMods = {parentSpec ? null, ...}: { config.specMods = {parentSpec ? null, ...}: {
options.extraPackages = lib.mkOption { options.runtimePkgs = lib.mkOption {
type = lib.types.listOf wlib.types.stringable; type = lib.types.listOf wlib.types.stringable;
default = []; default = [];
description = "a extraPackages spec field to put packages to suffix to the PATH"; description = "a runtimePkgs spec field to put packages to suffix to the PATH";
}; };
}; };
# ============================================================================
# EXTERNAL TOOLS SPEC
# ============================================================================
# Core system tools and utilities
config.specs.external = { config.specs.external = {
data = lib.mkDefault null; data = lib.mkDefault null;
before = ["INIT_MAIN"]; before = ["INIT_MAIN"];
@ -30,7 +20,7 @@
vim.o.shell = "${pkgs.zsh}/bin/zsh" vim.o.shell = "${pkgs.zsh}/bin/zsh"
''; '';
runtimeDeps = "prefix"; runtimeDeps = "prefix";
extraPackages = with pkgs; [ runtimePkgs = with pkgs; [
perl perl
ruby ruby
shfmt shfmt
@ -39,15 +29,11 @@
]; ];
}; };
# ============================================================================
# OPTIONAL TOOLS SPEC
# ============================================================================
config.specs.optional = lib.mkIf (config.cats.optional or true) { config.specs.optional = lib.mkIf (config.cats.optional or true) {
data = lib.mkDefault null; data = lib.mkDefault null;
runtimeDeps = "prefix"; runtimeDeps = "prefix";
before = ["INIT_MAIN"]; before = ["INIT_MAIN"];
extraPackages = with pkgs; [ runtimePkgs = with pkgs; [
bat bat
broot broot
devenv devenv
@ -76,54 +62,38 @@
]; ];
}; };
# ============================================================================
# MARKDOWN SPEC
# ============================================================================
config.specs.markdown = lib.mkIf (config.cats.markdown or true) { config.specs.markdown = lib.mkIf (config.cats.markdown or true) {
data = lib.mkDefault null; data = lib.mkDefault null;
runtimeDeps = "prefix"; runtimeDeps = "prefix";
extraPackages = with pkgs; [ runtimePkgs = with pkgs; [
python313Packages.pylatexenc python313Packages.pylatexenc
quarto quarto
zk zk
]; ];
}; };
# ============================================================================
# NIX SPEC
# ============================================================================
config.specs.nix = lib.mkIf (config.cats.nix or true) { config.specs.nix = lib.mkIf (config.cats.nix or true) {
data = lib.mkDefault null; data = lib.mkDefault null;
runtimeDeps = "prefix"; runtimeDeps = "prefix";
extraPackages = with pkgs; [ runtimePkgs = with pkgs; [
alejandra alejandra
nix-doc nix-doc
nixd nixd
]; ];
}; };
# ============================================================================
# LUA SPEC
# ============================================================================
config.specs.lua = lib.mkIf (config.cats.lua or true) { config.specs.lua = lib.mkIf (config.cats.lua or true) {
data = lib.mkDefault null; data = lib.mkDefault null;
runtimeDeps = "prefix"; runtimeDeps = "prefix";
extraPackages = with pkgs; [ runtimePkgs = with pkgs; [
lua-language-server lua-language-server
]; ];
}; };
# ============================================================================
# PYTHON SPEC
# ============================================================================
config.specs.python = lib.mkIf (config.cats.python or true) { config.specs.python = lib.mkIf (config.cats.python or true) {
data = lib.mkDefault null; data = lib.mkDefault null;
runtimeDeps = "prefix"; runtimeDeps = "prefix";
extraPackages = let runtimePkgs = let
python_packages_fn = python_packages_fn =
if pkgs ? basePythonPackages if pkgs ? basePythonPackages
then ps: pkgs.basePythonPackages ps ++ config.settings.lang_packages.python then ps: pkgs.basePythonPackages ps ++ config.settings.lang_packages.python
@ -139,14 +109,10 @@
]; ];
}; };
# ============================================================================
# R SPEC
# ============================================================================
config.specs.r = lib.mkIf (config.cats.r or true) { config.specs.r = lib.mkIf (config.cats.r or true) {
data = lib.mkDefault null; data = lib.mkDefault null;
runtimeDeps = "prefix"; runtimeDeps = "prefix";
extraPackages = let runtimePkgs = let
r_packages = (pkgs.baseRPackages or []) ++ config.settings.lang_packages.r; r_packages = (pkgs.baseRPackages or []) ++ config.settings.lang_packages.r;
in in
with pkgs; [ with pkgs; [
@ -159,30 +125,22 @@
]; ];
}; };
# ============================================================================
# JULIA SPEC
# ============================================================================
config.specs.julia = lib.mkIf (config.cats.julia or true) { config.specs.julia = lib.mkIf (config.cats.julia or true) {
data = lib.mkDefault null; data = lib.mkDefault null;
runtimeDeps = "prefix"; runtimeDeps = "prefix";
extraPackages = let runtimePkgs = let
julia_with_packages = julia_with_packages =
pkgs.julia-bin.withPackages config.settings.lang_packages.julia; pkgs.julia-bin.withPackages config.settings.lang_packages.julia;
in [julia_with_packages]; in [julia_with_packages];
}; };
# ============================================================================
# CLICKHOUSE SPEC
# ============================================================================
config.specs.clickhouse = lib.mkIf (config.cats.clickhouse or true) { config.specs.clickhouse = lib.mkIf (config.cats.clickhouse or true) {
data = lib.mkDefault null; data = lib.mkDefault null;
runtimeDeps = "prefix"; runtimeDeps = "prefix";
extraPackages = with pkgs; [ runtimePkgs = with pkgs; [
clickhouse-lts clickhouse-lts
]; ];
}; };
config.extraPackages = config.specCollect (acc: v: acc ++ (v.extraPackages or [])) []; config.runtimePkgs = config.specCollect (acc: v: acc ++ (v.runtimePkgs or [])) [];
} }

View file

@ -3,15 +3,14 @@
pkgs, pkgs,
lib, lib,
... ...
}: }: {
{ config.specs.gitPlugins = lib.mkIf (config.cats.gitPlugins or true) {
config.specs.gitPlugins = {
data = []; data = [];
}; };
config.specs.r = { config.specs.r = lib.mkIf (config.cats.r or true) {
data = with pkgs.vimPlugins; [ data = with pkgs.vimPlugins; [
config.nvim-lib.neovimPlugins.r pkgs.r-nvim
quarto-nvim quarto-nvim
{ {
data = otter-nvim; data = otter-nvim;
@ -20,14 +19,14 @@
]; ];
}; };
config.specs.markdown-lazy = { config.specs.markdown-lazy = lib.mkIf (config.cats.markdown or true) {
lazy = true; lazy = true;
data = [ data = [
config.nvim-lib.neovimPlugins.cmp-pandoc-references config.nvim-lib.neovimPlugins.cmp-pandoc-references
]; ];
}; };
config.specs.general = { config.specs.general = lib.mkIf (config.cats.general or true) {
data = with pkgs.vimPlugins; [ data = with pkgs.vimPlugins; [
lze lze
lzextras lzextras
@ -80,7 +79,7 @@
]; ];
}; };
config.specs.lua = { config.specs.lua = lib.mkIf (config.cats.lua or true) {
data = with pkgs.vimPlugins; [ data = with pkgs.vimPlugins; [
luvit-meta luvit-meta
{ {
@ -90,7 +89,7 @@
]; ];
}; };
config.specs.markdown = { config.specs.markdown = lib.mkIf (config.cats.markdown or true) {
data = with pkgs.vimPlugins; [ data = with pkgs.vimPlugins; [
quarto-nvim quarto-nvim
render-markdown-nvim render-markdown-nvim
@ -105,20 +104,22 @@
]; ];
}; };
config.specs.utils = { config.specs.utils = lib.mkIf (config.cats.utils or true) {
data = with pkgs.vimPlugins; [ data = with pkgs.vimPlugins; [
blink-cmp blink-cmp
nvim-lspconfig nvim-lspconfig
nvim-treesitter-context nvim-treesitter-context
nvim-treesitter-textobjects nvim-treesitter-textobjects
{ {
data = pkgs.codecompanion-nvim; data = pkgs.codecompanion-nvim.overrideAttrs (old: {
doCheck = false;
});
pname = "codecompanion"; pname = "codecompanion";
} }
]; ];
}; };
config.specs.treesitterParsers = { config.specs.treesitterParsers = lib.mkIf (config.cats.treesitterParsers or true) {
data = with pkgs.vimPlugins.nvim-treesitter-parsers; [ data = with pkgs.vimPlugins.nvim-treesitter-parsers; [
bash bash
c c
@ -157,7 +158,7 @@
]; ];
}; };
config.specs.utils-lazy = { config.specs.utils-lazy = lib.mkIf (config.cats.utils or true) {
lazy = true; lazy = true;
data = with pkgs.vimPlugins; [ data = with pkgs.vimPlugins; [
blink-compat blink-compat
@ -174,7 +175,7 @@
]; ];
}; };
config.specs.gitPlugins-lazy = { config.specs.gitPlugins-lazy = lib.mkIf (config.cats.gitPlugins or true) {
lazy = true; lazy = true;
data = []; data = [];
}; };

View file

@ -7,16 +7,10 @@ inputs:
... ...
}: }:
{ {
# ============================================================================
# IMPORTS
# ============================================================================
# Import the base neovim wrapper module and all configuration modules
imports = [ imports = [
wlib.wrapperModules.neovim wlib.wrapperModules.neovim
./module/specs/deps.nix ./module/specs/deps.nix
./module/specs/plugins.nix ./module/specs/plugins.nix
./module/specs/cats-enable.nix
./module/settings/core.nix ./module/settings/core.nix
./module/settings/cats.nix ./module/settings/cats.nix
./module/settings/env.nix ./module/settings/env.nix
@ -25,11 +19,6 @@ inputs:
./module/settings/runtime-path.nix ./module/settings/runtime-path.nix
]; ];
# ============================================================================
# HELPER FUNCTIONS
# ============================================================================
# Utilities for working with plugin inputs
options.nvim-lib.neovimPlugins = lib.mkOption { options.nvim-lib.neovimPlugins = lib.mkOption {
readOnly = true; readOnly = true;
type = lib.types.attrsOf wlib.types.stringable; type = lib.types.attrsOf wlib.types.stringable;
@ -58,11 +47,6 @@ inputs:
]; ];
}; };
# ============================================================================
# CONFIGURATION
# ============================================================================
# Pass cats configuration to neovim and expose metadata
config.settings.cats = config.cats; config.settings.cats = config.cats;
config.info.cats = config.cats; config.info.cats = config.cats;
config.info.nixCats_config_location = config.settings.config_directory; config.info.nixCats_config_location = config.settings.config_directory;

View file

@ -3,39 +3,33 @@ let
lib = nixpkgs.lib; lib = nixpkgs.lib;
rOverlay = import ./r.nix {inherit inputs;}; rOverlay = import ./r.nix {inherit inputs;};
franOverlay = inputs.fran.overlays.default; rNvimNixOverlay = inputs.r-nvim-nix.overlays.default;
pythonOverlay = import ./python.nix inputs; pythonOverlay = import ./python.nix {inherit inputs;};
pluginsOverlay = import ./plugins.nix inputs; pluginsOverlay = import ./plugins.nix {inherit inputs;};
dependencyOverlays = [ dependencyOverlays = [
rOverlay rOverlay
rNvimNixOverlay
pythonOverlay pythonOverlay
pluginsOverlay pluginsOverlay
]; ];
dependencyOverlay = lib.composeManyExtensions dependencyOverlays; dependencyOverlay = lib.composeManyExtensions dependencyOverlays;
# franOverlay provides R-specific tooling (radianWrapper, air-formatter).
# It is scoped to rixpkgs (via overlays/r.nix) rather than the global
# package set, since it only applies to R package derivations.
franOverlay = inputs.fran.overlays.default;
in in
{ {
inherit inherit
rOverlay rOverlay
rNvimNixOverlay
franOverlay franOverlay
pythonOverlay pythonOverlay
pluginsOverlay pluginsOverlay
dependencyOverlays dependencyOverlays
dependencyOverlay; dependencyOverlay;
# Named exports for downstream composition.
default = dependencyOverlay; default = dependencyOverlay;
dependencies = dependencyOverlays; dependencies = dependencyOverlays;
overlays = {
inherit
rOverlay
franOverlay
pythonOverlay
pluginsOverlay
dependencyOverlays
dependencyOverlay;
default = dependencyOverlay;
dependencies = dependencyOverlays;
};
} }

View file

@ -1,52 +1,15 @@
# R packages overlay (rix)
#
# This overlay provides access to R packages from rstats-on-nix.
#
# rstats-on-nix maintains snapshots of CRAN packages built with Nix:
# - Provides reproducible R package versions
# - Ensures binary cache availability for faster builds
# - Maintained by the rstats-on-nix community
#
# Available attributes after applying this overlay:
# - pkgs.rpkgs: R packages from rstats-on-nix
# - pkgs.rpkgs.rPackages: All CRAN packages
# - pkgs.rpkgs.quarto: Quarto publishing system
# - pkgs.rpkgs.rWrapper: R with package management
# - pkgs.rWrapper: R wrapper with standard packages pre-configured
# - pkgs.quarto: Quarto with R integration and standard packages
#
# Custom R packages and tools (radianWrapper, air-formatter) come from
# the fran overlay which should be applied separately.
#
# To use specific R packages, reference them via:
# with pkgs.rpkgs.rPackages; [ package1 package2 ]
#
# Update the R snapshot date in flake.nix inputs section:
# rixpkgs.url = "github:rstats-on-nix/nixpkgs/YYYY-MM-DD"
{ {
inputs, inputs,
... ...
}: final: prev: let }: final: prev: let
# R packages from rstats-on-nix for the current system
rpkgs = import inputs.rixpkgs { rpkgs = import inputs.rixpkgs {
system = prev.stdenv.hostPlatform.system; system = prev.stdenv.hostPlatform.system;
overlays = [inputs.fran.overlays.default]; overlays = [inputs.fran.overlays.default];
}; # rixpkgs.legacyPackages.${prev.stdenv.hostPlatform.system}; };
# Standard R packages used by default in rWrapper and quarto
reqPkgs = with rpkgs.rPackages; [
# languageserver
];
in { in {
inherit rpkgs; inherit rpkgs;
baseRPackages = reqPkgs; baseRPackages = [ ];
rWrapper = rpkgs.rWrapper.override {packages = [ ];};
# R wrapper with standard packages quarto = rpkgs.quarto.override {extraRPackages = [ ];};
rWrapper = rpkgs.rWrapper.override {packages = reqPkgs;};
# Quarto with R integration
quarto = rpkgs.quarto.override {extraRPackages = reqPkgs;};
# Update helper for rix
updateR = import ../scripts/updater.nix {pkgs = final;}; updateR = import ../scripts/updater.nix {pkgs = final;};
} }

View file

@ -390,6 +390,7 @@ end)
-- zk -- zk
now_if_args(function() now_if_args(function()
if nix.get_cat("markdown", false) then
require("zk").setup({ require("zk").setup({
picker = "minipick", picker = "minipick",
lsp = { lsp = {
@ -409,4 +410,5 @@ now_if_args(function()
}, },
}) })
end
end) end)

View file

@ -44,6 +44,12 @@ end)
-- r -- r
now(function() now(function()
if nix.get_cat("r", false) then if nix.get_cat("r", false) then
local cwd = vim.fn.getcwd(-1)
vim.env.RNVIM_COMPLDIR = cwd .. "/.r-compl"
vim.env.R_LIBS_USER = (vim.env.R_LIBS_USER or ""):gsub("%$PWD", cwd)
vim.env.TMPDIR = cwd .. "/.r-tmp"
vim.fn.mkdir(vim.env.RNVIM_COMPLDIR, "p")
vim.fn.mkdir(vim.env.TMPDIR, "p")
vim.g.rout_follow_colorscheme = true vim.g.rout_follow_colorscheme = true
require("r").setup({ require("r").setup({
-- Create a table with the options to be passed to setup() -- Create a table with the options to be passed to setup()
@ -65,6 +71,7 @@ end)
now(function() now(function()
vim.treesitter.language.register("markdown", { "quarto", "rmd" }) vim.treesitter.language.register("markdown", { "quarto", "rmd" })
if nix.get_cat({ "r", "markdown" }, false) then
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = { "quarto" }, pattern = { "quarto" },
callback = function() callback = function()
@ -81,9 +88,11 @@ now(function()
write_to_disk = true, write_to_disk = true,
}, },
}) })
end
end) end)
later(function() later(function()
if nix.get_cat({ "r", "markdown" }, false) then
require("quarto").setup({ require("quarto").setup({
lspFeatures = { lspFeatures = {
enabled = true, enabled = true,
@ -102,4 +111,5 @@ later(function()
default_method = "slime", default_method = "slime",
}, },
}) })
end
end) end)

View file

@ -1,6 +1,7 @@
local add = Config.add local add = Config.add
local now_if_args = Config.now_if_args local now_if_args = Config.now_if_args
local later = MiniDeps.later local later = MiniDeps.later
local nix = require('config.nix')
if not Config.isNixCats then if not Config.isNixCats then
local m_add = MiniDeps.add local m_add = MiniDeps.add
@ -12,6 +13,7 @@ end
-- lua -- lua
later(function() later(function()
if nix.get_cat("lua", false) then
add("luvit-meta") add("luvit-meta")
add("lazydev") add("lazydev")
require("lazydev").setup({ require("lazydev").setup({
@ -25,6 +27,7 @@ later(function()
{ path = "${3rd}/luv/library", words = { "vim%.uv" } }, { path = "${3rd}/luv/library", words = { "vim%.uv" } },
}, },
}) })
end
end) end)
-- Markdown -- Markdown

View file

@ -15,17 +15,17 @@ now_if_args(function()
marksman = { marksman = {
filetypes = { "markdown", "markdown_inline", "codecompanion" }, filetypes = { "markdown", "markdown_inline", "codecompanion" },
}, },
-- r_language_server = { r_ls = {
-- filetypes = { 'r', 'rmd', 'rmarkdown' }, filetypes = { 'r', 'rmd', 'rmarkdown' },
-- settings = { settings = {
-- ['r_language_server'] = { ['r_ls'] = {
-- lsp = { lsp = {
-- rich_documentation = true, rich_documentation = true,
-- enable = true, enable = true,
-- }, },
-- }, },
-- } }
-- }, },
julials = { julials = {
settings = { settings = {
julia = { julia = {