Compare commits

...

8 commits

Author SHA1 Message Date
5d8c198afa More robust shell setup with nu 2026-05-23 02:27:20 +10:00
e814d2c04c simplified 2026-05-21 21:43:04 +10:00
5c851aecba temp 2026-05-21 20:38:02 +10:00
72f53d785f
Merge pull request #77 from dwinkler1/update_rde
Update RDE flake.lock
2026-05-12 10:10:57 +10:00
github-actions[bot]
24175e36c3 flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/15f4ee454b1dce334612fa6843b3e05cf546efab?narHash=sha256-Ad49moKWeXtKBJNy2ebiTQUEgdLyvGmTeykAQ9xM%2BZ4%3D' (2026-04-30)
  → 'github:NixOS/nixpkgs/549bd84d6279f9852cae6225e372cc67fb91a4c1?narHash=sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9%2BhrDTkDU%3D' (2026-05-05)
• Updated input 'nvimConfig':
    'github:dwinkler1/nvimConfig/e9c99811d4b8684814608c7bff89dd5bb4d20cda?narHash=sha256-PY%2BhOXV5%2BW0rpWtnUI9QO3tFyyzlpDG8rVjPbaBoHxo%3D' (2026-05-03)
  → 'github:dwinkler1/nvimConfig/4884bf685f157da4f4d60f8e40febeac0b9bf0e9?narHash=sha256-FB8M8D8YzfSe/oL4l6XGJxErq6nRjWSAeJzNXpk2g0E%3D' (2026-05-07)
• Updated input 'nvimConfig/wrappers':
    'github:BirdeeHub/nix-wrapper-modules/f11469ca69068bac13d9e163b2bd268cc06dff57?narHash=sha256-/SSAR77Brr9fbapsh1cb2K47JXCbvwS1GjM4yyDxle8%3D' (2026-04-16)
  → 'github:BirdeeHub/nix-wrapper-modules/dc5184095ad488e937ec308b52c9c0b218959d8b?narHash=sha256-0DS24OW9d9iz%2Bw0LCz6KpS2IpE2z2gHxeBdMZg9xpDY%3D' (2026-05-05)
• Updated input 'rixpkgs':
    'github:dwinkler1/rixpkgs/af2dd3f7b4b172077747c0869d4e30702fb71b0e?narHash=sha256-tgveHozOJ2D/mi3LxVy/FcmLFDlM5XKZxsNB2XpvzaM%3D' (2026-02-17)
  → 'github:dwinkler1/rixpkgs/028af91e9161008fce750f3e249afe471a302037?narHash=sha256-K%2BRz%2BpghAmynE83%2Be9svnNYsDgPnbEohrcPb6duG5wM%3D' (2026-05-07)
2026-05-07 08:40:44 +00:00
6c0f5376dd
Merge pull request #76 from dwinkler1/update_rde 2026-05-03 20:23:05 +10:00
github-actions[bot]
c1c92ec37c flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/0726a0ecb6d4e08f6adced58726b95db924cef57?narHash=sha256-EHq1/OX139R1RvBzOJ0aMRT3xnWyqtHBRUBuO1gFzjI%3D' (2026-04-22)
  → 'github:NixOS/nixpkgs/15f4ee454b1dce334612fa6843b3e05cf546efab?narHash=sha256-Ad49moKWeXtKBJNy2ebiTQUEgdLyvGmTeykAQ9xM%2BZ4%3D' (2026-04-30)
• Updated input 'nvimConfig':
    'github:dwinkler1/nvimConfig/2617face3b1be40534d2cae7f0a374a062b3710d?narHash=sha256-pU3u7T4MqpjUWxflNvd4i47FURp756L7nMRL8MV%2BQEw%3D' (2026-04-17)
  → 'github:dwinkler1/nvimConfig/e9c99811d4b8684814608c7bff89dd5bb4d20cda?narHash=sha256-PY%2BhOXV5%2BW0rpWtnUI9QO3tFyyzlpDG8rVjPbaBoHxo%3D' (2026-05-03)
2026-05-03 06:40:30 +00:00
dad9e7d14e
Remove dependency update command from workflow
Removed the command to update dependencies in the RDE template.
2026-05-03 16:39:21 +10:00
4 changed files with 269 additions and 110 deletions

