Compare commits

..

6 commits

Author SHA1 Message Date
638a8ce8c0 julia test not working 2026-05-24 01:43:49 +10:00
049a61e690 test updates 2026-05-24 01:20:38 +10:00
c37deaa3b4 fix tests 2026-05-24 01:07:05 +10:00
2a521eeabd new automated tests 2026-05-24 00:27:46 +10:00
d90f82b2bb setup working 2026-05-24 00:13:24 +10:00
f844bdff2f refactor for better runtime dep management 2026-05-23 19:58:10 +10:00
10 changed files with 307 additions and 204 deletions

View file

@ -1,20 +1,6 @@
name: "Test RDE template" name: "Test RDE template"
on: on:
workflow_dispatch: # allows manual triggering workflow_dispatch: # allows manual triggering
push:
paths:
- 'templates/rde/flake.lock'
- 'templates/rde/**/*.nix'
- 'templates/rde/**/*.sh'
- 'templates/rde/**/*.lua'
- '.github/workflows/check.yml'
pull_request:
paths:
- 'templates/rde/flake.lock'
- 'templates/rde/**/*.nix'
- 'templates/rde/**/*.sh'
- 'templates/rde/**/*.lua'
- '.github/workflows/check.yml'
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true

View file

@ -1,9 +1,16 @@
name: "Test ed template MacOS" name: "Test ed template"
on: on:
workflow_dispatch: # allows manual triggering workflow_dispatch:
push: push:
branches: paths:
- 'update_rde' - 'templates/ed/**'
- 'tests/ed/**'
- '.github/workflows/check_ed.yml'
pull_request:
paths:
- 'templates/ed/**'
- 'tests/ed/**'
- '.github/workflows/check_ed.yml'
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
@ -12,15 +19,105 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [macos-latest, ubuntu-latest] os: [ubuntu-latest]
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31 - uses: cachix/install-nix-action@v31
with: with:
github_access_token: ${{ secrets.GITHUB_TOKEN }} github_access_token: ${{ github.token }}
- uses: cachix/cachix-action@v17 - uses: cachix/cachix-action@v17
with: with:
name: rde name: rde
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
extraPullNames: rstats-on-nix, nix-community extraPullNames: rstats-on-nix, nix-community
- run: nix build ./templates/ed
- name: Build template
run: nix build ./templates/ed
- name: Test R script
env:
NO_NUSHELL: '1'
run: |
cd templates/ed
nix develop --command bash -c "Rscript ${{ github.workspace }}/tests/ed/test.R"
- name: Test Python script (disabled by default)
env:
NO_NUSHELL: '1'
run: |
cd templates/ed
nix develop --command bash -c "python3 ${{ github.workspace }}/tests/ed/test.py" || echo "SKIP: Python packages not enabled"
test-with-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ github.token }}
- uses: cachix/cachix-action@v17
with:
name: rde
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
extraPullNames: rstats-on-nix, nix-community
- name: Setup test directory with Python enabled
run: |
TEST_DIR=$(mktemp -d)
cp -r templates/ed/. "$TEST_DIR/"
cd "$TEST_DIR"
sed -i 's/python[[:space:]]*=[[:space:]]*false;/python = true;/' flake.nix
grep -q "python[[:space:]]*=[[:space:]]*true;" flake.nix || {
echo "Error: Failed to enable Python in flake.nix"
exit 1
}
echo "TEST_DIR=$TEST_DIR" >> $GITHUB_ENV
- name: Build with Python enabled
run: |
cd "$TEST_DIR"
nix build
- name: Test Python packages
env:
NO_NUSHELL: '1'
run: |
cd "$TEST_DIR"
nix develop --command bash -c "python3 ${{ github.workspace }}/tests/ed/test.py"
test-with-julia:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ github.token }}
- uses: cachix/cachix-action@v17
with:
name: rde
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
extraPullNames: rstats-on-nix, nix-community
- name: Setup test directory with Julia enabled
run: |
TEST_DIR=$(mktemp -d)
cp -r templates/ed/. "$TEST_DIR/"
cd "$TEST_DIR"
sed -i 's/julia[[:space:]]*=[[:space:]]*false;/julia = true;/' flake.nix
grep -q "julia[[:space:]]*=[[:space:]]*true;" flake.nix || {
echo "Error: Failed to enable Julia in flake.nix"
exit 1
}
echo "TEST_DIR=$TEST_DIR" >> $GITHUB_ENV
- name: Build with Julia enabled
run: |
cd "$TEST_DIR"
nix build
- name: Test Julia packages
env:
NO_NUSHELL: '1'
run: |
cd "$TEST_DIR"
# nix develop --command bash -c "julia ${{ github.workspace }}/tests/ed/test.jl"

