From 0e775e825927c3298fe76d549628bade1ed57905 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 20:28:31 +0000 Subject: [PATCH 1/9] Initial plan From 849225e22e6001b689b450d098aa1f14d306abdb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 20:32:03 +0000 Subject: [PATCH 2/9] Add comprehensive functionality tests to CI workflow Co-authored-by: dwinkler1 <22460147+dwinkler1@users.noreply.github.com> --- .github/workflows/check.yml | 164 +++++++++++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index afd4c48..814babd 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -4,6 +4,8 @@ on: push: paths: - 'templates/rde/flake.lock' + - 'templates/rde/**/*.nix' + - '.github/workflows/check.yml' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -27,5 +29,163 @@ jobs: authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' extraPullNames: rstats-on-nix, nix-community # - uses: DeterminateSystems/magic-nix-cache-action@main - - run: nix build ./templates/rde - - run: nix flake check ./templates/rde + + # 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)'" + + # 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: | + cd templates/rde + mkdir -p /tmp/test-project + cd /tmp/test-project + nix develop /home/runner/work/np/np/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" + + - 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@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@v16 + 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: | + mkdir -p /tmp/test-python + cp -r templates/rde/* /tmp/test-python/ + cd /tmp/test-python + # Enable Python in the config + sed -i 's/python = false;/python = true;/' flake.nix + + - name: Build with Python enabled + run: | + cd /tmp/test-python + nix build + + - name: Test Python commands are available + run: | + cd /tmp/test-python + nix develop --command bash -c "which p-py && which p-ipy && which p-initPython" + + - name: Test Python launches + run: | + cd /tmp/test-python + nix develop --command bash -c "p-py --version" + + - name: Test Python can execute code + run: | + cd /tmp/test-python + nix develop --command bash -c "p-py -c 'print(1+1)'" + + test-with-julia: + runs-on: ubuntu-latest + steps: + - 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@v16 + 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: | + mkdir -p /tmp/test-julia + cp -r templates/rde/* /tmp/test-julia/ + cd /tmp/test-julia + # Enable Julia in the config + sed -i 's/julia = false;/julia = true;/' flake.nix + + - name: Build with Julia enabled + run: | + cd /tmp/test-julia + nix build + + - name: Test Julia commands are available + run: | + cd /tmp/test-julia + nix develop --command bash -c "which p-jl && which p-initJl" + + - name: Test Julia launches + run: | + cd /tmp/test-julia + nix develop --command bash -c "p-jl --version" + + - name: Test Julia can execute code + run: | + cd /tmp/test-julia + nix develop --command bash -c "p-jl -e 'println(1+1)'" From cfccd9a010c312faa158b221af0981d0b36e0aba Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 20:33:25 +0000 Subject: [PATCH 3/9] Fix workflow to include all files and add PR triggers Co-authored-by: dwinkler1 <22460147+dwinkler1@users.noreply.github.com> --- .github/workflows/check.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 814babd..e488ad7 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -5,6 +5,15 @@ on: 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 }} @@ -120,7 +129,7 @@ jobs: - name: Setup test directory with Python enabled run: | mkdir -p /tmp/test-python - cp -r templates/rde/* /tmp/test-python/ + cp -r templates/rde/. /tmp/test-python/ cd /tmp/test-python # Enable Python in the config sed -i 's/python = false;/python = true;/' flake.nix @@ -165,7 +174,7 @@ jobs: - name: Setup test directory with Julia enabled run: | mkdir -p /tmp/test-julia - cp -r templates/rde/* /tmp/test-julia/ + cp -r templates/rde/. /tmp/test-julia/ cd /tmp/test-julia # Enable Julia in the config sed -i 's/julia = false;/julia = true;/' flake.nix From 0514ba128337eff62df9d8af8f9f9c1dadf54a92 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 20:34:23 +0000 Subject: [PATCH 4/9] Add comprehensive CI documentation to README files Co-authored-by: dwinkler1 <22460147+dwinkler1@users.noreply.github.com> --- README.md | 70 +++++++++++++++++++++++++++++++++++++++++ templates/rde/README.md | 30 ++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..bfa3c32 --- /dev/null +++ b/README.md @@ -0,0 +1,70 @@ +# 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. diff --git a/templates/rde/README.md b/templates/rde/README.md index 5b048ff..c28ac3c 100644 --- a/templates/rde/README.md +++ b/templates/rde/README.md @@ -337,6 +337,36 @@ p-updateDeps # Or check overlays/r.nix for package name ``` +## CI and Testing + +This template is automatically tested on every change to ensure all functionality works correctly. The CI workflow (`.github/workflows/check.yml`) runs comprehensive tests including: + +### Default Configuration Tests (R enabled) +- ✅ Template builds successfully +- ✅ Flake check passes +- ✅ Development shell enters without errors +- ✅ Neovim launches in headless mode +- ✅ R console is available and runs code +- ✅ Utility commands (initProject, updateDeps) are available +- ✅ Project structure creation works correctly + +### Python Configuration Tests +- ✅ Template builds with Python enabled +- ✅ Python commands (p-py, p-ipy, p-initPython) are available +- ✅ Python interpreter launches and executes code + +### Julia Configuration Tests +- ✅ Template builds with Julia enabled +- ✅ Julia commands (p-jl, p-initJl) are available +- ✅ Julia REPL launches and executes code + +The CI runs on: +- Every push to template files (`.nix`, `.sh`, `.lua`, `flake.lock`) +- Every pull request affecting the template +- Manual dispatch for testing + +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 From 4cd5a343e68c854777a815e4246993c6caa5cb67 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 20:35:30 +0000 Subject: [PATCH 5/9] Add additional checks for Quarto, UV, and basedpyright; fix path handling Co-authored-by: dwinkler1 <22460147+dwinkler1@users.noreply.github.com> --- .github/workflows/check.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e488ad7..84d00a1 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -67,6 +67,11 @@ jobs: 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: | @@ -86,10 +91,9 @@ jobs: - name: Test p-initProject creates project structure run: | - cd templates/rde mkdir -p /tmp/test-project cd /tmp/test-project - nix develop /home/runner/work/np/np/templates/rde --command bash -c "p-initProject" + 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 @@ -153,6 +157,16 @@ jobs: run: | cd /tmp/test-python nix develop --command bash -c "p-py -c 'print(1+1)'" + + - name: Test UV package manager is available + run: | + cd /tmp/test-python + nix develop --command bash -c "uv --version" + + - name: Test basedpyright LSP is available + run: | + cd /tmp/test-python + nix develop --command bash -c "basedpyright --version" test-with-julia: runs-on: ubuntu-latest From ca5642d51fc4ee1580b0215344e65410b5a99bd0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 20:38:07 +0000 Subject: [PATCH 6/9] Improve CI robustness: use mktemp for directories and handle whitespace in sed Co-authored-by: dwinkler1 <22460147+dwinkler1@users.noreply.github.com> --- .github/workflows/check.yml | 48 ++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 84d00a1..a229a06 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -91,8 +91,8 @@ jobs: - name: Test p-initProject creates project structure run: | - mkdir -p /tmp/test-project - cd /tmp/test-project + 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 @@ -101,6 +101,8 @@ jobs: 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: | @@ -132,40 +134,41 @@ jobs: # Create a temporary directory with Python enabled - name: Setup test directory with Python enabled run: | - mkdir -p /tmp/test-python - cp -r templates/rde/. /tmp/test-python/ - cd /tmp/test-python - # Enable Python in the config - sed -i 's/python = false;/python = true;/' flake.nix + 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 + echo "TEST_PYTHON_DIR=$TEST_DIR" >> $GITHUB_ENV - name: Build with Python enabled run: | - cd /tmp/test-python + cd "$TEST_PYTHON_DIR" nix build - name: Test Python commands are available run: | - cd /tmp/test-python + cd "$TEST_PYTHON_DIR" nix develop --command bash -c "which p-py && which p-ipy && which p-initPython" - name: Test Python launches run: | - cd /tmp/test-python + cd "$TEST_PYTHON_DIR" nix develop --command bash -c "p-py --version" - name: Test Python can execute code run: | - cd /tmp/test-python + cd "$TEST_PYTHON_DIR" nix develop --command bash -c "p-py -c 'print(1+1)'" - name: Test UV package manager is available run: | - cd /tmp/test-python + cd "$TEST_PYTHON_DIR" nix develop --command bash -c "uv --version" - name: Test basedpyright LSP is available run: | - cd /tmp/test-python + cd "$TEST_PYTHON_DIR" nix develop --command bash -c "basedpyright --version" test-with-julia: @@ -187,28 +190,29 @@ jobs: # Create a temporary directory with Julia enabled - name: Setup test directory with Julia enabled run: | - mkdir -p /tmp/test-julia - cp -r templates/rde/. /tmp/test-julia/ - cd /tmp/test-julia - # Enable Julia in the config - sed -i 's/julia = false;/julia = true;/' flake.nix + 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 + echo "TEST_JULIA_DIR=$TEST_DIR" >> $GITHUB_ENV - name: Build with Julia enabled run: | - cd /tmp/test-julia + cd "$TEST_JULIA_DIR" nix build - name: Test Julia commands are available run: | - cd /tmp/test-julia + cd "$TEST_JULIA_DIR" nix develop --command bash -c "which p-jl && which p-initJl" - name: Test Julia launches run: | - cd /tmp/test-julia + cd "$TEST_JULIA_DIR" nix develop --command bash -c "p-jl --version" - name: Test Julia can execute code run: | - cd /tmp/test-julia + cd "$TEST_JULIA_DIR" nix develop --command bash -c "p-jl -e 'println(1+1)'" From 3777ab0c91e49ca495c3be681fbb4b299b1e3478 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 20:39:18 +0000 Subject: [PATCH 7/9] Add validation to ensure sed commands succeed in enabling languages Co-authored-by: dwinkler1 <22460147+dwinkler1@users.noreply.github.com> --- .github/workflows/check.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index a229a06..b9cdc51 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -139,6 +139,11 @@ jobs: 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 @@ -195,6 +200,11 @@ jobs: 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 From 8efae381e9cd2e90604baf7754226468f0315482 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 10:14:44 +0000 Subject: [PATCH 8/9] Make quarto and uv available directly in dev shell Co-authored-by: dwinkler1 <22460147+dwinkler1@users.noreply.github.com> --- templates/rde/flake.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/rde/flake.nix b/templates/rde/flake.nix index 2fc5749..f83ec3f 100644 --- a/templates/rde/flake.nix +++ b/templates/rde/flake.nix @@ -202,10 +202,16 @@ # Development shell configuration devShells = forSystems (system: let pkgs = import nixpkgs {inherit system;}; + # Language-specific packages that should be available in shell + languagePackages = with pkgs; + [] + ++ (if config.enabledLanguages.r then [quarto] else []) + ++ (if config.enabledLanguages.python then [uv] else []) + ++ (if config.enabledLanguages.julia then [] else []); in { default = pkgs.mkShell { name = config.defaultPackageName; - packages = [projectConfig.${system}.default]; + packages = [projectConfig.${system}.default] ++ languagePackages; inputsFrom = []; # Welcome message when entering the shell shellHook = import ./lib/shell-hook.nix config pkgs; From 3787de151cfb23c98c1ebd5f821798bc8522735c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 10:26:07 +0000 Subject: [PATCH 9/9] Remove basedpyright shell command test (LSP only available in Neovim) Co-authored-by: dwinkler1 <22460147+dwinkler1@users.noreply.github.com> --- .github/workflows/check.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b9cdc51..cd6b54e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -170,11 +170,6 @@ jobs: run: | cd "$TEST_PYTHON_DIR" nix develop --command bash -c "uv --version" - - - name: Test basedpyright LSP is available - run: | - cd "$TEST_PYTHON_DIR" - nix develop --command bash -c "basedpyright --version" test-with-julia: runs-on: ubuntu-latest