# Add Sonatype Nexus Repository Integration Module ## Summary Implements a Coder module for Sonatype Nexus Repository Manager integration that automatically configures Maven, npm, PyPI, and Docker registries for development workspaces. ## Demo Video & Screenshots https://github.com/user-attachments/assets/2c51f229-d34d-483b-a0e9-f4e0d79332c2  ## Features - ✅ **Maven Support**: Automatic `settings.xml` configuration - ✅ **npm Support**: Automatic `.npmrc` configuration with scoped packages - ✅ **PyPI Support**: Automatic `pip.conf` configuration - ✅ **Docker Support**: Registry authentication setup - ✅ **Flexible Configuration**: Support for multiple repositories per package manager - ✅ **Secure Credentials**: API token and password support - ✅ **Username Options**: Configurable username field (username or email) ## Nexus Repository Manager Requirements ### Version Requirements **Yes, this module requires Nexus Repository Manager Pro version** for full functionality, though basic features work with the Community Edition (OSS). ### Supported Authentication Methods This module supports **4 authentication methods**: 1. **User Token Authentication** (Recommended - Pro only) - Enhanced security with two-part tokens - Ideal for CI/CD and automated environments - Requires `nx-usertoken-current` privilege 2. **API Token Authentication** (Pro only) - Single-use access tokens via REST API - Programmatic token generation and management 3. **Basic Authentication** (OSS & Pro) - Standard HTTP Basic Auth with username/password - Works with both OSS and Pro versions 4. **Base64 Encoded Credentials** (OSS & Pro) - Base64 encoded `username:password` format - Compatible with npm and other package managers ### Testing Instructions #### Prerequisites - Nexus Repository Manager instance (OSS or Pro) - Admin access to configure repositories - Test repositories for each package manager you want to test #### Setup Test Environment 1. **Create Test Repositories** in your Nexus instance: - Maven: `maven-public`, `maven-releases` - npm: `npm-public`, `@company:npm-private` - PyPI: `pypi-public`, `pypi-private` - Docker: `docker-public`, `docker-private` 2. **Configure Authentication**: - For Pro: Generate user tokens via UI (User menu → User Token) - For OSS: Use username/password or base64 encoded credentials - Set up appropriate permissions for test repositories 3. **Test the Module**: ```hcl module "nexus" { source = "registry.coder.com/mavrickrishi/nexus/coder" version = "1.0.0" agent_id = coder_agent.main.id nexus_url = "https://your-nexus-instance.com" nexus_password = var.nexus_api_token # or password package_managers = { maven = ["maven-public", "maven-releases"] npm = ["npm-public", "@company:npm-private"] pypi = ["pypi-public", "pypi-private"] docker = ["docker-public", "docker-private"] } } ``` 4. **Verify Configuration**: - Check generated config files in workspace - Test package installation from configured repositories - Verify authentication works for each package manager #### EC2 Deployment Testing Tested by deploying on EC2 instance with: - Ubuntu 22.04 LTS - Nexus Repository Manager Pro - All package managers (Maven, npm, PyPI, Docker) - Both token and basic authentication methods ## Usage Example ```hcl module "nexus" { source = "registry.coder.com/mavrickrishi/nexus/coder" version = "1.0.0" agent_id = coder_agent.main.id nexus_url = "https://nexus.company.com" nexus_password = var.nexus_api_token package_managers = { maven = ["maven-public", "maven-releases"] npm = ["npm-public", "@company:npm-private"] pypi = ["pypi-public", "pypi-private"] docker = ["docker-public", "docker-private"] } } ``` ## Testing - ✅ 11 comprehensive tests covering all functionality - ✅ Variable validation tests - ✅ Package manager configuration tests - ✅ Error handling tests - ✅ All tests passing - ✅ EC2 deployment tested ## Files Added - `registry/mavrickrishi/modules/nexus/main.tf` - Main module configuration - `registry/mavrickrishi/modules/nexus/README.md` - Complete documentation - `registry/mavrickrishi/modules/nexus/main.test.ts` - Test suite ## Checklist - [x] Module follows existing patterns and conventions - [x] Comprehensive test coverage (11 tests) - [x] Complete documentation with examples - [x] Input validation and error handling - [x] Secure credential handling - [x] All tests passing - [x] Demo video included - [x] Screenshots added - [x] Testing instructions provided - [x] Authentication methods documented - [x] EC2 deployment tested Closes #202 /claim #202 --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Atif Ali <me@matifali.dev> Co-authored-by: DevCats <christofer@coder.com> Co-authored-by: DevCats <chris@dualriver.com>
Coder Registry
Registry Site • Coder OSS • Coder Docs • Official Discord
Coder Registry is a community-driven platform for extending your Coder workspaces. Publish reusable Terraform as Coder Modules for users all over the world.
Note
The Coder Registry repo will be updated to support Coder Templates in the coming weeks. You can currently find all official templates in the official coder/coder repo, under the
examples/templatesdirectory.
Overview
Coder is built on HashiCorp's open-source Terraform language to provide developers an easy, declarative way to define the infrastructure for their remote development environments. Coder-flavored versions of Terraform allow you to mix in reusable Terraform snippets to add integrations with other popular development tools, such as JetBrains, Cursor, or Visual Studio Code.
Simply add the correct import snippet, along with any data dependencies, and your workspace can start using the new functionality immediately.
More information about Coder Modules can be found here, while more information about Coder Templates can be found here.
Getting started
The easiest way to discover new modules and templates is by visiting the official Coder Registry website. The website is a full mirror of the Coder Registry repo, and it is where .tar versions of the various resources can be downloaded from, for use within your Coder deployment.
Note that while Coder has a baseline set of requirements for allowing an external PR to be published, Coder cannot vouch for the validity or functionality of a resource until that resource has been flagged with the verified status. All modules under the Coder namespace are automatically verified.
Getting started with modules
To get started with a module, navigate to that module's page in either the registry site, or the main repo:
In both cases, the main README contains a Terraform snippet for integrating the module into your workspace. The snippet for Cursor looks like this:
module "cursor" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/cursor/coder"
version = "1.0.19"
agent_id = coder_agent.example.id
}
Simply include that snippet inside your Coder template, defining any data dependencies referenced, and the next time you create a new workspace, the functionality will be ready for you to use.
Contributing
We are always accepting new contributions. Please see our contributing guide for more information.
For Maintainers
Guidelines for maintainers reviewing PRs and managing releases. See the maintainer guide for more information.