View file

@ -3,7 +3,7 @@ on:
workflow_dispatch: # allows manual triggering workflow_dispatch: # allows manual triggering
push: push:
branches: branches:
- 'update_rde' - 'update_ed'
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
@ -23,5 +23,4 @@ jobs:
name: rde name: rde
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
extraPullNames: rstats-on-nix, nix-community extraPullNames: rstats-on-nix, nix-community
- run: nix build ./templates/rde
- run: nix build ./templates/ed - run: nix build ./templates/ed

View file

@ -26,7 +26,7 @@ jobs:
uses: DeterminateSystems/update-flake-lock@v28 uses: DeterminateSystems/update-flake-lock@v28
with: with:
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
branch: update_rde branch: update_ed
path-to-flake-dir: "templates/ed" path-to-flake-dir: "templates/ed"
pr-title: "Update RDE flake.lock" # Title of PR to be created pr-title: "Update RDE flake.lock" # Title of PR to be created
pr-labels: | # Labels to be set on the PR pr-labels: | # Labels to be set on the PR

View file

@ -1 +1,2 @@
.nvimcom .nvimcom
.commandcode/

View file

@ -22,15 +22,15 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1778869304, "lastModified": 1779357205,
"narHash": "sha256-30sZNZoA1cqF5JNO9fVX+wgiQYjB7HJqqJ4ztCDeBZE=", "narHash": "sha256-cCO8aTqss5x9Ky8GWkpY0Hy5fyTZEbtifSUV8QjSzic=",
"owner": "NixOS", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d233902339c02a9c334e7e593de68855ad26c4cb", "rev": "f83fc3c307e74bc5fd5adb7eb6b8b13ffd2a36e1",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "nixos",
"ref": "nixos-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
@ -45,7 +45,6 @@
"nixpkgs" "nixpkgs"
], ],
"plugins-cmp-pandoc-references": "plugins-cmp-pandoc-references", "plugins-cmp-pandoc-references": "plugins-cmp-pandoc-references",
"plugins-r": "plugins-r",
"r-nvim-nix": "r-nvim-nix", "r-nvim-nix": "r-nvim-nix",
"rixpkgs": [ "rixpkgs": [
"rixpkgs" "rixpkgs"
@ -53,11 +52,11 @@
"wrappers": "wrappers" "wrappers": "wrappers"
}, },
"locked": { "locked": {
"lastModified": 1779362150, "lastModified": 1779544872,
"narHash": "sha256-y3JTpxmNgtEYG1m21Ymvdmrul/WvJzOCX45AlV21aak=", "narHash": "sha256-AnuNQ9nbXrDYmL97TOejAds/FQOgD6FEOHABp/8dmsU=",
"owner": "dwinkler1", "owner": "dwinkler1",
"repo": "nvimConfig", "repo": "nvimConfig",
"rev": "af6d975129768cce36ac4c46198ab2b3ebaafad3", "rev": "aec9110e709e1aa50d78f06293c4bde14974b23f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -82,44 +81,25 @@
"type": "github" "type": "github"
} }
}, },
"plugins-r": {
"flake": false,
"locked": {
"lastModified": 1776905071,
"narHash": "sha256-dXox6qEs1VDE7vPNDoN8bY4g06uj1IEs6uki72w8lpA=",
"owner": "R-nvim",
"repo": "R.nvim",
"rev": "582f2af11290ac067e49018db38e12a511325556",
"type": "github"
},
"original": {
"owner": "R-nvim",
"ref": "v0.99.4",
"repo": "R.nvim",
"type": "github"
}
},
"r-nvim-nix": { "r-nvim-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nvimConfig", "nvimConfig",
"rixpkgs" "rixpkgs"
], ],
"rnvimsrc": [ "rnvimsrc": "rnvimsrc"
"nvimConfig",
"plugins-r"
]
}, },
"locked": { "locked": {
"lastModified": 1778684156, "lastModified": 1779438909,
"narHash": "sha256-Z4y1tQfkIsPK4NRxGn668HMDfWxnxNxSJ0CAOOXiIfY=", "narHash": "sha256-1lvv0bdvSVyeCIgeZ7Ws7ffbDFurA5LJscS9dRLHzC8=",
"owner": "dwinkler1", "owner": "dwinkler1",
"repo": "r_nvim_nix", "repo": "r_nvim_nix",
"rev": "2f49dfee27886068e2f49cbd54558ce4cc424c82", "rev": "ec17e22ab362a0ddfd6c2e9c5e95d43897a143be",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "dwinkler1", "owner": "dwinkler1",
"ref": "v0.99.4",
"repo": "r_nvim_nix", "repo": "r_nvim_nix",
"type": "github" "type": "github"
} }
@ -140,6 +120,23 @@
"type": "github" "type": "github"
} }
}, },
"rnvimsrc": {
"flake": false,
"locked": {
"lastModified": 1776905071,
"narHash": "sha256-dXox6qEs1VDE7vPNDoN8bY4g06uj1IEs6uki72w8lpA=",
"owner": "R-nvim",
"repo": "R.nvim",
"rev": "582f2af11290ac067e49018db38e12a511325556",
"type": "github"
},
"original": {
"owner": "R-nvim",
"ref": "v0.99.4",
"repo": "R.nvim",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"fran": "fran", "fran": "fran",

View file

@ -6,196 +6,154 @@
nixpkgs, nixpkgs,
nvimConfig, nvimConfig,
... ...
} @ inputs: let }: let
# ── Shared language support flags ──────────────────────────────
# Used by both the neovim wrapper module and the devShell
cats = {
clickhouse = false;
gitPlugins = false;
julia = false;
lua = false;
markdown = false;
nix = true;
optional = false;
python = false;
r = false;
};
# ── Language package lists ────────────────────────────────────
# Shared between wrapper lang_packages and devShell toolchains.
# Accept pkgs so they work inside forAllSystems for each system.
rPackages = pkgs:
(with pkgs.rpkgs.rPackages; [
fixest
# pkgs.extraRPackages.musicMetadata
])
++ (
if builtins.pathExists ./r-packages.nix
# p: with p.rPackages; [ ... ]
then import ./r-packages.nix pkgs.rpkgs
else []
);
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"]; systems = ["aarch64-darwin" "x86_64-linux" "aarch64-linux"];
forAllSystems = nixpkgs.lib.genAttrs systems; forAllSystems = nixpkgs.lib.genAttrs systems;
overlays = [inputs.nvimConfig.overlays.dependencies];
mkPkgs = system:
import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [nvimConfig.overlays.dependencies];
};
projectModule = pkgs: let
baseConfig = nvimConfig.wrapperConfigs.default {inherit pkgs;};
extraRPackages =
if builtins.pathExists ./r-packages.nix
then import ./r-packages.nix pkgs.rpkgs
else [];
extraPythonPackages =
if builtins.pathExists ./python-packages.nix
then import ./python-packages.nix pkgs.python3Packages
else [];
extraJuliaPackages =
if builtins.pathExists ./julia-packages.nix
then import ./julia-packages.nix
else [];
projectName = builtins.baseNameOf (toString self.outPath);
in {
cats = {
clickhouse = false;
gitPlugins = false;
julia = false;
lua = false;
markdown = false;
nix = true;
optional = false;
python = false;
r = true;
};
settings = {
lang_packages = {
python = with pkgs.python3Packages;
[
requests
]
++ extraPythonPackages;
r =
(with pkgs.rpkgs.rPackages; [
arrow
data_table
fixest
pkgs.nvimcom
])
++ extraRPackages;
julia =
["StatsBase"]
++ extraJuliaPackages;
};
colorscheme = "tokyonight"; #"kanagawa";
background = "dark";
wrapRc = true;
};
binName = "nv";
env.IS_PROJECT_EDITOR = "1";
catPkgs = {
always = [
pkgs.git
pkgs.pre-commit
pkgs.cowsay
];
nix = [
pkgs.nil
pkgs.nixfmt
];
};
specs.extraLua = {
before = ["INIT_MAIN"];
data = pkgs.writeText "project-startup.lua" ''
require("mini.notify").setup()
vim.notify = MiniNotify.make_notify()
vim.notify("Welcome to ${projectName}!")
'';
};
};
in { in {
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); formatter = forAllSystems (system: (mkPkgs system).nixfmt-tree);
packages = forAllSystems (system: let packages = forAllSystems (system: let
pkgs = import nixpkgs { pkgs = mkPkgs system;
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 = "nv";
env = {
IS_PROJECT_EDITOR = "1";
};
runtimePkgs = with pkgs; [
cowsay
];
specs.extraLua = let
name = builtins.baseNameOf (builtins.toString ./.);
in {
data = pkgs.vimPlugins.mini-notify;
before = ["INIT_MAIN"];
config = ''
require("mini.notify").setup()
vim.notify = MiniNotify.make_notify()
vim.notify("Welcome to ${name}!")
'';
};
};
evalResult = nvimConfig.inputs.wrappers.lib.evalModules {
modules = [
nvimConfig.wrapperModules.default
projectSettings
];
};
in { in {
default = evalResult.config.wrap {inherit pkgs;}; default = nvimConfig.lib.mkWrapper {
inherit pkgs;
modules = [(projectModule pkgs)];
};
}); });
devShells = forAllSystems (system: let devShells = forAllSystems (system: let
pkgs = import nixpkgs { pkgs = mkPkgs system;
inherit system overlays; evalResult = nvimConfig.lib.eval {
config = {allowUnfree = true;}; inherit pkgs;
modules = [(projectModule pkgs)];
}; };
nv = self.packages.${system}.default; nv = evalResult.config.wrap {inherit pkgs;};
in { in {
default = pkgs.mkShell { default = pkgs.mkShell {
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 = packages =
[ [
nv nv
pkgs.git
pkgs.pre-commit
pkgs.nushell pkgs.nushell
] ]
# ── R toolchain (R REPL, quarto, LSP, formatter) ───── ++ nvimConfig.lib.devShellPackages evalResult.config;
++ pkgs.lib.optionals cats.r (let shellHook =
r_packages = (pkgs.baseRPackages or []) ++ rPackages pkgs; nvimConfig.lib.shellHook evalResult.config
in [ + ''
(pkgs.rWrapper.override {packages = r_packages;}) if [ -z "''${NO_NUSHELL:-}" ]; then
pkgs.radianWrapper exec nu
pkgs.air-formatter fi
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 = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
rixpkgs.url = "github:dwinkler1/rixpkgs/af2dd3f7b4b172077747c0869d4e30702fb71b0e"; rixpkgs.url = "github:dwinkler1/rixpkgs/af2dd3f7b4b172077747c0869d4e30702fb71b0e";
fran = { fran = {
url = "github:dwinkler1/fran"; url = "github:dwinkler1/fran";
inputs = { inputs.nixpkgs.follows = "rixpkgs";
nixpkgs.follows = "rixpkgs";
};
}; };
nvimConfig = { nvimConfig = {
url = "github:dwinkler1/nvimConfig"; url = "github:dwinkler1/nvimConfig";
inputs = { inputs = {
rixpkgs.follows = "rixpkgs";
nixpkgs.follows = "nixpkgs"; nixpkgs.follows = "nixpkgs";
rixpkgs.follows = "rixpkgs";
fran.follows = "fran"; fran.follows = "fran";
}; };
}; };

29
tests/ed/test.R Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env Rscript
packages <- c("arrow", "data.table", "fixest", "nvimcom")
failed <- character(0)
for (pkg in packages) {
ok <- tryCatch(
{
# nvimcom requires Neovim; skip loading but check it's installed
if (pkg == "nvimcom") {
requireNamespace(pkg, quietly = TRUE)
} else {
library(pkg, character.only = TRUE, quietly = TRUE)
}
TRUE
},
error = function(e) FALSE
)
if (!ok) {
failed <- c(failed, pkg)
}
}
if (length(failed) > 0) {
cat(sprintf("FAIL: %s\n", paste(failed, collapse = ", ")))
quit(status = 1)
}
cat("PASS: all packages loaded\n")

19
tests/ed/test.jl Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env julia
packages = ["StatsBase"]
failed = String[]
for pkg in packages
try
@eval using $pkg
catch
push!(failed, pkg)
end
end
if !isempty(failed)
@error "FAIL: $(join(failed, ", "))"
exit(1)
end
println("PASS: all packages loaded")

17
tests/ed/test.py Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env python3
import sys
packages = ["requests"]
failed = []
for pkg in packages:
try:
__import__(pkg)
except ImportError:
failed.append(pkg)
if failed:
sys.stderr.write(f"FAIL: {', '.join(failed)}\n")
sys.exit(1)
print("PASS: all packages loaded")