Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from a single install to a multi OS config #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Use the official image as a parent image
FROM ubuntu:24.04

# Install dependencies
RUN apt-get update && \
apt-get install -y \
git \
curl \
python3 \
python3-pip \
neovim \
nodejs \
npm \
lua5.4 \
golang \
docker.io \
kubectl \
k9s \
tmux \
gnupg \
openjdk-17-jdk \
fzf \
bat \
ripgrep \
&& apt-get clean

# Install 1Password CLI
RUN curl -sS https://downloads.1password.com/linux/debian/amd64/stable/1password-latest.deb -o 1password-latest.deb && \
apt install ./1password-latest.deb && \
rm 1password-latest.deb

# Install pip packages
RUN pip3 install virtualenvwrapper

# Create a non-root user and switch to it
RUN useradd -ms /bin/bash devuser
USER devuser
WORKDIR /home/devuser

# Clone the dotfiles repository
RUN git clone https://github.com/dolfolife/dotfiles.git

# Run the installation script
RUN cd dotfiles && make install

# Set the shell to zsh
CMD ["/bin/bash"]

23 changes: 23 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Dolfo's DevContainer",
"dockerFile": "Dockerfile",
"context": "..",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"ms-python.python",
"ms-vscode.cpptools",
"ms-azuretools.vscode-docker",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"shardulm94.trailing-spaces"
],
"postCreateCommand": "cd ~/dotfiles && ./install.sh",
"remoteUser": "dolfo",
"mounts": [
"source=${localEnv:HOME}/.ssh,target=/home/devuser/.ssh,type=bind,consistency=cached",
"source=${localEnv:HOME}/.gitconfig,target=/home/devuser/.gitconfig,type=bind,consistency=cached"
]
}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
nvim/plugin/packer_compiled.lua
nvim/pack
common/nvim/plugin/packer_compiled.lua
common/nvim/pack
*.tar.gz
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

# Install Dependencies
.PHONY: install
install: install.sh
./install.sh

.PHONY: install-personal
install-personal: install.sh
./install.sh --full

# Help target
.PHONY: help
help:
@echo "Available targets:"
@echo " make - Run the default install target"
@echo " make install - Install dependencies"
@echo " make install-personal - Install dependencies for personal projects"
@echo " make help - Display this help message"
@echo " make devcontainer - Build and run the dev container"

# Target for running in a dev container
.PHONY: devcontainer
devcontainer: .devcontainer/Dockerfile .devcontainer/devcontainer.json
@echo "Building and running the dev container..."
docker build -t devcontainer -f .devcontainer/Dockerfile .
docker run -it --rm --name devcontainer \
-v ${HOME}/.ssh:/home/devuser/.ssh \
-v ${HOME}/.gitconfig:/home/devuser/.gitconfig \
devcontainer
44 changes: 23 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
# workspace Configuration
Simple zsh scripts for my terminal
# Dotfiles

# Install
This is a group of scripts I use to maintain order and consistency across the environments I use code.

## Usage

```bash
git clone https://github.com/dolfolife/dotfiles.git ~/dotfiles
cd ~/dotfiles
make help
```
Warning: If you want to give these scripts a try, you should first fork this
repository, review the code, and remove things you don’t want or need. Don’t
blindly use my settings unless you know what that entails. Use at your own
risk!
```

- open **Terminal**, load your SSH key and run
```
sudo xcodebuild -license # follow the interactive prompts
git clone -–depth 1 https://github.com/dolfolife/dotfiles
cd dotfiles
<Change Github config>
./install.sh
```

## patterns and assumptions
- Keep it simple
- Declarative and idempotent
- Install as much as possible via brew
## Architecture

There are options for MacOS, Ubuntu (WSL), Windows Powershell, and Cygwin.
The install scripts should run the right set of scripts based on the `$OSTYPE` environment variable.


## Modes
There are a set of extra information depending on the workstation I use.
For example, I add 1password and the personal GPG key in personal computers.
For this, I separated the levels of install you can work and add your own wrapper.

```bash
make install DOMAIN=<company.domain>
```
> Note: make sure `company.domain` folder is at the root of your dotfiles

2 changes: 1 addition & 1 deletion gitconfig → common/.gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
[status]
submoduleSummary = true
[user]
email = [email protected]
email = [email protected]
name = Rodolfo Sanchez
7 changes: 7 additions & 0 deletions common/common-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Set the gitconfig
cp ~/dotfiles/common/.gitconfig ~/.gitconfig

echo $VAULT
echo $INCLUDE_GPG
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ lsp.ensure_installed({
'kotlin_language_server',
'lua_ls',
'gradle_ls',
'hls',
'jsonls',
'eslint',
'pyright',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions common/nvim/init.vim
File renamed without changes.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ return require('packer').startup(function(use)
as = 'catppuccin',
config = function()
require("catppuccin").setup()
vim.cmd('colorscheme catppuccin')
vim.cmd.colorscheme "catppuccin"
end,
})
use({
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions common/nvim/pack/github/start/copilot.vim
Submodule copilot.vim added at 066830
30 changes: 30 additions & 0 deletions common/utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set +eu

confirm() {
if [[ -n "${skip}" ]] && [[ "${skip}" == "-f" ]]; then
return
fi

read -r -p "Are you sure? [y/N] " response
case $response in
[yY][eE][sS]|[yY])
return
;;

*)
echo "Bailing out, you said no"
exit 187
;;
esac
}

clone_if_not_exist() {
local remote=$1
local dst_dir="$2"
echo "Cloning $remote into $dst_dir"
if [[ ! -d $dst_dir ]]; then
git clone "$remote" "$dst_dir"
fi
}
Loading