feat: add dotfiles module (#33)

Co-authored-by: Muhammad Atif Ali <atif@coder.com>
pull/46/head
Ben Potter 2 years ago committed by GitHub
parent 61ae309a1f
commit a05030c81f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

1
.gitignore vendored

@ -0,0 +1 @@
.terraform*

@ -0,0 +1,10 @@
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 185.69 237" enable-background="new 0 0 185.69 237" xml:space="preserve">
<g>
<path fill="#333333" d="M135.96,0h-1.06H16.93C7.58,0,0,7.58,0,16.93v203.14C0,229.42,7.58,237,16.93,237h151.83
c9.35,0,16.93-7.58,16.93-16.93V50.79v-1.06L135.96,0z"/>
<circle fill="#3FA9F5" cx="92.84" cy="118.5" r="25.39"/>
<line fill="#1A1A1A" x1="185.69" y1="50.79" x2="134.9" y2="0"/>
<path fill="#3FA9F5" d="M135.96,32.8c0,9.35,7.58,16.93,16.93,16.93h32.8L135.96,0V32.8z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 600 B

@ -0,0 +1,12 @@
---
display_name: Dotfiles
description: Allow developers to optionally bring their own dotfiles repository to customize their shell and IDE settings!
icon: ../.icons/dotfiles.svg
maintainer_github: coder
verified: true
tags: [helper]
---
# Dotfiles
Allow developers to optionally bring their own [dotfiles repository](https://dotfiles.github.io)! Under the hood, this module uses the [coder dotfiles](https://coder.com/docs/v2/latest/dotfiles) command.

@ -0,0 +1,37 @@
terraform {
required_version = ">= 1.0"
required_providers {
coder = {
source = "coder/coder"
version = ">= 0.12"
}
}
}
variable "agent_id" {
type = string
description = "The ID of a Coder agent."
}
data "coder_parameter" "dotfiles_uri" {
type = "string"
display_name = "Dotfiles URL (optional)"
default = ""
description = "Enter a URL for a [dotfiles repository](https://dotfiles.github.io) to personalize your workspace"
mutable = true
icon = "https://raw.githubusercontent.com/jglovier/dotfiles-logo/main/dotfiles-logo-icon.svg"
}
resource "coder_script" "personalize" {
agent_id = var.agent_id
script = <<-EOT
DOTFILES_URI="${data.coder_parameter.dotfiles_uri.value}"
if [ -n "$${DOTFILES_URI// }" ]; then
coder dotfiles "$DOTFILES_URI" -y 2>&1 | tee -a ~/.dotfiles.log
fi
EOT
display_name = "Dotfiles"
icon = "https://raw.githubusercontent.com/jglovier/dotfiles-logo/main/dotfiles-logo-icon.svg"
run_on_start = true
}
Loading…
Cancel
Save