mirror of
https://github.com/dwinkler1/np.git
synced 2026-11-22 01:14:39 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8ef849d68 |
93 changed files with 4471 additions and 2716 deletions
194
.github/copilot-instructions.md
vendored
194
.github/copilot-instructions.md
vendored
|
|
@ -1,194 +0,0 @@
|
||||||
# GitHub Copilot Instructions for np Repository
|
|
||||||
|
|
||||||
## Repository Overview
|
|
||||||
|
|
||||||
This repository provides Nix flake templates for setting up Research Development Environments (RDE). The primary template is located in `templates/rde/` and is designed for data science and research projects supporting R, Python, and Julia.
|
|
||||||
|
|
||||||
## Project Structure
|
|
||||||
|
|
||||||
- `flake.nix` - Root flake defining available templates
|
|
||||||
- `templates/rde/` - Main RDE template with Neovim-based development environment
|
|
||||||
- `flake.nix` - Template flake configuration with language support and tooling
|
|
||||||
- `flake.lock` - Locked dependencies for reproducibility
|
|
||||||
- `.envrc` - direnv configuration for automatic environment loading
|
|
||||||
- `.github/workflows/` - CI/CD workflows for testing and updates
|
|
||||||
- `check.yml` - Tests RDE template on Ubuntu
|
|
||||||
- `check_macos.yml` - Tests RDE template on macOS
|
|
||||||
- `update.yml` - Automated daily dependency updates
|
|
||||||
|
|
||||||
## Key Technologies
|
|
||||||
|
|
||||||
- **Nix Flakes**: Reproducible development environments
|
|
||||||
- **nixCats**: Custom Neovim configuration framework
|
|
||||||
- **direnv**: Automatic environment loading
|
|
||||||
- **Cachix**: Binary cache for faster builds (using `rde`, `rstats-on-nix`, and `nix-community` caches)
|
|
||||||
|
|
||||||
## Language Support
|
|
||||||
|
|
||||||
The RDE template supports multiple languages, controlled via `config.enabledLanguages` in `templates/rde/flake.nix`:
|
|
||||||
|
|
||||||
- **R**: R wrapper, Quarto, air-formatter, language server, and custom R packages via overlays
|
|
||||||
- **Python**: Python 3, basedpyright LSP, UV package manager
|
|
||||||
- **Julia**: Julia REPL with Pluto.jl support
|
|
||||||
|
|
||||||
## Development Commands
|
|
||||||
|
|
||||||
The template provides project-specific commands (prefix with package name, default is `p`):
|
|
||||||
|
|
||||||
- `p` - Launch Neovim
|
|
||||||
- `p-g` - Launch Neovide GUI
|
|
||||||
- `p-initProject` - Initialize project structure (data/, src/, docs/)
|
|
||||||
- `p-updateDeps` - Update all dependencies (flake inputs, R packages, Python packages)
|
|
||||||
- `p-r` - Launch R console
|
|
||||||
- `p-py` / `p-ipy` - Launch Python/IPython REPL
|
|
||||||
- `p-marimo` - Launch Marimo notebook
|
|
||||||
- `p-jl` - Launch Julia REPL
|
|
||||||
- `p-pluto` - Launch Pluto.jl notebook
|
|
||||||
- `p-devenv` - Devenv integration (when enabled)
|
|
||||||
|
|
||||||
## Nix Flake Conventions
|
|
||||||
|
|
||||||
### Configuration Structure
|
|
||||||
|
|
||||||
The RDE template uses a centralized `config` object at the top of `flake.nix`:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
config = rec {
|
|
||||||
defaultPackageName = "p";
|
|
||||||
enabledLanguages = { julia = false; python = false; r = true; };
|
|
||||||
enabledPackages = { gitPlugins = enabledLanguages.r; devenv = false; };
|
|
||||||
theme = { colorscheme = "kanagawa"; background = "dark"; };
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
### Overlays Pattern
|
|
||||||
|
|
||||||
The template uses multiple overlays to extend nixpkgs:
|
|
||||||
|
|
||||||
- `rOverlay` - Adds R packages via rix/rstats-on-nix
|
|
||||||
- `pythonOverlay` - Configures Python packages
|
|
||||||
- `rixOverlay` - Integrates R package snapshots from rstats-on-nix
|
|
||||||
- `projectScriptsOverlay` - Custom shell scripts for project management
|
|
||||||
- `extraPkgOverlay` - Additional theme and plugin configuration
|
|
||||||
|
|
||||||
### Package Categories
|
|
||||||
|
|
||||||
nixCats uses categories to organize functionality:
|
|
||||||
|
|
||||||
- `lspsAndRuntimeDeps` - Language servers and runtime dependencies
|
|
||||||
- `startupPlugins` - Neovim plugins loaded at startup
|
|
||||||
- `optionalPlugins` - Plugins loaded on demand
|
|
||||||
- `environmentVariables` - Language-specific environment setup
|
|
||||||
- `extraWrapperArgs` - Additional wrapper arguments (e.g., unset PYTHONPATH for Python)
|
|
||||||
|
|
||||||
## Testing & CI/CD
|
|
||||||
|
|
||||||
### Local Testing
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Build the RDE template
|
|
||||||
nix build ./templates/rde
|
|
||||||
|
|
||||||
# Check the RDE template
|
|
||||||
nix flake check ./templates/rde
|
|
||||||
|
|
||||||
# Enter development shell
|
|
||||||
nix develop ./templates/rde
|
|
||||||
```
|
|
||||||
|
|
||||||
### CI Workflows
|
|
||||||
|
|
||||||
- **check.yml**: Runs on pushes to `templates/rde/flake.lock`, builds and checks the template on Ubuntu
|
|
||||||
- **check_macos.yml**: Tests on macOS when `update_rde` branch is pushed
|
|
||||||
- **update.yml**: Daily cron job that updates dependencies via `p-updateDeps` and creates PRs
|
|
||||||
|
|
||||||
## Dependency Management
|
|
||||||
|
|
||||||
### R Packages
|
|
||||||
|
|
||||||
R packages are managed through rstats-on-nix pinned snapshots. The date is specified in the `rixpkgs.url` input:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
rixpkgs.url = "github:rstats-on-nix/nixpkgs/2025-12-15";
|
|
||||||
```
|
|
||||||
|
|
||||||
Custom R packages can be added in `rOverlay` or via `r-packages.nix` file.
|
|
||||||
|
|
||||||
### Python Packages
|
|
||||||
|
|
||||||
Python packages use UV for management with nixpkgs Python as the interpreter:
|
|
||||||
|
|
||||||
- Environment variables force UV to use nix Python: `UV_PYTHON_DOWNLOADS = "never"` and `UV_PYTHON = pkgs.python.interpreter`
|
|
||||||
- PYTHONPATH is explicitly unset via `extraWrapperArgs`
|
|
||||||
|
|
||||||
### Flake Inputs
|
|
||||||
|
|
||||||
Dependencies are tracked in `flake.lock`. Key inputs include:
|
|
||||||
|
|
||||||
- `nixpkgs` - NixOS 25.11
|
|
||||||
- `rixpkgs` - R package snapshots from rstats-on-nix
|
|
||||||
- `nixCats` - Custom Neovim configuration framework
|
|
||||||
- `fran` - Extra R packages overlay
|
|
||||||
- Plugin inputs for R.nvim ecosystem
|
|
||||||
|
|
||||||
## Coding Style & Conventions
|
|
||||||
|
|
||||||
1. **Nix Code**:
|
|
||||||
- Use `rec` for recursive attribute sets when needed
|
|
||||||
- Prefer `let...in` for local bindings
|
|
||||||
- Use `lib.optional` and `lib.optionalString` for conditional inclusion
|
|
||||||
- Keep configuration at the top of the file for easy customization
|
|
||||||
|
|
||||||
2. **Shell Scripts** (in overlays):
|
|
||||||
- Always use `set -euo pipefail` for safety
|
|
||||||
- Provide user-friendly output with emojis and clear messages
|
|
||||||
- Check for existing files/directories before creating
|
|
||||||
|
|
||||||
3. **Workflows**:
|
|
||||||
- Use `workflow_dispatch` for manual triggering
|
|
||||||
- Configure concurrency to cancel in-progress runs
|
|
||||||
- Use Cachix for binary caching with multiple caches
|
|
||||||
|
|
||||||
## Common Patterns
|
|
||||||
|
|
||||||
### Adding a New Language
|
|
||||||
|
|
||||||
1. Add to `config.enabledLanguages`
|
|
||||||
2. Create overlay for language-specific packages
|
|
||||||
3. Add to `categoryDefinitions.lspsAndRuntimeDeps`
|
|
||||||
4. Add command aliases in `packageDefinitions.hosts`
|
|
||||||
5. Update `shellHook` with available commands
|
|
||||||
|
|
||||||
### Adding Custom Scripts
|
|
||||||
|
|
||||||
Add to `projectScriptsOverlay`:
|
|
||||||
|
|
||||||
```nix
|
|
||||||
myScript = prev.writeShellScriptBin "myScript" ''
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
# script content
|
|
||||||
'';
|
|
||||||
```
|
|
||||||
|
|
||||||
### Plugin Integration
|
|
||||||
|
|
||||||
For git-based plugins:
|
|
||||||
1. Add flake input with `flake = false`
|
|
||||||
2. Reference in nixCats inputs
|
|
||||||
3. Add to `startupPlugins` or `optionalPlugins` categories
|
|
||||||
|
|
||||||
## Important Notes
|
|
||||||
|
|
||||||
- The template creates a `.gitignore` that excludes data files by default
|
|
||||||
- R packages are installed to project-local `.Rlibs/` directory
|
|
||||||
- Python UV is configured to never download Python, always using nixpkgs version
|
|
||||||
- The template supports multiple platforms: x86_64-linux, aarch64-linux, aarch64-darwin
|
|
||||||
- Neovim is wrapped with language-specific environment variables and PATH additions
|
|
||||||
|
|
||||||
## File Generation
|
|
||||||
|
|
||||||
When asked to initialize projects or generate common files, follow the patterns in:
|
|
||||||
- `initProjectScript` for project structure
|
|
||||||
- `.gitignore` template for what to exclude
|
|
||||||
- `README.md` template for documentation structure
|
|
||||||
199
.github/workflows/check.yml
vendored
199
.github/workflows/check.yml
vendored
|
|
@ -1,6 +1,9 @@
|
||||||
name: "Test RDE template"
|
name: "Test template"
|
||||||
on:
|
on:
|
||||||
workflow_dispatch: # allows manual triggering
|
workflow_dispatch: # allows manual triggering
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- 'templates/n/flake.lock'
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
@ -11,199 +14,13 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v7
|
- uses: actions/checkout@v5
|
||||||
- uses: wimpysworld/nothing-but-nix@main
|
- uses: wimpysworld/nothing-but-nix@main
|
||||||
with:
|
with:
|
||||||
hatchet-protocol: 'carve'
|
hatchet-protocol: 'carve'
|
||||||
- uses: cachix/install-nix-action@v31
|
- uses: cachix/install-nix-action@v31
|
||||||
with:
|
with:
|
||||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- uses: cachix/cachix-action@v17
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
with:
|
- run: nix build ./templates/n
|
||||||
name: rde
|
- run: nix flake check ./templates/n
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
||||||
extraPullNames: rstats-on-nix, nix-community
|
|
||||||
# - uses: DeterminateSystems/magic-nix-cache-action@main
|
|
||||||
|
|
||||||
# Build and basic checks
|
|
||||||
- name: Build template
|
|
||||||
run: nix build ./templates/rde
|
|
||||||
- name: Run flake check
|
|
||||||
run: nix flake check ./templates/rde
|
|
||||||
|
|
||||||
# Test development shell functionality
|
|
||||||
- name: Test dev shell enters successfully
|
|
||||||
run: |
|
|
||||||
cd templates/rde
|
|
||||||
nix develop --command bash -c "echo 'Dev shell works'"
|
|
||||||
|
|
||||||
# Test R functionality (default enabled)
|
|
||||||
- name: Test R command is available
|
|
||||||
run: |
|
|
||||||
cd templates/rde
|
|
||||||
nix develop --command bash -c "which p-r"
|
|
||||||
|
|
||||||
- name: Test R launches and runs basic command
|
|
||||||
run: |
|
|
||||||
cd templates/rde
|
|
||||||
nix develop --command bash -c "p-r --version"
|
|
||||||
|
|
||||||
- name: Test R can execute simple code
|
|
||||||
run: |
|
|
||||||
cd templates/rde
|
|
||||||
nix develop --command bash -c "p-r -e 'print(1+1)'"
|
|
||||||
|
|
||||||
- name: Test Quarto is available in R environment
|
|
||||||
run: |
|
|
||||||
cd templates/rde
|
|
||||||
nix develop --command bash -c "quarto --version"
|
|
||||||
|
|
||||||
# Test Neovim functionality
|
|
||||||
- name: Test Neovim command is available
|
|
||||||
run: |
|
|
||||||
cd templates/rde
|
|
||||||
nix develop --command bash -c "which p"
|
|
||||||
|
|
||||||
- name: Test Neovim launches in headless mode
|
|
||||||
run: |
|
|
||||||
cd templates/rde
|
|
||||||
nix develop --command bash -c "p --headless --version"
|
|
||||||
|
|
||||||
# Test utility commands
|
|
||||||
- name: Test p-initProject command is available
|
|
||||||
run: |
|
|
||||||
cd templates/rde
|
|
||||||
nix develop --command bash -c "which p-initProject"
|
|
||||||
|
|
||||||
- name: Test p-initProject creates project structure
|
|
||||||
run: |
|
|
||||||
TEST_DIR=$(mktemp -d)
|
|
||||||
cd "$TEST_DIR"
|
|
||||||
nix develop $GITHUB_WORKSPACE/templates/rde --command bash -c "p-initProject"
|
|
||||||
# Verify directories were created
|
|
||||||
test -d data/raw || exit 1
|
|
||||||
test -d data/processed || exit 1
|
|
||||||
test -d src || exit 1
|
|
||||||
test -f README.md || exit 1
|
|
||||||
test -f .gitignore || exit 1
|
|
||||||
echo "Project structure created successfully"
|
|
||||||
# Cleanup
|
|
||||||
rm -rf "$TEST_DIR"
|
|
||||||
|
|
||||||
- name: Test p-updateDeps command is available
|
|
||||||
run: |
|
|
||||||
cd templates/rde
|
|
||||||
nix develop --command bash -c "which p-updateDeps"
|
|
||||||
|
|
||||||
# Test that package is built correctly
|
|
||||||
- name: Test default package can be run
|
|
||||||
run: |
|
|
||||||
cd templates/rde
|
|
||||||
nix run . -- --headless --version
|
|
||||||
|
|
||||||
test-with-python:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v7
|
|
||||||
- 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
|
|
||||||
with:
|
|
||||||
name: rde
|
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
||||||
extraPullNames: rstats-on-nix, nix-community
|
|
||||||
|
|
||||||
# Create a temporary directory with Python enabled
|
|
||||||
- name: Setup test directory with Python enabled
|
|
||||||
run: |
|
|
||||||
TEST_DIR=$(mktemp -d)
|
|
||||||
cp -r templates/rde/. "$TEST_DIR/"
|
|
||||||
cd "$TEST_DIR"
|
|
||||||
# Enable Python in the config (handle variations in whitespace)
|
|
||||||
sed -i 's/python[[:space:]]*=[[:space:]]*false;/python = true;/' flake.nix
|
|
||||||
# Verify the change was successful
|
|
||||||
grep -q "python[[:space:]]*=[[:space:]]*true;" flake.nix || {
|
|
||||||
echo "Error: Failed to enable Python in flake.nix"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
echo "TEST_PYTHON_DIR=$TEST_DIR" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Build with Python enabled
|
|
||||||
run: |
|
|
||||||
cd "$TEST_PYTHON_DIR"
|
|
||||||
nix build
|
|
||||||
|
|
||||||
- name: Test Python commands are available
|
|
||||||
run: |
|
|
||||||
cd "$TEST_PYTHON_DIR"
|
|
||||||
nix develop --command bash -c "which p-py && which p-ipy && which p-initPython"
|
|
||||||
|
|
||||||
- name: Test Python launches
|
|
||||||
run: |
|
|
||||||
cd "$TEST_PYTHON_DIR"
|
|
||||||
nix develop --command bash -c "p-py --version"
|
|
||||||
|
|
||||||
- name: Test Python can execute code
|
|
||||||
run: |
|
|
||||||
cd "$TEST_PYTHON_DIR"
|
|
||||||
nix develop --command bash -c "p-py -c 'print(1+1)'"
|
|
||||||
|
|
||||||
- name: Test UV package manager is available
|
|
||||||
run: |
|
|
||||||
cd "$TEST_PYTHON_DIR"
|
|
||||||
nix develop --command bash -c "uv --version"
|
|
||||||
|
|
||||||
test-with-julia:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v7
|
|
||||||
- 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
|
|
||||||
with:
|
|
||||||
name: rde
|
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
||||||
extraPullNames: rstats-on-nix, nix-community
|
|
||||||
|
|
||||||
# Create a temporary directory with Julia enabled
|
|
||||||
- name: Setup test directory with Julia enabled
|
|
||||||
run: |
|
|
||||||
TEST_DIR=$(mktemp -d)
|
|
||||||
cp -r templates/rde/. "$TEST_DIR/"
|
|
||||||
cd "$TEST_DIR"
|
|
||||||
# Enable Julia in the config (handle variations in whitespace)
|
|
||||||
sed -i 's/julia[[:space:]]*=[[:space:]]*false;/julia = true;/' flake.nix
|
|
||||||
# Verify the change was successful
|
|
||||||
grep -q "julia[[:space:]]*=[[:space:]]*true;" flake.nix || {
|
|
||||||
echo "Error: Failed to enable Julia in flake.nix"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
echo "TEST_JULIA_DIR=$TEST_DIR" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Build with Julia enabled
|
|
||||||
run: |
|
|
||||||
cd "$TEST_JULIA_DIR"
|
|
||||||
nix build
|
|
||||||
|
|
||||||
- name: Test Julia commands are available
|
|
||||||
run: |
|
|
||||||
cd "$TEST_JULIA_DIR"
|
|
||||||
nix develop --command bash -c "which p-jl && which p-initJl"
|
|
||||||
|
|
||||||
- name: Test Julia launches
|
|
||||||
run: |
|
|
||||||
cd "$TEST_JULIA_DIR"
|
|
||||||
nix develop --command bash -c "p-jl --version"
|
|
||||||
|
|
||||||
- name: Test Julia can execute code
|
|
||||||
run: |
|
|
||||||
cd "$TEST_JULIA_DIR"
|
|
||||||
nix develop --command bash -c "p-jl -e 'println(1+1)'"
|
|
||||||
|
|
|
||||||
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@v7
|
|
||||||
- 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@v7
|
|
||||||
- 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@v7
|
|
||||||
- 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"
|
|
||||||
12
.github/workflows/check_macos.yml
vendored
12
.github/workflows/check_macos.yml
vendored
|
|
@ -3,7 +3,7 @@ on:
|
||||||
workflow_dispatch: # allows manual triggering
|
workflow_dispatch: # allows manual triggering
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'update_ed'
|
- 'update_n'
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
@ -14,13 +14,9 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest]
|
os: [macos-latest]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v7
|
- uses: actions/checkout@v5
|
||||||
- uses: cachix/install-nix-action@v31
|
- uses: cachix/install-nix-action@v31
|
||||||
with:
|
with:
|
||||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- uses: cachix/cachix-action@v17
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
with:
|
- run: nix build ./templates/n
|
||||||
name: rde
|
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
||||||
extraPullNames: rstats-on-nix, nix-community
|
|
||||||
- run: nix build ./templates/ed
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ jobs:
|
||||||
id-token: "write"
|
id-token: "write"
|
||||||
contents: "read"
|
contents: "read"
|
||||||
steps:
|
steps:
|
||||||
- uses: "actions/checkout@v7"
|
- uses: "actions/checkout@v5"
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- uses: "DeterminateSystems/determinate-nix-action@v3"
|
- uses: "DeterminateSystems/determinate-nix-action@v3"
|
||||||
|
|
|
||||||
28
.github/workflows/update.yml
vendored
28
.github/workflows/update.yml
vendored
|
|
@ -3,32 +3,24 @@ name: update-flake-lock
|
||||||
on:
|
on:
|
||||||
workflow_dispatch: # allows manual triggering
|
workflow_dispatch: # allows manual triggering
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 6 * * *'
|
- cron: '0 3 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lockfile:
|
lockfile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v5
|
||||||
- uses: wimpysworld/nothing-but-nix@main
|
- name: Install Determinate Nix
|
||||||
with:
|
uses: DeterminateSystems/determinate-nix-action@v3
|
||||||
hatchet-protocol: 'carve'
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
- uses: cachix/install-nix-action@v31
|
- name: Update n flake.lock
|
||||||
with:
|
uses: DeterminateSystems/update-flake-lock@v27
|
||||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- uses: cachix/cachix-action@v17
|
|
||||||
with:
|
|
||||||
name: rde
|
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
||||||
extraPullNames: rstats-on-nix, nix-community
|
|
||||||
- name: Update ed flake.lock
|
|
||||||
uses: DeterminateSystems/update-flake-lock@v29
|
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
|
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}
|
||||||
branch: update_ed
|
branch: update_n
|
||||||
path-to-flake-dir: "templates/ed"
|
path-to-flake-dir: "templates/n"
|
||||||
pr-title: "Update RDE flake.lock" # Title of PR to be created
|
pr-title: "Update n 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
|
||||||
dependencies
|
dependencies
|
||||||
automated
|
automated
|
||||||
|
|
|
||||||
70
README.md
70
README.md
|
|
@ -1,70 +0,0 @@
|
||||||
# Nix Project Templates (np)
|
|
||||||
|
|
||||||
A collection of Nix flake templates for reproducible development environments.
|
|
||||||
|
|
||||||
## Templates
|
|
||||||
|
|
||||||
### RDE (Research Development Environment)
|
|
||||||
|
|
||||||
The default template for data science and research projects with support for R, Python, and Julia.
|
|
||||||
|
|
||||||
**Quick start:**
|
|
||||||
```bash
|
|
||||||
nix flake init -t github:dwinkler1/np#rde
|
|
||||||
nix develop
|
|
||||||
```
|
|
||||||
|
|
||||||
**Features:**
|
|
||||||
- 🔬 Multi-language support (R, Python, Julia)
|
|
||||||
- 📦 Reproducible with Nix
|
|
||||||
- 🎨 Neovim-based IDE with LSP support
|
|
||||||
- 📊 Research-focused workflows
|
|
||||||
- 🔧 Modular and customizable
|
|
||||||
|
|
||||||
See [templates/rde/README.md](templates/rde/README.md) for full documentation.
|
|
||||||
|
|
||||||
## CI/CD
|
|
||||||
|
|
||||||
All templates are automatically tested to ensure functionality:
|
|
||||||
|
|
||||||
- **Build Tests**: Templates build successfully on Linux and macOS
|
|
||||||
- **Functionality Tests**: All commands and language support are verified
|
|
||||||
- **Configuration Tests**: Multiple configurations (R, Python, Julia) are tested
|
|
||||||
- **Automated Updates**: Dependencies are updated daily via automated PRs
|
|
||||||
|
|
||||||
### CI Workflows
|
|
||||||
|
|
||||||
- `.github/workflows/check.yml` - Comprehensive functionality tests (Ubuntu)
|
|
||||||
- `.github/workflows/check_macos.yml` - macOS compatibility tests
|
|
||||||
- `.github/workflows/update.yml` - Automated dependency updates
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
1. **Initialize a new project:**
|
|
||||||
```bash
|
|
||||||
nix flake init -t github:dwinkler1/np#rde
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Enter development environment:**
|
|
||||||
```bash
|
|
||||||
nix develop
|
|
||||||
# or with direnv
|
|
||||||
echo "use flake" > .envrc && direnv allow
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Start working:**
|
|
||||||
```bash
|
|
||||||
p-initProject # Create project structure
|
|
||||||
p # Launch Neovim
|
|
||||||
```
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
Contributions are welcome! Please ensure:
|
|
||||||
- All templates pass CI tests
|
|
||||||
- Documentation is updated for new features
|
|
||||||
- Code follows existing patterns
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
See [LICENSE](LICENSE) file for details.
|
|
||||||
22
flake.nix
22
flake.nix
|
|
@ -2,15 +2,23 @@
|
||||||
description = "Project Templates";
|
description = "Project Templates";
|
||||||
outputs = {self}: {
|
outputs = {self}: {
|
||||||
templates = {
|
templates = {
|
||||||
rde = {
|
n = {
|
||||||
path = ./templates/rde;
|
path = ./templates/n;
|
||||||
description = "Research Development Environment";
|
description = "Minimal Development environment";
|
||||||
};
|
};
|
||||||
ed = {
|
r = {
|
||||||
path = ./templates/ed;
|
path = ./templates/r;
|
||||||
description = "Simple nvim Environment";
|
description = "R development environment";
|
||||||
|
};
|
||||||
|
sci = {
|
||||||
|
path = ./templates/sci;
|
||||||
|
description = "Scientific computing environment (Julia, Python, R)";
|
||||||
|
};
|
||||||
|
sci_minimal = {
|
||||||
|
path = ./templates/sci_minimal;
|
||||||
|
description = "Scientific computing environment (Julia, Python, R) without folder structure";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
defaultTemplate = self.templates.ed;
|
defaultTemplate = self.templates.n;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
templates/ed/.gitignore
vendored
3
templates/ed/.gitignore
vendored
|
|
@ -1,3 +0,0 @@
|
||||||
.nvimcom
|
|
||||||
.commandcode/
|
|
||||||
.r-*
|
|
||||||
|
|
@ -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": 1788301035,
|
|
||||||
"narHash": "sha256-rXbea8cWNeVbNM3tN0n8HvI0+/ibx+rTlrLvz3Jgeek=",
|
|
||||||
"owner": "dwinkler1",
|
|
||||||
"repo": "fran",
|
|
||||||
"rev": "e6d5adae59621135817bcb51afa0dcaa3a2d4e28",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "dwinkler1",
|
|
||||||
"repo": "fran",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1789785513,
|
|
||||||
"narHash": "sha256-B44WL6h0XoLjJ41bUPJk0X5SDinLCII//6EcBLXKiJ0=",
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "20b1ddd1aa5ace70c9468305030aa4f9ef79671b",
|
|
||||||
"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": 1788301294,
|
|
||||||
"narHash": "sha256-V5mxoR+VJiiSAlmKd4adkr5uiOYKM5PDfQTDU7QHSUs=",
|
|
||||||
"owner": "dwinkler1",
|
|
||||||
"repo": "nvimConfig",
|
|
||||||
"rev": "1c3c1ccde40d7c316b2f90b4a7a1222d8c1fd46b",
|
|
||||||
"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": 1784867506,
|
|
||||||
"narHash": "sha256-5zXVJLG7+Gi9sgb4Dn7P6O/ywQQxpvcjjoHSJXZEuVo=",
|
|
||||||
"owner": "dwinkler1",
|
|
||||||
"repo": "r_nvim_nix",
|
|
||||||
"rev": "1d26452e3c940153271fc57fbad0b295fcb0e04f",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "dwinkler1",
|
|
||||||
"ref": "v1.0.0",
|
|
||||||
"repo": "r_nvim_nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1788208780,
|
|
||||||
"narHash": "sha256-ouq3GjmTOXtWVufLOhMqLAEJXxrlkhDYtZJt3YfN5oU=",
|
|
||||||
"owner": "dwinkler1",
|
|
||||||
"repo": "rixpkgs",
|
|
||||||
"rev": "f3d00cb8f39262e6ca15c2046bd29ca8a52aae31",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "dwinkler1",
|
|
||||||
"ref": "nixpkgs",
|
|
||||||
"repo": "rixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rnvimsrc": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1783264911,
|
|
||||||
"narHash": "sha256-FywUL3mV2+kfu+rO6uUFyUv80EflbdgSkYuSnW965UE=",
|
|
||||||
"owner": "R-nvim",
|
|
||||||
"repo": "R.nvim",
|
|
||||||
"rev": "c56ebe0f8445e251673981c40ac2d74659ecd6ed",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "R-nvim",
|
|
||||||
"ref": "v1.0.0",
|
|
||||||
"repo": "R.nvim",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"fran": "fran",
|
|
||||||
"nixpkgs": "nixpkgs",
|
|
||||||
"nvimConfig": "nvimConfig",
|
|
||||||
"rixpkgs": "rixpkgs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"wrappers": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nvimConfig",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1787722691,
|
|
||||||
"narHash": "sha256-bWBt7v2FhgG6WTLgSi8nYGi1zXaTdA+vTdCRdvR2vcw=",
|
|
||||||
"owner": "BirdeeHub",
|
|
||||||
"repo": "nix-wrapper-modules",
|
|
||||||
"rev": "04ef216559b18214853879df862f493a9e6bb8cf",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "BirdeeHub",
|
|
||||||
"repo": "nix-wrapper-modules",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
||||||
|
|
@ -1,153 +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; [
|
|
||||||
fixest
|
|
||||||
])
|
|
||||||
++ 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
|
|
||||||
]
|
|
||||||
++ nvimConfig.lib.devShellPackages evalResult.config;
|
|
||||||
shellHook =
|
|
||||||
nvimConfig.lib.shellHook evalResult.config;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
||||||
|
|
||||||
#rixpkgs.url = "github:dwinkler1/rixpkgs/af2dd3f7b4b172077747c0869d4e30702fb71b0e";
|
|
||||||
rixpkgs.url = "github:dwinkler1/rixpkgs/nixpkgs";
|
|
||||||
|
|
||||||
fran = {
|
|
||||||
url = "github:dwinkler1/fran";
|
|
||||||
inputs.nixpkgs.follows = "rixpkgs";
|
|
||||||
};
|
|
||||||
|
|
||||||
nvimConfig = {
|
|
||||||
url = "github:dwinkler1/nvimConfig";
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.follows = "nixpkgs";
|
|
||||||
rixpkgs.follows = "rixpkgs";
|
|
||||||
fran.follows = "fran";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
1
templates/n/.envrc
Normal file
1
templates/n/.envrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
||||||
199
templates/n/flake.lock
generated
Normal file
199
templates/n/flake.lock
generated
Normal file
|
|
@ -0,0 +1,199 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixCats": {
|
||||||
|
"inputs": {
|
||||||
|
"nixCats": "nixCats_2",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
|
"plugins-cmp-pandoc-references": "plugins-cmp-pandoc-references",
|
||||||
|
"plugins-cmp-r": "plugins-cmp-r",
|
||||||
|
"plugins-r": "plugins-r",
|
||||||
|
"rixpkgs": [
|
||||||
|
"rixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1756305715,
|
||||||
|
"narHash": "sha256-GuNro+bHHMde1X2uoaDS0UwJa1aaVTDvG4KmQOmCAWE=",
|
||||||
|
"owner": "dwinkler1",
|
||||||
|
"repo": "nixCatsConfig",
|
||||||
|
"rev": "e0f5193d7299c36724d17728511260e0d453f0dc",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "dwinkler1",
|
||||||
|
"repo": "nixCatsConfig",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixCats_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1756094250,
|
||||||
|
"narHash": "sha256-Bkghd2NdQqQfKwSftABMDjnfRMFTJXA/XvvfKVonV/Q=",
|
||||||
|
"owner": "BirdeeHub",
|
||||||
|
"repo": "nixCats-nvim",
|
||||||
|
"rev": "7496b06144a15e44301aacea31c3e1ccdb81546e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "BirdeeHub",
|
||||||
|
"repo": "nixCats-nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1756288264,
|
||||||
|
"narHash": "sha256-Om8adB1lfkU7D33VpR+/haZ2gI5r3Q+ZbIPzE5sYnwE=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "ddd1826f294a0ee5fdc198ab72c8306a0ea73aa9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-unstable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1756159630,
|
||||||
|
"narHash": "sha256-ohMvsjtSVdT/bruXf5ClBh8ZYXRmD4krmjKrXhEvwMg=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "84c256e42600cb0fdf25763b48d28df2f25a0c8b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plugins-cmp-pandoc-references_2": {
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plugins-cmp-r": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1746709841,
|
||||||
|
"narHash": "sha256-TwmLSILu1H3RyRivCQlbsgUN4dsEqO1E8Hx71N/lFws=",
|
||||||
|
"owner": "R-nvim",
|
||||||
|
"repo": "cmp-r",
|
||||||
|
"rev": "602f399c4efde01147cadfebcc884b7aa154f8b7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "R-nvim",
|
||||||
|
"repo": "cmp-r",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plugins-cmp-r_2": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1746709841,
|
||||||
|
"narHash": "sha256-TwmLSILu1H3RyRivCQlbsgUN4dsEqO1E8Hx71N/lFws=",
|
||||||
|
"owner": "R-nvim",
|
||||||
|
"repo": "cmp-r",
|
||||||
|
"rev": "602f399c4efde01147cadfebcc884b7aa154f8b7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "R-nvim",
|
||||||
|
"repo": "cmp-r",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plugins-r": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1755532199,
|
||||||
|
"narHash": "sha256-mb8HCaMasPUP9JZUkH1sPrtdbhM2HMUkJEKDsRt6wTs=",
|
||||||
|
"owner": "R-nvim",
|
||||||
|
"repo": "R.nvim",
|
||||||
|
"rev": "fd992e1c13ad3df794a30af2e937b994bf7bf4db",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "R-nvim",
|
||||||
|
"repo": "R.nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"plugins-r_2": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1755532199,
|
||||||
|
"narHash": "sha256-mb8HCaMasPUP9JZUkH1sPrtdbhM2HMUkJEKDsRt6wTs=",
|
||||||
|
"owner": "R-nvim",
|
||||||
|
"repo": "R.nvim",
|
||||||
|
"rev": "fd992e1c13ad3df794a30af2e937b994bf7bf4db",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "R-nvim",
|
||||||
|
"repo": "R.nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1754915244,
|
||||||
|
"narHash": "sha256-WtdFq/HbvAgq03AMhSAJW35go6R5bqhGNf2KBzXqH2U=",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/rstats-on-nix/nixpkgs/archive/2025-08-11.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/rstats-on-nix/nixpkgs/archive/2025-08-11.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixCats": "nixCats",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"plugins-cmp-pandoc-references": "plugins-cmp-pandoc-references_2",
|
||||||
|
"plugins-cmp-r": "plugins-cmp-r_2",
|
||||||
|
"plugins-r": "plugins-r_2",
|
||||||
|
"rixpkgs": "rixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
314
templates/n/flake.nix
Normal file
314
templates/n/flake.nix
Normal file
|
|
@ -0,0 +1,314 @@
|
||||||
|
{
|
||||||
|
description = "New Project";
|
||||||
|
inputs = {
|
||||||
|
rixpkgs.url = "https://github.com/rstats-on-nix/nixpkgs/archive/2025-08-11.tar.gz";
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
|
nixCats.url = "github:dwinkler1/nixCatsConfig";
|
||||||
|
nixCats.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
nixCats.inputs.rixpkgs.follows = "rixpkgs";
|
||||||
|
## All git packages managed per project
|
||||||
|
"plugins-r" = {
|
||||||
|
url = "github:R-nvim/R.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
"plugins-cmp-r" = {
|
||||||
|
url = "github:R-nvim/cmp-r";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
"plugins-cmp-pandoc-references" = {
|
||||||
|
url = "github:jmbuhr/cmp-pandoc-references";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
nixCats,
|
||||||
|
...
|
||||||
|
} @ inputs: let
|
||||||
|
forSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.all;
|
||||||
|
defaultPackageName = "p";
|
||||||
|
projectConfig = forSystems (
|
||||||
|
system: let
|
||||||
|
inherit (nixCats) utils;
|
||||||
|
inherit defaultPackageName;
|
||||||
|
prevPackage = nixCats.packages.${system}.default;
|
||||||
|
finalPackage = prevPackage.override (prev: {
|
||||||
|
name = defaultPackageName;
|
||||||
|
dependencyOverlays =
|
||||||
|
prev.dependencyOverlays
|
||||||
|
++ [
|
||||||
|
(utils.standardPluginOverlay inputs)
|
||||||
|
## Pull in local rix copy
|
||||||
|
(final: prev: {
|
||||||
|
rpkgs = inputs.rixpkgs.legacyPackages.${prev.system};
|
||||||
|
})
|
||||||
|
## Define project level R packages
|
||||||
|
(
|
||||||
|
final: prev: let
|
||||||
|
reqPkgs = with prev.rpkgs.rPackages; [
|
||||||
|
Hmisc
|
||||||
|
Rcpp
|
||||||
|
arm
|
||||||
|
broom
|
||||||
|
car
|
||||||
|
data_table
|
||||||
|
devtools
|
||||||
|
janitor
|
||||||
|
konfound
|
||||||
|
languageserver
|
||||||
|
quarto
|
||||||
|
reprex
|
||||||
|
styler
|
||||||
|
tidyverse
|
||||||
|
(buildRPackage {
|
||||||
|
name = "nvimcom";
|
||||||
|
src = inputs.plugins-r;
|
||||||
|
sourceRoot = "source/nvimcom";
|
||||||
|
buildInputs = with prev.rpkgs; [
|
||||||
|
R
|
||||||
|
stdenv.cc.cc
|
||||||
|
gnumake
|
||||||
|
];
|
||||||
|
propagatedBuildInputs = [];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
in {
|
||||||
|
quarto = prev.rpkgs.quarto.override {extraRPackages = reqPkgs;};
|
||||||
|
rWrapper = prev.rpkgs.rWrapper.override {packages = reqPkgs;};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
## Define project level Python Packages
|
||||||
|
## Only use if uv should not be used
|
||||||
|
(
|
||||||
|
final: prev: let
|
||||||
|
reqPkgs = pyPackages:
|
||||||
|
with pyPackages; [
|
||||||
|
numpy
|
||||||
|
polars
|
||||||
|
requests
|
||||||
|
];
|
||||||
|
in {
|
||||||
|
python = prev.python3.withPackages reqPkgs;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
|
categoryDefinitions = utils.mergeCatDefs prev.categoryDefinitions (
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
settings,
|
||||||
|
categories,
|
||||||
|
name,
|
||||||
|
extra,
|
||||||
|
mkPlugin,
|
||||||
|
...
|
||||||
|
} @ packageDef: {
|
||||||
|
lspsAndRuntimeDeps = {
|
||||||
|
project = with pkgs; [
|
||||||
|
];
|
||||||
|
julia = with pkgs; [
|
||||||
|
julia-bin
|
||||||
|
];
|
||||||
|
python = with pkgs; [
|
||||||
|
python
|
||||||
|
nodejs
|
||||||
|
pyright
|
||||||
|
uv
|
||||||
|
];
|
||||||
|
r = with pkgs; [
|
||||||
|
rWrapper
|
||||||
|
quarto
|
||||||
|
air-formatter
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
startupPlugins = {
|
||||||
|
project = with pkgs.vimPlugins; [
|
||||||
|
];
|
||||||
|
gitPlugins = with pkgs.neovimPlugins; [
|
||||||
|
{
|
||||||
|
plugin = r;
|
||||||
|
config.lua = "vim.notify('Using project local R plugin')";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
optionalPlugins = {
|
||||||
|
project = with pkgs.vimPlugins; [
|
||||||
|
];
|
||||||
|
gitPlugins = with pkgs.neovimPlugins; [
|
||||||
|
cmp-r
|
||||||
|
cmp-pandoc-references
|
||||||
|
];
|
||||||
|
};
|
||||||
|
optionalLuaPreInit = {
|
||||||
|
project = [
|
||||||
|
''
|
||||||
|
local predicate = function(notif)
|
||||||
|
if not (notif.data.source == "lsp_progress" and notif.data.client_name == "lua_ls") then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
-- Filter out some LSP progress notifications from 'lua_ls'
|
||||||
|
return notif.msg:find("Diagnosing") == nil and notif.msg:find("semantic tokens") == nil
|
||||||
|
end
|
||||||
|
local custom_sort = function(notif_arr)
|
||||||
|
return MiniNotify.default_sort(vim.tbl_filter(predicate, notif_arr))
|
||||||
|
end
|
||||||
|
require("mini.notify").setup({ content = { sort = custom_sort } })
|
||||||
|
vim.notify = MiniNotify.make_notify()
|
||||||
|
''
|
||||||
|
];
|
||||||
|
};
|
||||||
|
optionalLuaAdditions = {
|
||||||
|
project = [
|
||||||
|
"vim.notify('Project loaded: ${name}')"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
sharedLibraries = {
|
||||||
|
project = {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environmentVariables = {
|
||||||
|
project = {
|
||||||
|
};
|
||||||
|
julia = {
|
||||||
|
JULIA_NUM_THREADS = "auto";
|
||||||
|
};
|
||||||
|
python = {
|
||||||
|
# Prevent uv from managing Python downloads
|
||||||
|
UV_PYTHON_DOWNLOADS = "never";
|
||||||
|
# Force uv to use nixpkgs Python interpreter
|
||||||
|
UV_PYTHON = pkgs.python.interpreter;
|
||||||
|
};
|
||||||
|
r = {
|
||||||
|
R_LIBS_USER = "./.Rlibs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extraWrapperArgs = {
|
||||||
|
python = [
|
||||||
|
"--unset PYTHONPATH"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
packageDefinitions =
|
||||||
|
prev.packageDefinitions
|
||||||
|
// {
|
||||||
|
"${defaultPackageName}" = utils.mergeCatDefs prev.packageDefinitions.n (
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
name,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
settings = {
|
||||||
|
suffix-path = false;
|
||||||
|
suffix-LD = false;
|
||||||
|
# your alias may not conflict with your other packages.
|
||||||
|
aliases = ["pvim"];
|
||||||
|
hosts = {
|
||||||
|
g = {
|
||||||
|
enable = true;
|
||||||
|
path = {
|
||||||
|
value = "${pkgs.neovide}/bin/neovide";
|
||||||
|
args = [
|
||||||
|
"--add-flags"
|
||||||
|
"--neovim-bin ${name}"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
m = let
|
||||||
|
preHookInit = ''
|
||||||
|
# Check if pyproject.toml exists
|
||||||
|
if [ ! -f "pyproject.toml" ]; then
|
||||||
|
echo "pyproject.toml not found. Initializing new UV project..."
|
||||||
|
|
||||||
|
# Initialize UV project
|
||||||
|
uv init
|
||||||
|
|
||||||
|
# Check if uv init was successful
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "UV project initialized successfully."
|
||||||
|
|
||||||
|
# Add marimo dependency
|
||||||
|
echo "Adding marimo dependency..."
|
||||||
|
uv add marimo
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Marimo added successfully!"
|
||||||
|
else
|
||||||
|
echo "Error: Failed to add marimo dependency."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error: Failed to initialize UV project."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "pyproject.toml already exists. Syncing...."
|
||||||
|
uv sync
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
enable = true;
|
||||||
|
path = {
|
||||||
|
value = "${pkgs.uv}/bin/uv";
|
||||||
|
args = [
|
||||||
|
"--run"
|
||||||
|
"${preHookInit}"
|
||||||
|
"--add-flags"
|
||||||
|
"run marimo edit"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
jl = {
|
||||||
|
enable = false;
|
||||||
|
path = {
|
||||||
|
value = "${pkgs.julia-bin}/bin/julia";
|
||||||
|
args = ["--add-flags" "--project=@."];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
r = {
|
||||||
|
enable = true;
|
||||||
|
path = {
|
||||||
|
value = "${pkgs.rWrapper}/bin/R";
|
||||||
|
args = ["--add-flags" "--no-save --no-restore"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
node.enable = true;
|
||||||
|
perl.enable = true;
|
||||||
|
ruby.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
categories = {
|
||||||
|
julia = false;
|
||||||
|
python = false;
|
||||||
|
r = true;
|
||||||
|
project = true;
|
||||||
|
gitPlugins = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
in
|
||||||
|
utils.mkAllWithDefault finalPackage
|
||||||
|
);
|
||||||
|
in {
|
||||||
|
packages = projectConfig;
|
||||||
|
devShells = forSystems (system: let
|
||||||
|
pkgs = import nixpkgs {inherit system;};
|
||||||
|
in {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
name = defaultPackageName;
|
||||||
|
packages = [projectConfig.${system}.default];
|
||||||
|
inputsFrom = [];
|
||||||
|
shellHook = ''
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
2
templates/r/.gitignore
vendored
Normal file
2
templates/r/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
data/*
|
||||||
|
!data/.gitkeep
|
||||||
199
templates/r/.zk/config.toml
Normal file
199
templates/r/.zk/config.toml
Normal file
|
|
@ -0,0 +1,199 @@
|
||||||
|
# zk configuration file
|
||||||
|
#
|
||||||
|
# Uncomment the properties you want to customize.
|
||||||
|
|
||||||
|
# NOTE SETTINGS
|
||||||
|
#
|
||||||
|
# Defines the default options used when generating new notes.
|
||||||
|
[note]
|
||||||
|
|
||||||
|
# Language used when writing notes.
|
||||||
|
# This is used to generate slugs or with date formats.
|
||||||
|
#language = "en"
|
||||||
|
|
||||||
|
# The default title used for new note, if no `--title` flag is provided.
|
||||||
|
#default-title = "Untitled"
|
||||||
|
|
||||||
|
# Template used to generate a note's filename, without extension.
|
||||||
|
extension = "md"
|
||||||
|
filename = "docs/{{slug title}}-{{format-date now '%Y-%m-%d'}}-{{id}}"
|
||||||
|
language = "en"
|
||||||
|
|
||||||
|
# The file extension used for the notes.
|
||||||
|
#extension = "md"
|
||||||
|
|
||||||
|
# Template used to generate a note's content.
|
||||||
|
# If not an absolute path or "~/unix/path", it's relative to .zk/templates/
|
||||||
|
template = "default.md"
|
||||||
|
|
||||||
|
# Path globs ignored while indexing existing notes.
|
||||||
|
#exclude = [
|
||||||
|
# "drafts/*",
|
||||||
|
# "log.md"
|
||||||
|
#]
|
||||||
|
|
||||||
|
# Configure random ID generation.
|
||||||
|
|
||||||
|
# The charset used for random IDs. You can use:
|
||||||
|
# * letters: only letters from a to z.
|
||||||
|
# * numbers: 0 to 9
|
||||||
|
# * alphanum: letters + numbers
|
||||||
|
# * hex: hexadecimal, from a to f and 0 to 9
|
||||||
|
# * custom string: will use any character from the provided value
|
||||||
|
#id-charset = "alphanum"
|
||||||
|
|
||||||
|
# Length of the generated IDs.
|
||||||
|
#id-length = 4
|
||||||
|
|
||||||
|
# Letter case for the random IDs, among lower, upper or mixed.
|
||||||
|
#id-case = "lower"
|
||||||
|
|
||||||
|
|
||||||
|
# EXTRA VARIABLES
|
||||||
|
#
|
||||||
|
# A dictionary of variables you can use for any custom values when generating
|
||||||
|
# new notes. They are accessible in templates with {{extra.<key>}}
|
||||||
|
[extra]
|
||||||
|
|
||||||
|
#key = "value"
|
||||||
|
|
||||||
|
|
||||||
|
# GROUP OVERRIDES
|
||||||
|
#
|
||||||
|
# You can override global settings from [note] and [extra] for a particular
|
||||||
|
# group of notes by declaring a [group."<name>"] section.
|
||||||
|
#
|
||||||
|
# Specify the list of directories which will automatically belong to the group
|
||||||
|
# with the optional `paths` property.
|
||||||
|
#
|
||||||
|
# Omitting `paths` is equivalent to providing a single path equal to the name of
|
||||||
|
# the group. This can be useful to quickly declare a group by the name of the
|
||||||
|
# directory it applies to.
|
||||||
|
|
||||||
|
#[group."<NAME>"]
|
||||||
|
#paths = ["<DIR1>", "<DIR2>"]
|
||||||
|
#[group."<NAME>".note]
|
||||||
|
#filename = "{{format-date now}}"
|
||||||
|
#[group."<NAME>".extra]
|
||||||
|
#key = "value"
|
||||||
|
|
||||||
|
|
||||||
|
# MARKDOWN SETTINGS
|
||||||
|
[format.markdown]
|
||||||
|
|
||||||
|
# Format used to generate links between notes.
|
||||||
|
# Either "wiki", "markdown" or a custom template. Default is "markdown".
|
||||||
|
link-format = "wiki"
|
||||||
|
# Indicates whether a link's path will be percent-encoded.
|
||||||
|
# Defaults to true for "markdown" format and false for "wiki" format.
|
||||||
|
#link-encode-path = true
|
||||||
|
# Indicates whether a link's path file extension will be removed.
|
||||||
|
# Defaults to true.
|
||||||
|
#link-drop-extension = true
|
||||||
|
|
||||||
|
# Enable support for #hashtags.
|
||||||
|
hashtags = false
|
||||||
|
# Enable support for :colon:separated:tags:.
|
||||||
|
colon-tags = true
|
||||||
|
# Enable support for Bear's #multi-word tags#
|
||||||
|
# Hashtags must be enabled for multi-word tags to work.
|
||||||
|
multiword-tags = false
|
||||||
|
|
||||||
|
|
||||||
|
# EXTERNAL TOOLS
|
||||||
|
[tool]
|
||||||
|
|
||||||
|
# Default editor used to open notes. When not set, the EDITOR or VISUAL
|
||||||
|
# environment variables are used.
|
||||||
|
#editor = "vim"
|
||||||
|
|
||||||
|
# Pager used to scroll through long output. If you want to disable paging
|
||||||
|
# altogether, set it to an empty string "".
|
||||||
|
#pager = "less -FIRX"
|
||||||
|
|
||||||
|
# Command used to preview a note during interactive fzf mode.
|
||||||
|
# Set it to an empty string "" to disable preview.
|
||||||
|
|
||||||
|
# bat is a great tool to render Markdown document with syntax highlighting.
|
||||||
|
#https://github.com/sharkdp/bat
|
||||||
|
#fzf-preview = "bat -p --color always {-1}"
|
||||||
|
|
||||||
|
|
||||||
|
# LSP
|
||||||
|
#
|
||||||
|
# Configure basic editor integration for LSP-compatible editors.
|
||||||
|
# See https://github.com/zk-org/zk/blob/main/docs/editors-integration.md
|
||||||
|
#
|
||||||
|
[lsp]
|
||||||
|
|
||||||
|
[lsp.diagnostics]
|
||||||
|
# Each diagnostic can have for value: none, hint, info, warning, error
|
||||||
|
|
||||||
|
# Report titles of wiki-links as hints.
|
||||||
|
wiki-title = "hint"
|
||||||
|
# Warn for dead links between notes.
|
||||||
|
dead-link = "error"
|
||||||
|
|
||||||
|
[lsp.completion]
|
||||||
|
# Customize the completion pop-up of your LSP client.
|
||||||
|
|
||||||
|
# Show the note title in the completion pop-up, or fallback on its path if empty.
|
||||||
|
#note-label = "{{title-or-path}}"
|
||||||
|
# Filter out the completion pop-up using the note title or its path.
|
||||||
|
#note-filter-text = "{{title}} {{path}}"
|
||||||
|
# Show the note filename without extension as detail.
|
||||||
|
#note-detail = "{{filename-stem}}"
|
||||||
|
|
||||||
|
|
||||||
|
# NAMED FILTERS
|
||||||
|
#
|
||||||
|
# A named filter is a set of note filtering options used frequently together.
|
||||||
|
#
|
||||||
|
[filter]
|
||||||
|
|
||||||
|
# Matches the notes created the last two weeks. For example:
|
||||||
|
# $ zk list recents --limit 15
|
||||||
|
# $ zk edit recents --interactive
|
||||||
|
#recents = "--sort created- --created-after 'last two weeks'"
|
||||||
|
|
||||||
|
|
||||||
|
# COMMAND ALIASES
|
||||||
|
#
|
||||||
|
# Aliases are user commands called with `zk <alias> [<flags>] [<args>]`.
|
||||||
|
#
|
||||||
|
# The alias will be executed with `$SHELL -c`, please refer to your shell's
|
||||||
|
# man page to see the available syntax. In most shells:
|
||||||
|
# * $@ can be used to expand all the provided flags and arguments
|
||||||
|
# * you can pipe commands together with the usual | character
|
||||||
|
#
|
||||||
|
[alias]
|
||||||
|
# Here are a few aliases to get you started.
|
||||||
|
|
||||||
|
# Shortcut to a command.
|
||||||
|
#ls = "zk list $@"
|
||||||
|
|
||||||
|
# Default flags for an existing command.
|
||||||
|
#list = "zk list --quiet $@"
|
||||||
|
|
||||||
|
# Edit the last modified note.
|
||||||
|
#editlast = "zk edit --limit 1 --sort modified- $@"
|
||||||
|
|
||||||
|
# Edit the notes selected interactively among the notes created the last two weeks.
|
||||||
|
# This alias doesn't take any argument, so we don't use $@.
|
||||||
|
#recent = "zk edit --sort created- --created-after 'last two weeks' --interactive"
|
||||||
|
|
||||||
|
# Print paths separated with colons for the notes found with the given
|
||||||
|
# arguments. This can be useful to expand a complex search query into a flag
|
||||||
|
# taking only paths. For example:
|
||||||
|
# zk list --link-to "`zk path -m potatoe`"
|
||||||
|
#path = "zk list --quiet --format {{path}} --delimiter , $@"
|
||||||
|
|
||||||
|
# Show a random note.
|
||||||
|
#lucky = "zk list --quiet --format full --sort random --limit 1"
|
||||||
|
|
||||||
|
# Returns the Git history for the notes found with the given arguments.
|
||||||
|
# Note the use of a pipe and the location of $@.
|
||||||
|
#hist = "zk list --format path --delimiter0 --quiet $@ | xargs -t -0 git log --patch --"
|
||||||
|
|
||||||
|
# Edit this configuration file.
|
||||||
|
#conf = '$EDITOR "$ZK_NOTEBOOK_DIR/.zk/config.toml"'
|
||||||
BIN
templates/r/.zk/notebook.db
Normal file
BIN
templates/r/.zk/notebook.db
Normal file
Binary file not shown.
3
templates/r/.zk/templates/default.md
Normal file
3
templates/r/.zk/templates/default.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# {{title}}
|
||||||
|
|
||||||
|
{{content}}
|
||||||
4
templates/r/Justfile
Normal file
4
templates/r/Justfile
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
rverurl := 'https://raw.githubusercontent.com/ropensci/rix/refs/heads/main/inst/extdata/available_df.csv'
|
||||||
|
update-r-version:
|
||||||
|
RVER=$( wget -qO- {{rverurl}} | tail -n 2 | head -n 1 | cut -d',' -f4 | tr -d '"' ) &&\
|
||||||
|
sed -i "s|rixpkgs.url = \"https://github.com/rstats-on-nix/nixpkgs/archive/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\.tar\.gz\";|rixpkgs.url = \"https://github.com/rstats-on-nix/nixpkgs/archive/$RVER.tar.gz\";|" flake.nix
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue