Matt Wise 7f51b2ffdd
feat(dotfiles): add custom variable for the dotfiles parameter description (#151)
## Description

When passing in custom dotfiles URIs, the format for those (`git@...` vs
`https://...`) are going to be different for different environments, and
admins are going to want to give their developers particular
instructions. This PR makes the parameter `description` customizable so
that we can change the default description a developer sees.

---

## Type of Change

- [ ] New module
- [ ] Bug fix
- [x] Feature/enhancement
- [ ] Documentation
- [ ] Other

---

## Module Information

<!-- Delete this section if not applicable -->

**Path:** `registry/coder/modules/dotfiles`  
**New version:** `v1.2.0`  
**Breaking change:** [ ] Yes [X] No

---

## Testing & Validation

- [X] Tests pass (`bun test`)
- [X] Code formatted (`bun run fmt`)
- [x] Changes tested locally

---------

Co-authored-by: DevCats <christofer@coder.com>
2025-07-09 09:56:08 -05:00

2.3 KiB

display_name description icon maintainer_github verified tags
Dotfiles Allow developers to optionally bring their own dotfiles repository to customize their shell and IDE settings! ../../../../.icons/dotfiles.svg coder true
helper
dotfiles

Dotfiles

Allow developers to optionally bring their own dotfiles repository.

This will prompt the user for their dotfiles repository URL on template creation using a coder_parameter.

Under the hood, this module uses the coder dotfiles command.

module "dotfiles" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/dotfiles/coder"
  version  = "1.2.0"
  agent_id = coder_agent.example.id
}

Examples

Apply dotfiles as the current user

module "dotfiles" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/dotfiles/coder"
  version  = "1.2.0"
  agent_id = coder_agent.example.id
}

Apply dotfiles as another user (only works if sudo is passwordless)

module "dotfiles" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/dotfiles/coder"
  version  = "1.2.0"
  agent_id = coder_agent.example.id
  user     = "root"
}

Apply the same dotfiles as the current user and root (the root dotfiles can only be applied if sudo is passwordless)

module "dotfiles" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/dotfiles/coder"
  version  = "1.2.0"
  agent_id = coder_agent.example.id
}

module "dotfiles-root" {
  count        = data.coder_workspace.me.start_count
  source       = "registry.coder.com/coder/dotfiles/coder"
  version      = "1.2.0"
  agent_id     = coder_agent.example.id
  user         = "root"
  dotfiles_uri = module.dotfiles.dotfiles_uri
}

Setting a default dotfiles repository

You can set a default dotfiles repository for all users by setting the default_dotfiles_uri variable:

module "dotfiles" {
  count                = data.coder_workspace.me.start_count
  source               = "registry.coder.com/coder/dotfiles/coder"
  version              = "1.2.0"
  agent_id             = coder_agent.example.id
  default_dotfiles_uri = "https://github.com/coder/dotfiles"
}