From 1055522af932f5c781ff475cb390143534d49141 Mon Sep 17 00:00:00 2001 From: Daniel Winkler Date: Wed, 13 May 2026 12:30:17 +1000 Subject: [PATCH] moved r-nvim to flake build --- .Rprofile | 5 ++++ .r-tmp/R.nvim-daniel/globenv_1202824815 | 0 .r-tmp/R.nvim-daniel/liblist_1202824815 | 0 flake.lock | 38 ++++++++++++++++++++----- flake.nix | 9 +++++- modules/module/settings/env.nix | 4 +-- modules/module/specs/plugins.nix | 2 +- overlays/default.nix | 4 +++ overlays/r.nix | 29 ++----------------- 9 files changed, 54 insertions(+), 37 deletions(-) create mode 100644 .Rprofile create mode 100644 .r-tmp/R.nvim-daniel/globenv_1202824815 create mode 100644 .r-tmp/R.nvim-daniel/liblist_1202824815 diff --git a/.Rprofile b/.Rprofile new file mode 100644 index 0000000..7617f61 --- /dev/null +++ b/.Rprofile @@ -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")) +} diff --git a/.r-tmp/R.nvim-daniel/globenv_1202824815 b/.r-tmp/R.nvim-daniel/globenv_1202824815 new file mode 100644 index 0000000..e69de29 diff --git a/.r-tmp/R.nvim-daniel/liblist_1202824815 b/.r-tmp/R.nvim-daniel/liblist_1202824815 new file mode 100644 index 0000000..e69de29 diff --git a/flake.lock b/flake.lock index 32a6765..bf489c1 100644 --- a/flake.lock +++ b/flake.lock @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1777954456, - "narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=", + "lastModified": 1778443072, + "narHash": "sha256-zi7/fsqM/kFdNuED//4WOCUtezGtKKqRNORjMvfwjnA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1", + "rev": "da5ad661ba4e5ef59ba743f0d112cbc30e474f32", "type": "github" }, "original": { @@ -69,6 +69,29 @@ "type": "github" } }, + "r-nvim-nix": { + "inputs": { + "nixpkgs": [ + "rixpkgs" + ], + "rnvimsrc": [ + "plugins-r" + ] + }, + "locked": { + "lastModified": 1778638679, + "narHash": "sha256-+mdjgYfyNtI/5E6X8uUx3u9qpGC9POS4LagOHSM3Iy0=", + "owner": "dwinkler1", + "repo": "r_nvim_nix", + "rev": "eb784558e18b8f1dead5bd211b96fd287ac1bed7", + "type": "github" + }, + "original": { + "owner": "dwinkler1", + "repo": "r_nvim_nix", + "type": "github" + } + }, "rixpkgs": { "locked": { "lastModified": 1771303851, @@ -80,8 +103,8 @@ }, "original": { "owner": "dwinkler1", - "ref": "nixpkgs", "repo": "rixpkgs", + "rev": "af2dd3f7b4b172077747c0869d4e30702fb71b0e", "type": "github" } }, @@ -91,6 +114,7 @@ "nixpkgs": "nixpkgs", "plugins-cmp-pandoc-references": "plugins-cmp-pandoc-references", "plugins-r": "plugins-r", + "r-nvim-nix": "r-nvim-nix", "rixpkgs": "rixpkgs", "wrappers": "wrappers" } @@ -102,11 +126,11 @@ ] }, "locked": { - "lastModified": 1777991014, - "narHash": "sha256-0DS24OW9d9iz+w0LCz6KpS2IpE2z2gHxeBdMZg9xpDY=", + "lastModified": 1778560014, + "narHash": "sha256-Hu9RMo7vJt/4dx/vAvyG+cE9RBwpaH1ouyunvruYaDI=", "owner": "BirdeeHub", "repo": "nix-wrapper-modules", - "rev": "dc5184095ad488e937ec308b52c9c0b218959d8b", + "rev": "e30aa99c9c7038e16efae3cad7916a47307a9e36", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index be28255..1ffa69a 100644 --- a/flake.nix +++ b/flake.nix @@ -10,7 +10,11 @@ url = "github:BirdeeHub/nix-wrapper-modules"; 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 = { url = "github:dwinkler1/fran"; @@ -61,6 +65,7 @@ janitor languageserver styler + pkgs.nvimcom ]; julia = ["DataFramesMeta" "QuackIO"]; }; @@ -187,6 +192,8 @@ air-formatter yaml-language-server updateR + nvimcom + rnvimserver ]; juliaPackages = let diff --git a/modules/module/settings/env.nix b/modules/module/settings/env.nix index 0749ede..14e0a32 100644 --- a/modules/module/settings/env.nix +++ b/modules/module/settings/env.nix @@ -13,7 +13,7 @@ }) (lib.mkIf (config.cats.r or false) { RNVIM_COMPLDIR = "$PWD/.r-compl"; - R_LIBS_USER = "${pkgs.nvimcom}:$PWD/.Rlibs"; + R_LIBS_USER = "${pkgs.nvimcom}/library:$PWD/.Rlibs"; TMPDIR = "$PWD/.r-tmp"; }) ]; @@ -21,7 +21,7 @@ # Environment variables with defaults (can be overridden by user) config.envDefault = lib.mkMerge [ (lib.mkIf (config.cats.r or false) { - R_LIBS_USER = "${pkgs.nvimcom}:$PWD/.Rlibs"; + R_LIBS_USER = "${pkgs.nvimcom}/library:$PWD/.Rlibs"; }) ]; } diff --git a/modules/module/specs/plugins.nix b/modules/module/specs/plugins.nix index eb9d499..a47ba65 100644 --- a/modules/module/specs/plugins.nix +++ b/modules/module/specs/plugins.nix @@ -14,7 +14,7 @@ (config.nvim-lib.neovimPlugins.r.overrideAttrs (old: { postInstall = (old.postInstall or "") + '' mkdir -p $out/rnvimserver - cp ${pkgs.nvimcom}/bin/rnvimserver $out/rnvimserver/rnvimserver + cp ${pkgs.rnvimserver}/bin/rnvimserver $out/rnvimserver/rnvimserver chmod +x $out/rnvimserver/rnvimserver ''; })) diff --git a/overlays/default.nix b/overlays/default.nix index 821ff88..ebb6518 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -3,12 +3,14 @@ let lib = nixpkgs.lib; rOverlay = import ./r.nix {inherit inputs;}; + rNvimNixOverlay = inputs.r-nvim-nix.overlays.default; franOverlay = inputs.fran.overlays.default; pythonOverlay = import ./python.nix inputs; pluginsOverlay = import ./plugins.nix inputs; dependencyOverlays = [ rOverlay + rNvimNixOverlay pythonOverlay pluginsOverlay ]; @@ -17,6 +19,7 @@ in { inherit rOverlay + rNvimNixOverlay franOverlay pythonOverlay pluginsOverlay @@ -30,6 +33,7 @@ in overlays = { inherit rOverlay + rNvimNixOverlay franOverlay pythonOverlay pluginsOverlay diff --git a/overlays/r.nix b/overlays/r.nix index 22c42fa..a9961fb 100644 --- a/overlays/r.nix +++ b/overlays/r.nix @@ -33,38 +33,15 @@ overlays = [inputs.fran.overlays.default]; }; # rixpkgs.legacyPackages.${prev.stdenv.hostPlatform.system}; - # Pre-build nvimcom from R.nvim plugin source so R.nvim never tries to - # compile it at runtime into the read-only nix store. - nvimcom = final.stdenv.mkDerivation { - pname = "nvimcom"; - version = "0.9.92"; - src = inputs.plugins-r; - nativeBuildInputs = [ - (rpkgs.rWrapper.override { packages = []; }) - ]; - buildPhase = '' - mkdir -p $out/bin - R CMD INSTALL -l $out nvimcom - cd rnvimserver - $CC -pthread -O2 -Wall \ - complete.c resolve.c hover.c definition.c signature.c \ - rhelp.c chunk.c roxygen.c data_structures.c logging.c \ - rnvimserver.c obbr.c tcp.c utilities.c ../nvimcom/src/common.c \ - -o $out/bin/rnvimserver - cd .. - mkdir -p $out/nvimcom/bin - cp $out/bin/rnvimserver $out/nvimcom/bin/rnvimserver - chmod +x $out/bin/rnvimserver $out/nvimcom/bin/rnvimserver - ''; - installPhase = "true"; - }; + # nvimcom and rnvimserver are provided by the r-nvim-nix flake overlay + # (inputs.r-nvim-nix.overlays.default) # Standard R packages used by default in rWrapper and quarto reqPkgs = with rpkgs.rPackages; [ # languageserver ]; in { - inherit rpkgs nvimcom; + inherit rpkgs; baseRPackages = reqPkgs; # R wrapper with standard packages