diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..f9631b6 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,39 @@ +FROM docker.io/ubuntu:jammy + +RUN DEBIAN_FRONTEND=noninteractive apt-get update --yes \ + && apt-get upgrade --yes \ + && apt-get install --yes --no-install-recommends \ + ca-certificates \ + curl \ + dialog \ + git \ + gnupg2 \ + init-system-helpers \ + less \ + locales \ + openssh-client \ + sudo \ + tzdata \ + unzip \ + xclip \ + zip \ + zsh \ + && yes | unminimize 2>&1 \ + && rm --recursive --force /var/lib/apt/lists/* \ + && locale-gen "en_US.UTF-8" \ + && dpkg-reconfigure locales + +ARG USERNAME=dev +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# Create a non-root user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --shell /usr/bin/zsh --uid $USER_UID --gid $USERNAME --create-home $USERNAME \ + # Add sudo support + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + +USER $USERNAME + +CMD [ "sleep", "infinity" ] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b332f39..db6e294 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,7 +3,10 @@ { "name": "Ubuntu", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/base:jammy" + "build": + { + "dockerfile": "Dockerfile" + } // Features to add to the dev container. More info: https://containers.dev/features. // "features": {}, diff --git a/external/vscode/settings.json b/external/vscode/settings.json index 3983d3d..90e7df7 100644 --- a/external/vscode/settings.json +++ b/external/vscode/settings.json @@ -2,9 +2,7 @@ "azureFunctions.showProjectWarning": false, "azureFunctions.showPythonVenvWarning": false, "cfnLint.validateUsingJsonSchema": true, - "dotfiles.installCommand": "install.sh --one-shot", "dotfiles.repository": "https://github.com/mtaron/dotfiles.git", - "dotfiles.targetPath": "~/dotfiles", "editor.bracketPairColorization.enabled": true, "editor.fontFamily": "'Monaspace Neon', monospace", "editor.fontLigatures": "'calt', 'liga', 'dlig', 'ss01', 'ss02', 'ss03', 'ss04', 'ss06', 'ss07'", diff --git a/home/.chezmoi.yaml.tmpl b/home/.chezmoi.yaml.tmpl index 9b3528d..b187303 100644 --- a/home/.chezmoi.yaml.tmpl +++ b/home/.chezmoi.yaml.tmpl @@ -1,34 +1,14 @@ -{{- /* environment/hardware tags */ -}} -{{- $devcontainer := false -}}{{/* devcontainer (codespaces, vscode) */}} -{{- $codespaces := false -}}{{/* github codespaces */}} -{{- $vscontainer := false -}}{{/* vs code remote containers */}} -{{- $isGnome := lookPath "gnome-shell" | not | not -}} +{{- $isGnome := lookPath "gnome-shell" | not | not -}} +{{- $isX := lookPath "xhost" | not | not -}} -{{- /* devcontainer detection */ -}} -{{- if (env "CODESPACES") -}} -{{- $codespaces = true -}} -{{- end -}} -{{- if (env "REMOTE_CONTAINERS_IPC") -}} -{{- $vscontainer = true -}} -{{- end -}} -{{- if or $codespaces $vscontainer -}} -{{- $devcontainer = true -}} -{{- end -}} - -{{- /* boolean feature tags */ -}} -{{- $headless := false -}}{{/* no graphical interface */}} - -{{- /* preset detection */ -}} -{{- if $devcontainer -}} -{{- $headless = true -}} -{{- end -}} +{{- $headless := true -}} -{{/* base configration */}} -{{- if and (not $headless) stdinIsATTY -}} +{{- if or $isGnome $isX -}} +{{- $headless = false -}} +{{- else if stdinIsATTY -}} {{- $headless = promptBoolOnce . "headless" "headless" false -}} {{- end -}} -{{- /* email configuration */ -}} {{- $email := default "michael@taron.dev" (env "GIT_AUTHOR_EMAIL") -}} {{- if stdinIsATTY -}} {{ $email = promptStringOnce . "user.email" "email" $email }} @@ -43,7 +23,3 @@ data: email: {{ $email | quote }} github: "mtaron" - devcontainer: - any: {{ $devcontainer }} - codespaces: {{ $codespaces }} - vscontainer: {{ $vscontainer }} diff --git a/home/.chezmoiscripts/linux/run_once_before_alacritty.tmpl b/home/.chezmoiscripts/linux/run_once_before_alacritty.tmpl index 6733f74..024dea0 100644 --- a/home/.chezmoiscripts/linux/run_once_before_alacritty.tmpl +++ b/home/.chezmoiscripts/linux/run_once_before_alacritty.tmpl @@ -2,7 +2,7 @@ #!/usr/bin/env sh # https://launchpad.net/~aslatter/+archive/ubuntu/ppa -sudo add-apt-repository --yes --ppa ppa:aslatter/ppa +sudo add-apt-repository --yes ppa:aslatter/ppa sudo apt-get update --yes sudo apt-get install --yes alacritty