View file

@ -22,7 +22,6 @@ jobs:
name: rde
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
extraPullNames: rstats-on-nix, nix-community
- run: cd templates/rde/ && nix develop -c p-updateDeps
- name: Update ed flake.lock
uses: DeterminateSystems/update-flake-lock@v28
with:

73
templates/ed/README.md Normal file
View file

@ -0,0 +1,73 @@
# Project Editor
A per-project Neovim wrapper built with [nix-wrapper-modules](https://birdeehub.github.io/nix-wrapper-modules/) and [nvimConfig](https://github.com/dwinkler1/nvimConfig).
## Setup
The flake provides two entry points:
| Command | What you get |
|---|---|
| `direnv allow` / `nix develop` | **(Recommended)** A shell with `nv` and all enabled language toolchains (R, Python, Julia, Quarto) on `PATH`. |
| `nix run` | Launches only the `nv` editor. Language toolchains (R, Python, etc.) are **not** on `PATH`. |
### With direnv (recommended)
```bash
direnv allow # enter the devShell automatically
nv # launch the pre-configured Neovim
R # R REPL is available (if enabled in flake.nix)
```
### Without direnv
```bash
nix develop # enter the devShell manually
nv # launch Neovim
R # R REPL is available (if enabled in flake.nix)
```
> **Why `nix run` only gives the editor:** The flake's `packages.default` is the wrapped Neovim binary. Language toolchains (R, radian, quarto, etc.) live in `devShells.default`. Use `nix develop` (or `direnv allow`) to get the full environment.
## Configuration
The `flake.nix` is the single source of truth. Key knobs:
| Option | What it controls |
|---|---|
| `cats` | Toggle language support (nix, r, python, julia, etc.) |
| `settings.lang_packages.<lang>` | Language-specific packages installed in the wrapper |
| `settings.colorscheme` | Neovim colorscheme |
| `settings.background` | `"dark"` or `"light"` |
| `settings.wrapRc` | When `true`, init.lua is embedded (rebuild to change); when `false`, init.lua is external (reload without rebuild) |
| `binName` | The wrapper binary name (`nv` by default) |
| `env` | Environment variables set in the wrapper |
| `extraPackages` | Extra system packages available in the wrapper's PATH |
| `specs.extraLua` | Inject lazy.nvim plugin specs |
### Adding packages without editing flake.nix
Create any of these optional files in the project root to add dependencies without modifying `flake.nix`:
- **`python-packages.nix`** — receives `python3Packages`, return a list of packages:
```nix
p: with p; [ numpy scipy ]
```
- **`r-packages.nix`** — receives `rpkgs` (includes `rPackages`), return a list:
```nix
p: with p.rPackages; [ ggplot2 data.table ]
```
- **`julia-packages.nix`** — no arguments, return a list of package name strings:
```nix
[ "DataFrames" "Plots" ]
```
## Formatting
```bash
nix fmt
```
Uses `nixfmt-rfc-style` pinned via the flake's `formatter` output.

View file

@ -22,11 +22,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1776877367,
"narHash": "sha256-EHq1/OX139R1RvBzOJ0aMRT3xnWyqtHBRUBuO1gFzjI=",
"lastModified": 1778869304,
"narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0726a0ecb6d4e08f6adced58726b95db924cef57",
"rev": "d233902339c02a9c334e7e593de68855ad26c4cb",
"type": "github"
},
"original": {
@ -45,20 +45,19 @@
"nixpkgs"
],
"plugins-cmp-pandoc-references": "plugins-cmp-pandoc-references",
"plugins-r": [
"plugins-r"
],
"plugins-r": "plugins-r",
"r-nvim-nix": "r-nvim-nix",
"rixpkgs": [
"rixpkgs"
],
"wrappers": "wrappers"
},
"locked": {
"lastModified": 1776413627,
"narHash": "sha256-pU3u7T4MqpjUWxflNvd4i47FURp756L7nMRL8MV+QEw=",
"lastModified": 1779362150,
"narHash": "sha256-y3JTpxmNgtEYG1m21Ymvdmrul/WvJzOCX45AlV21aak=",
"owner": "dwinkler1",
"repo": "nvimConfig",
"rev": "2617face3b1be40534d2cae7f0a374a062b3710d",
"rev": "af6d975129768cce36ac4c46198ab2b3ebaafad3",
"type": "github"
},
"original": {
@ -86,20 +85,45 @@
"plugins-r": {
"flake": false,
"locked": {
"lastModified": 1769881528,
"narHash": "sha256-oQSHHu6filJkAyH94yEvyTVuxA+5MU2dMOEAnsIjJKQ=",
"lastModified": 1776905071,
"narHash": "sha256-dXox6qEs1VDE7vPNDoN8bY4g06uj1IEs6uki72w8lpA=",
"owner": "R-nvim",
"repo": "R.nvim",
"rev": "958b472d763cb258927c7ef69af4fd9945cc5469",
"rev": "582f2af11290ac067e49018db38e12a511325556",
"type": "github"
},
"original": {
"owner": "R-nvim",
"ref": "v0.99.3",
"ref": "v0.99.4",
"repo": "R.nvim",
"type": "github"
}
},
"r-nvim-nix": {
"inputs": {
"nixpkgs": [
"nvimConfig",
"rixpkgs"
],
"rnvimsrc": [
"nvimConfig",
"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": {
"locked": {
"lastModified": 1771303851,
@ -111,8 +135,8 @@
},
"original": {
"owner": "dwinkler1",
"ref": "nixpkgs",
"repo": "rixpkgs",
"rev": "af2dd3f7b4b172077747c0869d4e30702fb71b0e",
"type": "github"
}
},
@ -121,7 +145,6 @@
"fran": "fran",
"nixpkgs": "nixpkgs",
"nvimConfig": "nvimConfig",
"plugins-r": "plugins-r",
"rixpkgs": "rixpkgs"
}
},
@ -133,11 +156,11 @@
]
},
"locked": {
"lastModified": 1776375800,
"narHash": "sha256-/SSAR77Brr9fbapsh1cb2K47JXCbvwS1GjM4yyDxle8=",
"lastModified": 1779297405,
"narHash": "sha256-VFoBwH7ZjVxCnvZTb5ODRXt70sLtWMxstive0N+RS50=",
"owner": "BirdeeHub",
"repo": "nix-wrapper-modules",
"rev": "f11469ca69068bac13d9e163b2bd268cc06dff57",
"rev": "e7ed7a1205945befdf2e0d73ba7df91d935e5af1",
"type": "github"
},
"original": {

View file

@ -7,7 +7,8 @@
nvimConfig,
...
} @ inputs: let
projectSettings = {pkgs}: {
# ── Shared language support flags ──────────────────────────────
# Used by both the neovim wrapper module and the devShell
cats = {
clickhouse = false;
gitPlugins = false;
@ -20,25 +21,11 @@
r = false;
};
settings = let
# With `replace` packages are replaced otherwise they are merged with base packages
replace = pkgs.lib.mkForce;
in {
lang_packages = {
python = replace (
(with pkgs.python3Packages; [
duckdb
polars
])
++ (
if builtins.pathExists ./python-packages.nix
# p: with p; [ ... ]
then import ./python-packages.nix pkgs.python3Packages
else []
)
);
# ── Language package lists ────────────────────────────────────
# Shared between wrapper lang_packages and devShell toolchains.
# Accept pkgs so they work inside forAllSystems for each system.
r = replace (
rPackages = pkgs:
(with pkgs.rpkgs.rPackages; [
fixest
# pkgs.extraRPackages.musicMetadata
@ -48,31 +35,64 @@
# p: with p.rPackages; [ ... ]
then import ./r-packages.nix pkgs.rpkgs
else []
)
);
julia = replace ([
"StatsBase"
]
pythonPackages = pkgs:
(with pkgs.python3Packages; [
duckdb
polars
])
++ (
if builtins.pathExists ./python-packages.nix
# p: with p; [ ... ]
then import ./python-packages.nix pkgs.python3Packages
else []
);
juliaPackages =
["StatsBase"]
++ (
if builtins.pathExists ./julia-packages.nix
# [ ... ]
then import ./julia-packages.nix
else []
));
);
systems = ["aarch64-darwin" "x86_64-linux" "aarch64-linux"];
forAllSystems = nixpkgs.lib.genAttrs systems;
overlays = [inputs.nvimConfig.overlays.dependencies];
in {
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
packages = forAllSystems (system: let
pkgs = import nixpkgs {
inherit system overlays;
config = {allowUnfree = true;};
};
# Plain attrset — pkgs is captured from the surrounding scope,
# so the module system does not need lazy _module.args resolution.
projectSettings = {
inherit cats;
settings = let
# With `replace` packages are replaced otherwise they are merged with base packages
replace = pkgs.lib.mkForce;
in {
lang_packages = {
python = replace (pythonPackages pkgs);
r = replace (rPackages pkgs);
julia = replace juliaPackages;
};
colorscheme = "kanagawa";
background = "dark";
wrapRc = true;
};
binName = "vv";
binName = "nv";
env = {
IS_PROJECT_EDITOR = "1";
R_LIBS_USER = "./.nvimcom";
};
extraPackages = with pkgs; [
runtimePkgs = with pkgs; [
cowsay
];
@ -88,34 +108,83 @@
'';
};
};
systems = nixpkgs.lib.systems.flakeExposed;
forAllSystems = nixpkgs.lib.genAttrs systems;
overlays = [inputs.nvimConfig.overlays.dependencies];
evalResult = nvimConfig.inputs.wrappers.lib.evalModules {
modules = [
nvimConfig.wrapperModules.default
projectSettings
];
};
in {
packages = forAllSystems (system: let
pkgs = import nixpkgs {inherit system overlays;};
baseNvim = nvimConfig.packages.${system}.default;
nvim = (baseNvim.eval (projectSettings {inherit pkgs;})).config.wrapper;
default = nvim;
in {
default = nvim;
default = evalResult.config.wrap {inherit pkgs;};
});
devShells = forAllSystems (system: let
pkgs = import nixpkgs {inherit system overlays;};
pkgs = import nixpkgs {
inherit system overlays;
config = {allowUnfree = true;};
};
nv = self.packages.${system}.default;
in {
default = pkgs.mkShell {
packages = [nv pkgs.updateR];
shellHook = ''
exec nu
alias gst='git status'
alias glol='git log --oneline --graph --decorate'
alias gc='git commit'
alias gl='git pull'
alias gp='git push'
'';
packages =
[
nv
pkgs.git
pkgs.pre-commit
pkgs.nushell
]
# ── R toolchain (R REPL, quarto, LSP, formatter) ─────
++ pkgs.lib.optionals cats.r (let
r_packages = (pkgs.baseRPackages or []) ++ rPackages pkgs;
in [
(pkgs.rWrapper.override {packages = r_packages;})
pkgs.radianWrapper
pkgs.air-formatter
pkgs.yaml-language-server
pkgs.nvimcom
pkgs.rnvimserver
])
# ── Python toolchain (interpreter, LSP, formatter) ────
++ pkgs.lib.optionals cats.python [
(pkgs.python3.withPackages (ps: pkgs.basePythonPackages ps ++ pythonPackages pkgs))
pkgs.nodejs
pkgs.ruff
pkgs.basedpyright
pkgs.uv
]
# ── Julia toolchain ───────────────────────────────────
++ pkgs.lib.optionals cats.julia [
pkgs.julia-bin.withPackages
juliaPackages
]
# ── Markdown toolchain (quarto, zk) ───────────────────
++ (let
r_packages = (pkgs.baseRPackages or []) ++ rPackages pkgs;
quarto =
if cats.r
then pkgs.quarto.override {extraRPackages = r_packages;}
else pkgs.quarto;
in
pkgs.lib.optionals cats.markdown [
pkgs.python313Packages.pylatexenc
quarto
pkgs.zk
]);
};
});
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rixpkgs.url = "github:dwinkler1/rixpkgs/nixpkgs";
rixpkgs.url = "github:dwinkler1/rixpkgs/af2dd3f7b4b172077747c0869d4e30702fb71b0e";
fran = {
url = "github:dwinkler1/fran";
inputs = {
@ -128,12 +197,7 @@
rixpkgs.follows = "rixpkgs";
nixpkgs.follows = "nixpkgs";
fran.follows = "fran";
"plugins-r".follows = "plugins-r";
};
};
"plugins-r" = {
url = "github:R-nvim/R.nvim/v0.99.3";
flake = false;
};
};
}