mirror of
https://github.com/dwinkler1/np.git
synced 2026-07-07 17:28:23 -04:00
Compare commits
No commits in common. "main" and "copilot/add-ci-checks-for-template" have entirely different histories.
main
...
copilot/ad
19 changed files with 381 additions and 636 deletions
26
.github/workflows/check.yml
vendored
26
.github/workflows/check.yml
vendored
|
|
@ -1,6 +1,20 @@
|
|||
name: "Test RDE template"
|
||||
on:
|
||||
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:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
|
@ -11,14 +25,14 @@ jobs:
|
|||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v5
|
||||
- uses: wimpysworld/nothing-but-nix@main
|
||||
with:
|
||||
hatchet-protocol: 'carve'
|
||||
- uses: cachix/install-nix-action@v31
|
||||
with:
|
||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: cachix/cachix-action@v17
|
||||
- uses: cachix/cachix-action@v16
|
||||
with:
|
||||
name: rde
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
|
|
@ -104,14 +118,14 @@ jobs:
|
|||
test-with-python:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v5
|
||||
- uses: wimpysworld/nothing-but-nix@main
|
||||
with:
|
||||
hatchet-protocol: 'carve'
|
||||
- uses: cachix/install-nix-action@v31
|
||||
with:
|
||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: cachix/cachix-action@v17
|
||||
- uses: cachix/cachix-action@v16
|
||||
with:
|
||||
name: rde
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
|
|
@ -160,14 +174,14 @@ jobs:
|
|||
test-with-julia:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v5
|
||||
- uses: wimpysworld/nothing-but-nix@main
|
||||
with:
|
||||
hatchet-protocol: 'carve'
|
||||
- uses: cachix/install-nix-action@v31
|
||||
with:
|
||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: cachix/cachix-action@v17
|
||||
- uses: cachix/cachix-action@v16
|
||||
with:
|
||||
name: rde
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
|
|
|
|||
123
.github/workflows/check_ed.yml
vendored
123
.github/workflows/check_ed.yml
vendored
|
|
@ -1,123 +0,0 @@
|
|||
name: "Test ed template"
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'templates/ed/**'
|
||||
- 'tests/ed/**'
|
||||
- '.github/workflows/check_ed.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'templates/ed/**'
|
||||
- 'tests/ed/**'
|
||||
- '.github/workflows/check_ed.yml'
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [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: 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"
|
||||
8
.github/workflows/check_macos.yml
vendored
8
.github/workflows/check_macos.yml
vendored
|
|
@ -3,7 +3,7 @@ on:
|
|||
workflow_dispatch: # allows manual triggering
|
||||
push:
|
||||
branches:
|
||||
- 'update_ed'
|
||||
- 'update_rde'
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
|
@ -14,13 +14,13 @@ jobs:
|
|||
matrix:
|
||||
os: [macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v5
|
||||
- uses: cachix/install-nix-action@v31
|
||||
with:
|
||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: cachix/cachix-action@v17
|
||||
- uses: cachix/cachix-action@v16
|
||||
with:
|
||||
name: rde
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
extraPullNames: rstats-on-nix, nix-community
|
||||
- run: nix build ./templates/ed
|
||||
- run: nix build ./templates/rde
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ jobs:
|
|||
id-token: "write"
|
||||
contents: "read"
|
||||
steps:
|
||||
- uses: "actions/checkout@v6"
|
||||
- uses: "actions/checkout@v5"
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: "DeterminateSystems/determinate-nix-action@v3"
|
||||
|
|
|
|||
13
.github/workflows/update.yml
vendored
13
.github/workflows/update.yml
vendored
|
|
@ -10,24 +10,25 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v5
|
||||
- uses: wimpysworld/nothing-but-nix@main
|
||||
with:
|
||||
hatchet-protocol: 'carve'
|
||||
- uses: cachix/install-nix-action@v31
|
||||
with:
|
||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: cachix/cachix-action@v17
|
||||
- uses: cachix/cachix-action@v16
|
||||
with:
|
||||
name: rde
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
extraPullNames: rstats-on-nix, nix-community
|
||||
- name: Update ed flake.lock
|
||||
uses: DeterminateSystems/update-flake-lock@v28
|
||||
- run: cd templates/rde/ && nix develop -c p-updateDeps
|
||||
- name: Update n flake.lock
|
||||
uses: DeterminateSystems/update-flake-lock@v27
|
||||
with:
|
||||
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
|
||||
branch: update_ed
|
||||
path-to-flake-dir: "templates/ed"
|
||||
branch: update_rde
|
||||
path-to-flake-dir: "templates/rde"
|
||||
pr-title: "Update RDE flake.lock" # Title of PR to be created
|
||||
pr-labels: | # Labels to be set on the PR
|
||||
dependencies
|
||||
|
|
|
|||
|
|
@ -6,11 +6,7 @@
|
|||
path = ./templates/rde;
|
||||
description = "Research Development Environment";
|
||||
};
|
||||
ed = {
|
||||
path = ./templates/ed;
|
||||
description = "Simple nvim Environment";
|
||||
};
|
||||
};
|
||||
defaultTemplate = self.templates.ed;
|
||||
defaultTemplate = self.templates.rde;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
use flake
|
||||
2
templates/ed/.gitignore
vendored
2
templates/ed/.gitignore
vendored
|
|
@ -1,2 +0,0 @@
|
|||
.nvimcom
|
||||
.commandcode/
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
# 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.
|
||||
172
templates/ed/flake.lock
generated
172
templates/ed/flake.lock
generated
|
|
@ -1,172 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"fran": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"rixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1776413584,
|
||||
"narHash": "sha256-xqqv46MTveuT4yJH2YihmbHGy5mdLnnLFDebVmUws/E=",
|
||||
"owner": "dwinkler1",
|
||||
"repo": "fran",
|
||||
"rev": "da09626e4dd8f0f57078b3a04e0443a8c20defa1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "dwinkler1",
|
||||
"repo": "fran",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1779560665,
|
||||
"narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "64c08a7ca051951c8eae34e3e3cb1e202fe36786",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvimConfig": {
|
||||
"inputs": {
|
||||
"fran": [
|
||||
"fran"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"plugins-cmp-pandoc-references": "plugins-cmp-pandoc-references",
|
||||
"r-nvim-nix": "r-nvim-nix",
|
||||
"rixpkgs": [
|
||||
"rixpkgs"
|
||||
],
|
||||
"wrappers": "wrappers"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1779544872,
|
||||
"narHash": "sha256-AnuNQ9nbXrDYmL97TOejAds/FQOgD6FEOHABp/8dmsU=",
|
||||
"owner": "dwinkler1",
|
||||
"repo": "nvimConfig",
|
||||
"rev": "aec9110e709e1aa50d78f06293c4bde14974b23f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "dwinkler1",
|
||||
"repo": "nvimConfig",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plugins-cmp-pandoc-references": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1743491695,
|
||||
"narHash": "sha256-XsdneGNJzmRBggk8lz9JNDQYk7wbYfUAF2oZLXzFb9c=",
|
||||
"owner": "jmbuhr",
|
||||
"repo": "cmp-pandoc-references",
|
||||
"rev": "130eae4f75029d6495808e0ea4b769fa1ce4c9ac",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "jmbuhr",
|
||||
"repo": "cmp-pandoc-references",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"r-nvim-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nvimConfig",
|
||||
"rixpkgs"
|
||||
],
|
||||
"rnvimsrc": "rnvimsrc"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1779438909,
|
||||
"narHash": "sha256-1lvv0bdvSVyeCIgeZ7Ws7ffbDFurA5LJscS9dRLHzC8=",
|
||||
"owner": "dwinkler1",
|
||||
"repo": "r_nvim_nix",
|
||||
"rev": "ec17e22ab362a0ddfd6c2e9c5e95d43897a143be",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "dwinkler1",
|
||||
"ref": "v0.99.4",
|
||||
"repo": "r_nvim_nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"rixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1771303851,
|
||||
"narHash": "sha256-tgveHozOJ2D/mi3LxVy/FcmLFDlM5XKZxsNB2XpvzaM=",
|
||||
"owner": "dwinkler1",
|
||||
"repo": "rixpkgs",
|
||||
"rev": "af2dd3f7b4b172077747c0869d4e30702fb71b0e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "dwinkler1",
|
||||
"repo": "rixpkgs",
|
||||
"rev": "af2dd3f7b4b172077747c0869d4e30702fb71b0e",
|
||||
"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": {
|
||||
"inputs": {
|
||||
"fran": "fran",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nvimConfig": "nvimConfig",
|
||||
"rixpkgs": "rixpkgs"
|
||||
}
|
||||
},
|
||||
"wrappers": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nvimConfig",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1779297405,
|
||||
"narHash": "sha256-VFoBwH7ZjVxCnvZTb5ODRXt70sLtWMxstive0N+RS50=",
|
||||
"owner": "BirdeeHub",
|
||||
"repo": "nix-wrapper-modules",
|
||||
"rev": "e7ed7a1205945befdf2e0d73ba7df91d935e5af1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "BirdeeHub",
|
||||
"repo": "nix-wrapper-modules",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
{
|
||||
description = "Project Editor";
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
nvimConfig,
|
||||
...
|
||||
}: let
|
||||
systems = ["aarch64-darwin" "x86_64-linux" "aarch64-linux"];
|
||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||
|
||||
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 {
|
||||
formatter = forAllSystems (system: (mkPkgs system).nixfmt-tree);
|
||||
|
||||
packages = forAllSystems (system: let
|
||||
pkgs = mkPkgs system;
|
||||
in {
|
||||
default = nvimConfig.lib.mkWrapper {
|
||||
inherit pkgs;
|
||||
modules = [(projectModule pkgs)];
|
||||
};
|
||||
});
|
||||
|
||||
devShells = forAllSystems (system: let
|
||||
pkgs = mkPkgs system;
|
||||
evalResult = nvimConfig.lib.eval {
|
||||
inherit pkgs;
|
||||
modules = [(projectModule pkgs)];
|
||||
};
|
||||
nv = evalResult.config.wrap {inherit pkgs;};
|
||||
in {
|
||||
default = pkgs.mkShell {
|
||||
packages =
|
||||
[
|
||||
nv
|
||||
pkgs.nushell
|
||||
]
|
||||
++ nvimConfig.lib.devShellPackages evalResult.config;
|
||||
shellHook =
|
||||
nvimConfig.lib.shellHook evalResult.config
|
||||
+ ''
|
||||
if [ -z "''${NO_NUSHELL:-}" ]; then
|
||||
exec nu
|
||||
fi
|
||||
'';
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
rixpkgs.url = "github:dwinkler1/rixpkgs/af2dd3f7b4b172077747c0869d4e30702fb71b0e";
|
||||
|
||||
fran = {
|
||||
url = "github:dwinkler1/fran";
|
||||
inputs.nixpkgs.follows = "rixpkgs";
|
||||
};
|
||||
|
||||
nvimConfig = {
|
||||
url = "github:dwinkler1/nvimConfig";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
rixpkgs.follows = "rixpkgs";
|
||||
fran.follows = "fran";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -367,6 +367,11 @@ The CI runs on:
|
|||
|
||||
This ensures that users can confidently use the template knowing that all advertised functionality has been verified.
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [REFACTORING.md](REFACTORING.md) - Technical details about the modular structure
|
||||
- [SUMMARY.md](SUMMARY.md) - Metrics and comparison with original template
|
||||
|
||||
## Usage
|
||||
|
||||
Use this template with:
|
||||
|
|
|
|||
150
templates/rde/REFACTORING.md
Normal file
150
templates/rde/REFACTORING.md
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
# Template Refactoring Summary
|
||||
|
||||
## Overview
|
||||
This document summarizes the refactoring improvements made to the RDE (Research Development Environment) template flake.
|
||||
|
||||
## Changes Made
|
||||
|
||||
### 1. File Structure Reorganization
|
||||
**Before**: Single 688-line `flake.nix` file
|
||||
**After**: Modular structure with 17 files across 5 directories
|
||||
|
||||
```
|
||||
templates/rde/
|
||||
├── flake.nix (261 lines) - Main configuration
|
||||
├── README.md - User documentation
|
||||
├── REFACTORING.md - This file
|
||||
├── overlays/ (5 files)
|
||||
│ ├── r.nix - R package configuration
|
||||
│ ├── python.nix - Python package configuration
|
||||
│ ├── rix.nix - rstats-on-nix integration
|
||||
│ ├── theme.nix - Neovim theme setup
|
||||
│ └── project-scripts.nix - Script wrapper definitions
|
||||
├── hosts/ (5 files)
|
||||
│ ├── default.nix - Merges all host configs
|
||||
│ ├── python.nix - Python command definitions
|
||||
│ ├── julia.nix - Julia command definitions
|
||||
│ ├── r.nix - R command definitions
|
||||
│ └── utils.nix - Utility command definitions
|
||||
├── lib/ (2 files)
|
||||
│ ├── shell-hook.nix - Dev shell welcome message
|
||||
│ └── mini-notify-config.lua - Neovim notification config
|
||||
└── scripts/ (4 files)
|
||||
├── initPython.sh - Python project initialization
|
||||
├── initProject.sh - Project structure setup
|
||||
├── updateDeps.sh - Dependency update script
|
||||
└── activateDevenv.sh - Devenv activation
|
||||
```
|
||||
|
||||
### 2. Key Improvements
|
||||
|
||||
#### Separation of Concerns
|
||||
- **Config**: Main configuration stays in flake.nix
|
||||
- **Overlays**: Package modifications isolated in overlays/
|
||||
- **Hosts**: Command definitions organized by language in hosts/
|
||||
- **Scripts**: Shell scripts extracted to scripts/ directory
|
||||
- **Helpers**: Utility functions in lib/
|
||||
|
||||
#### Readability
|
||||
- Reduced main file from 688 to 261 lines (62% reduction)
|
||||
- Added strategic comments explaining key sections
|
||||
- Extracted long inline strings to separate files
|
||||
- Grouped related functionality together
|
||||
|
||||
#### Maintainability
|
||||
- Language-specific changes isolated to dedicated files
|
||||
- Easy to add new languages (create new host/overlay files)
|
||||
- Easy to modify scripts without touching Nix code
|
||||
- Clear separation between different concerns
|
||||
|
||||
#### Reusability
|
||||
- Individual overlays can be reused in other projects
|
||||
- Host definitions can be copied/modified independently
|
||||
- Scripts can be tested/modified separately
|
||||
- Modular design allows selective adoption
|
||||
|
||||
### 3. Specific Extractions
|
||||
|
||||
#### Shell Scripts (200+ lines → 4 files)
|
||||
- `initPython.sh`: Python project initialization logic
|
||||
- `initProject.sh`: Directory structure and git setup
|
||||
- `updateDeps.sh`: Dependency update automation
|
||||
- `activateDevenv.sh`: Devenv shell activation
|
||||
|
||||
#### Overlays (100+ lines → 5 files)
|
||||
- `r.nix`: R package management with rix integration
|
||||
- `python.nix`: Python package configuration
|
||||
- `rix.nix`: rstats-on-nix package source
|
||||
- `theme.nix`: Neovim colorscheme handling
|
||||
- `project-scripts.nix`: Script wrapper generation
|
||||
|
||||
#### Host Definitions (200+ lines → 5 files)
|
||||
- `python.nix`: marimo, ipy, py, initPython commands
|
||||
- `julia.nix`: jl, pluto, initJl commands
|
||||
- `r.nix`: R console command
|
||||
- `utils.nix`: initProject, updateDeps, devenv commands
|
||||
- `default.nix`: Merges all host configurations
|
||||
|
||||
#### Helper Functions (40+ lines → 2 files)
|
||||
- `shell-hook.nix`: Dev shell welcome message generation
|
||||
- `mini-notify-config.lua`: Neovim notification filtering
|
||||
|
||||
### 4. Added Documentation
|
||||
|
||||
#### README.md
|
||||
- Overview of template purpose
|
||||
- Directory structure explanation
|
||||
- Benefits of modular design
|
||||
- Configuration instructions
|
||||
- Extension guidelines
|
||||
- Usage examples
|
||||
|
||||
#### Inline Comments
|
||||
- Section headers in flake.nix
|
||||
- Explanation of key configuration blocks
|
||||
- Purpose of each import
|
||||
- Documentation of categories and settings
|
||||
|
||||
### 5. Benefits Achieved
|
||||
|
||||
1. **Maintainability**:
|
||||
- Changes to one language don't affect others
|
||||
- Easy to locate and modify specific functionality
|
||||
- Clear ownership of different components
|
||||
|
||||
2. **Readability**:
|
||||
- Main file is now scannable and understandable
|
||||
- Related code grouped together
|
||||
- Inline documentation guides users
|
||||
|
||||
3. **Testability**:
|
||||
- Scripts can be tested independently
|
||||
- Overlays can be verified in isolation
|
||||
- Smaller files are easier to debug
|
||||
|
||||
4. **Extensibility**:
|
||||
- Clear patterns for adding new languages
|
||||
- Easy to add new commands
|
||||
- Simple to customize per language
|
||||
|
||||
5. **Learning**:
|
||||
- New users can understand the template structure
|
||||
- Examples in each file guide modifications
|
||||
- Documentation explains purpose and usage
|
||||
|
||||
## Migration Guide
|
||||
|
||||
For users of the old template:
|
||||
1. The functionality remains identical
|
||||
2. Configuration in the main config section is the same
|
||||
3. All commands work exactly as before
|
||||
4. To customize, now edit the specific file in the appropriate directory
|
||||
|
||||
## Future Improvements
|
||||
|
||||
Possible future enhancements:
|
||||
- Add validation scripts for configuration
|
||||
- Create unit tests for individual modules
|
||||
- Add more language examples (Go, Rust, etc.)
|
||||
- Create a configuration wizard script
|
||||
- Add CI/CD integration examples
|
||||
172
templates/rde/SUMMARY.md
Normal file
172
templates/rde/SUMMARY.md
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
# Template Refactoring - Complete Summary
|
||||
|
||||
## 🎯 Objective Achieved
|
||||
Successfully refactored the RDE template from a single 688-line file into a modular, maintainable structure.
|
||||
|
||||
## 📊 Key Metrics
|
||||
|
||||
| Aspect | Before | After | Improvement |
|
||||
|--------|--------|-------|-------------|
|
||||
| **Main file (flake.nix)** | 688 lines | 261 lines | **62% reduction** |
|
||||
| **File structure** | 1 monolithic file | 17 modular files | **Better organized** |
|
||||
| **Documentation** | 0 lines | 218 lines | **Fully documented** |
|
||||
| **Directories** | 0 | 5 organized dirs | **Clear structure** |
|
||||
|
||||
## 📁 New Structure
|
||||
|
||||
```
|
||||
templates/rde/
|
||||
├── 📄 flake.nix (261 lines) # Main config - clean & commented
|
||||
├── 📖 README.md # User guide
|
||||
├── 📖 REFACTORING.md # Technical details
|
||||
│
|
||||
├── 📂 overlays/ # Package configurations
|
||||
│ ├── r.nix # R packages
|
||||
│ ├── python.nix # Python packages
|
||||
│ ├── rix.nix # R nixpkgs source
|
||||
│ ├── theme.nix # Neovim themes
|
||||
│ └── project-scripts.nix # Script wrappers
|
||||
│
|
||||
├── 📂 hosts/ # Command definitions
|
||||
│ ├── default.nix # Merger
|
||||
│ ├── python.nix # Python commands
|
||||
│ ├── julia.nix # Julia commands
|
||||
│ ├── r.nix # R commands
|
||||
│ └── utils.nix # Utility commands
|
||||
│
|
||||
├── 📂 lib/ # Helper functions
|
||||
│ ├── shell-hook.nix # Welcome message
|
||||
│ └── mini-notify-config.lua # Neovim config
|
||||
│
|
||||
└── 📂 scripts/ # Shell scripts
|
||||
├── initPython.sh # Python init
|
||||
├── initProject.sh # Project setup
|
||||
├── updateDeps.sh # Update deps
|
||||
└── activateDevenv.sh # Devenv activation
|
||||
```
|
||||
|
||||
## ✨ Key Improvements
|
||||
|
||||
### 1. **Separation of Concerns**
|
||||
- Configuration stays in main flake.nix
|
||||
- Language-specific code in dedicated files
|
||||
- Scripts separated from Nix code
|
||||
- Helpers isolated in lib/
|
||||
|
||||
### 2. **Enhanced Readability**
|
||||
- Main file reduced from 688 → 261 lines
|
||||
- Strategic comments explain sections
|
||||
- Clear naming conventions
|
||||
- Logical grouping of related code
|
||||
|
||||
### 3. **Better Maintainability**
|
||||
- Modify one language without affecting others
|
||||
- Easy to locate specific functionality
|
||||
- Clear patterns for adding features
|
||||
- Reduced risk of breaking changes
|
||||
|
||||
### 4. **Improved Extensibility**
|
||||
- Add new languages: create host + overlay files
|
||||
- Add new commands: edit relevant host file
|
||||
- Modify scripts: edit .sh files directly
|
||||
- Customize behavior: clear config section
|
||||
|
||||
### 5. **Comprehensive Documentation**
|
||||
- README.md: User-facing guide
|
||||
- REFACTORING.md: Technical details
|
||||
- Inline comments: Explain key sections
|
||||
- Examples: Show how to extend
|
||||
|
||||
## 🔄 Backwards Compatibility
|
||||
|
||||
✅ **Zero Breaking Changes**
|
||||
- All existing functionality preserved
|
||||
- Same configuration interface
|
||||
- All commands work identically
|
||||
- Migration is seamless
|
||||
|
||||
## 🎓 Learning Benefits
|
||||
|
||||
### For Users
|
||||
- Easier to understand template structure
|
||||
- Clear examples for customization
|
||||
- Self-documenting code organization
|
||||
- Guided by inline comments
|
||||
|
||||
### For Developers
|
||||
- Easy to modify individual components
|
||||
- Clear separation aids debugging
|
||||
- Modular structure enables testing
|
||||
- Well-documented refactoring process
|
||||
|
||||
## 📈 Before & After Comparison
|
||||
|
||||
### Before Refactoring
|
||||
```nix
|
||||
{
|
||||
description = "New Project";
|
||||
outputs = { ... }: let
|
||||
config = { ... };
|
||||
# 200+ lines of inline bash scripts
|
||||
initPython = ''
|
||||
#!/usr/bin/env bash
|
||||
# ... lots of bash code ...
|
||||
'';
|
||||
# 100+ lines of overlay definitions
|
||||
rOverlay = final: prev: let
|
||||
# ... complex overlay code ...
|
||||
# 300+ lines of host definitions
|
||||
hosts = {
|
||||
marimo = let marimoInit = ''
|
||||
# ... more inline bash ...
|
||||
# ... continues for 688 lines total
|
||||
```
|
||||
|
||||
### After Refactoring
|
||||
```nix
|
||||
{
|
||||
description = "New Project";
|
||||
outputs = { ... }: let
|
||||
# Clear config section
|
||||
config = { ... };
|
||||
|
||||
# Import from organized modules
|
||||
rOverlay = import ./overlays/r.nix;
|
||||
pythonOverlay = import ./overlays/python.nix;
|
||||
# ... clean imports ...
|
||||
|
||||
# Main configuration
|
||||
projectConfig = forSystems (system:
|
||||
# ... focused on structure, not details
|
||||
```
|
||||
|
||||
## 🚀 Next Steps
|
||||
|
||||
The template is now:
|
||||
1. ✅ Well-organized and modular
|
||||
2. ✅ Fully documented
|
||||
3. ✅ Easy to maintain
|
||||
4. ✅ Simple to extend
|
||||
5. ✅ Ready for production use
|
||||
|
||||
## 💡 Usage
|
||||
|
||||
No changes required for existing users! The template works exactly as before, but now with:
|
||||
- Better code organization
|
||||
- Comprehensive documentation
|
||||
- Easier customization options
|
||||
- Clearer structure for learning
|
||||
|
||||
## 📝 Files Modified
|
||||
|
||||
- `flake.nix` - Simplified and reorganized
|
||||
- Created `overlays/` - Package configurations
|
||||
- Created `hosts/` - Command definitions
|
||||
- Created `lib/` - Helper functions
|
||||
- Created `scripts/` - Shell scripts
|
||||
- Added `README.md` - User documentation
|
||||
- Added `REFACTORING.md` - Technical guide
|
||||
|
||||
## 🎉 Success!
|
||||
|
||||
The refactoring is complete. The template is now significantly more maintainable, readable, and extensible while preserving all original functionality.
|
||||
35
templates/rde/flake.lock
generated
35
templates/rde/flake.lock
generated
|
|
@ -4,14 +4,17 @@
|
|||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"rixpkgs"
|
||||
],
|
||||
"nvimcom": [
|
||||
"plugins-r"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1776413584,
|
||||
"narHash": "sha256-xqqv46MTveuT4yJH2YihmbHGy5mdLnnLFDebVmUws/E=",
|
||||
"lastModified": 1761271358,
|
||||
"narHash": "sha256-Yf1u/FvSKCD0sr0xmTE/Cwgy7H/YW2L/1R7tbxtLfDw=",
|
||||
"owner": "dwinkler1",
|
||||
"repo": "fran",
|
||||
"rev": "da09626e4dd8f0f57078b3a04e0443a8c20defa1",
|
||||
"rev": "3bcaf6aa8b74bb1f754e14d975d64bd970fdbe56",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -43,11 +46,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770172580,
|
||||
"narHash": "sha256-l/fKPLdKxq7PLRbExDxsS4Esel4yos/NFJOFcDpsm2E=",
|
||||
"lastModified": 1765425579,
|
||||
"narHash": "sha256-XQLrlG8Uf1GOBy5EQlPP19foLfF3CY/ruQc9xonyGCQ=",
|
||||
"owner": "dwinkler1",
|
||||
"repo": "nixCatsConfig",
|
||||
"rev": "98079a0844e53afd0c593c8f4d1ee5381baf36f0",
|
||||
"rev": "7fc90930a9cb08aeccd575122f6fc1524ed2c71b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -58,11 +61,11 @@
|
|||
},
|
||||
"nixCats_2": {
|
||||
"locked": {
|
||||
"lastModified": 1769085828,
|
||||
"narHash": "sha256-TjhFIAtS628+/r3IuYWPcNa++mUMMDDG8PbSfFHXBiA=",
|
||||
"lastModified": 1763330129,
|
||||
"narHash": "sha256-KbOeWIF52SV53BOeETGO2C5ewaV2Ex9iaXH7G72gOr8=",
|
||||
"owner": "BirdeeHub",
|
||||
"repo": "nixCats-nvim",
|
||||
"rev": "43fbf4d12b0a613f1a792503da4bb2bf270173c7",
|
||||
"rev": "c81551ed87db2aefab30a12cf7425ff94dc0ad64",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -73,11 +76,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1777077449,
|
||||
"narHash": "sha256-AIiMJiqvGrN4HyLEbKAoCSRRYn0rnlW5VbKNIMIYqm4=",
|
||||
"lastModified": 1765838191,
|
||||
"narHash": "sha256-m5KWt1nOm76ILk/JSCxBM4MfK3rYY7Wq9/TZIIeGnT8=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a4bf06618f0b5ee50f14ed8f0da77d34ecc19160",
|
||||
"rev": "c6f52ebd45e5925c188d1a20119978aa4ffd5ef6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -138,16 +141,16 @@
|
|||
},
|
||||
"rixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1776958221,
|
||||
"narHash": "sha256-cOHLrMWifj8HQMIG6gMhGowwPAkyX/kijDx38wK8kUM=",
|
||||
"lastModified": 1765802109,
|
||||
"narHash": "sha256-Aru0TG1mEhIJiaXElFopn5lrAE+pyxfF0JelHOIY4FQ=",
|
||||
"owner": "rstats-on-nix",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "db90c554b7172188324b84deea35ed5975e20e44",
|
||||
"rev": "bdfc55ed37f7d1228a856be0f57876596b04477a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rstats-on-nix",
|
||||
"ref": "2026-04-22",
|
||||
"ref": "2025-12-15",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@
|
|||
});
|
||||
};
|
||||
inputs = {
|
||||
rixpkgs.url = "github:rstats-on-nix/nixpkgs/2026-04-22";
|
||||
rixpkgs.url = "github:rstats-on-nix/nixpkgs/2025-12-15";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
||||
nixCats = {
|
||||
url = "github:dwinkler1/nixCatsConfig";
|
||||
|
|
@ -237,6 +237,7 @@
|
|||
url = "github:dwinkler1/fran";
|
||||
inputs = {
|
||||
nixpkgs.follows = "rixpkgs";
|
||||
nvimcom.follows = "plugins-r";
|
||||
};
|
||||
};
|
||||
## Git Plugins
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
#!/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")
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
#!/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")
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
#!/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")
|
||||
Loading…
Add table
Add a link
Reference in a new issue