Skip to content
Draft
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
18 changes: 13 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,49 @@ on:

jobs:
actionlint:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false

- name: Run ActionLint
uses: reviewdog/action-actionlint@v1
shellcheck:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false

- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
ignore_paths: ./zsh/zshrc ./zsh/p10k.zsh
ignore_paths: ./zsh/zshrc
env:
SHELLCHECK_OPTS: -e SC1071 -e SC1091
markdownlint:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false

- name: Run MarkdownLint
uses: reviewdog/action-markdownlint@v0
with:
reporter: github-pr-review

hadolint:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false

- name: Run Hadolint
uses: reviewdog/action-hadolint@v1
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ jobs:
strategy:
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false

- name: Test
run: make test
Expand Down
27 changes: 19 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
include test.mk

.DEFAULT_GOAL := all
.PHONY: git
.PHONY: git zsh

all: system git asdf terminal devops neovim ## Install and configure everything (default)
all: system nix zsh devbox terminal #devops neovim ## Install and configure everything (default)
help: ## Display help
@grep -hE '^[a-zA-Z_0-9%-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

Expand All @@ -16,14 +16,23 @@ system-configure: ## Create directories, install fonts, etc.
git: ## Configure git
@./scripts/git.sh configure

terminal: zsh ohmyzsh bat-configure lsd fzf delta-configure ripgrep shellcheck lazygit win32yank navi ## Setup the terminal
terminal: ohmyzsh git starship-configure bat-configure delta-configure direnv-configure #lsd fzf ripgrep shellcheck lazygit win32yank navi ## Setup the terminal
nix: ## Nix install
@./scripts/nix.sh install
devbox: devbox-install devbox-configure ## Install and configure devbox
devbox-install: ## Devbox install
@./scripts/devbox.sh install
devbox-configure: ## Devbox configure
@./scripts/devbox.sh configure
zsh: ## Configure zsh
@./scripts/zsh.sh configure
ohmyzsh: ohmyzsh-install ohmyzsh-configure ## Install and configure Oh My Zsh
ohmyzsh-install: ## Install Oh My Zsh
@./scripts/ohmyzsh.sh install
ohmyzsh-configure: ## Configure Oh My Zsh
@./scripts/ohmyzsh.sh configure
starship-configure: ## Configure starship
@./scripts/starship.sh configure
bat-configure: ## Configure bat
@./scripts/bat.sh configure
lsd: ## Install lsd
Expand All @@ -32,6 +41,8 @@ fzf: ## Install FZF
@./scripts/fzf.sh install
delta-configure: ## Configure delta
@./scripts/delta.sh configure
direnv-configure: ## Configure direnv
@./scripts/direnv.sh configure
ripgrep: ## Install ripgrep
@./scripts/ripgrep.sh install
shellcheck: ## Install shellcheck
Expand Down Expand Up @@ -67,8 +78,8 @@ neovim-install: ## Install neovim
# neovim-configure: ## Configure neovim
# @./scripts/neovim.sh configure

asdf: asdf-install asdf-configure ## Install and configure asdf
asdf-install:
@./scripts/asdf.sh install
asdf-configure:
@./scripts/asdf.sh configure
# asdf: asdf-install asdf-configure ## Install and configure asdf
# asdf-install:
# @./scripts/asdf.sh install
# asdf-configure:
# @./scripts/asdf.sh configure
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# nick4eva's dotfiles

Inspired by <https://github.com/georgijd/dotfiles>

[![Build Status](https://github.com/nick4eva/dotfiles/actions/workflows/test.yml/badge.svg)](https://github.com/nick4eva/dotfiles/actions/workflows/test.yml)

Inspired by <https://github.com/georgijd/dotfiles>.

## How to install

> If you have no `make` installed you should install it first.

```bash
git clone https://github.com/nick4eva/dotfiles.git ~/dotfiles
cd ~/dotfiles
make
```

> For more information run `make help`
> For more information run `make help`.
4 changes: 2 additions & 2 deletions delta/gitconfig-delta → delta/gitconfig-delta.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
prompt = false
[rerere]
enabled = 1
[credential]
helper = "!f() { /home/test/.vscode-server/bin/3b889b090b5ad5793f524b5d1d39fda662b96a2a/node /tmp/vscode-remote-containers-285323e1229e86d5f4e0810389874cf9b3b1786d.js $*; }; f"
# [credential]
# helper = "!f() { /home/test/.vscode-server/bin/3b889b090b5ad5793f524b5d1d39fda662b96a2a/node /tmp/vscode-remote-containers-285323e1229e86d5f4e0810389874cf9b3b1786d.js $*; }; f"
112 changes: 112 additions & 0 deletions devbox/devbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.11.1/.schema/devbox.schema.json",
"packages": [
"git@latest",
"htop@latest",
"gh@latest",
"fzf@latest",
"ripgrep@latest",
"jq@latest",
"yq@latest",
"neovim@latest",
"btop@latest",
"cheat@latest",
"tree-sitter@latest",
"eza@latest",
"bat@latest",
"atuin@latest",
"zoxide@latest",
"direnv@latest",
"starship@latest",
"k9s@latest",
"popeye@latest",
"python@3.10.13",
"python310Packages.pip@latest",
"ansible-lint@6.21.1",
"nodejs@20",
"snyk@latest",
"codespell@2.2.6",
"markdownlint-cli2@latest",
"k3s@latest",
"k3d@latest",
"gotemplate@latest",
"entr@latest",
"watchexec@latest",
"pluto@latest",
"pre-commit@latest",
"vale@latest",
"act@latest",
"delta@latest",
"tflint@latest",
"glow@latest",
"stylua@latest",
"lazygit@latest",
"lazydocker@latest",
"du-dust@latest",
"kubectl@1.25",
"krew@latest",
"terragrunt@latest",
"istioctl@1.20",
"sops@latest",
"glab@latest",
"hclfmt@latest",
"odo@latest",
"skaffold@latest",
"podman@latest",
"kubectx@latest",
"helmfile@latest",
"kubernetes-helm@latest",
"jira-cli-go@latest",
"libsecret@latest",
"podman-tui@latest",
"dive@latest",
"wtf@latest",
"helm-docs@latest",
"faq@latest",
"just@latest",
"tig@latest",
"gitui@latest",
"actionlint@latest",
"vals@latest",
"tmux@latest",
"lnav@latest",
"navi@latest",
],
"env": {
"DEVBOX_GLOBAL_PREFIX": "$HOME/.local/share/devbox/global/default/.devbox/nix/profile/default",
"DEVBOX_GLOBAL_ROOT": "$HOME/.local/share/devbox/global/current",
},
"shell": {
// "init_hook": [". ${DEVBOX_GLOBAL_ROOT}/init.sh"],
"scripts": {
"install-astro": [
"echo cloning astronvim repo to ~/.config/nvim",
"git clone --depth 1 https://github.com/AstroNvim/AstroNvim ~/.config/nvim",
],
"install-hook-bash": [
"echo adding 'devbox global shellenv' to ~/.bashrc",
"grep -qF 'devbox global shellenv' ~/.bashrc || echo 'eval \"$(devbox global shellenv --init-hook)\"' >> ~/.bashrc",
"tail -n 1 ~/.bashrc",
],
"install-hook-zsh": [
"echo adding 'devbox global shellenv' to ~/.zshrc",
"grep -qF 'devbox global shellenv' ~/.zshrc || echo 'eval \"$(devbox global shellenv --init-hook)\"' >> ~/.zshrc",
"tail -n 1 ~/.zshrc",
],
"install-starship-prompt": [
"if [ ! -f $HOME/.config/starship.toml ]",
"then",
"curl -fsSL https://devbox.getfleek.dev/config/starship/starship.toml > $HOME/.config/starship.toml",
"fi",
],
"latest-hash": ["curl -fsSL https://nixos.org/channels/nixos-unstable/git-revision"],
"npm-global": [
"grep -qF '.npm-packages' ~/.npmrc || echo 'prefix=~/.npm-packages' >> ~/.npmrc",
"grep -qF '.npm-packages' ~/.zshrc || echo 'export PATH=$PATH:~/.npm-packages/bin' >> ~/.zshrc",
"grep -qF '.npm-packages' ~/.bashrc || echo 'export PATH=$PATH:~/.npm-packages/bin' >> ~/.bashrc",
"mkdir -p ~/.npm-packages",
],
},
},
"nixpkgs": {},
}
5 changes: 5 additions & 0 deletions direnv/direnv.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://direnv.net/man/direnv.toml.1.html

[global]
warn_timeout = "10s"
hide_env_diff = true
50 changes: 50 additions & 0 deletions scripts/devbox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash

set -e

# shellcheck source=../scripts/util.sh
source "$(pwd)/scripts/util.sh"

do_install() {
if is_installed devbox; then
info "[devbox] Already installed. To update use: devbox version update"
return
fi

info "[devbox] Install"
bash -c "$(curl -fsSL https://get.jetify.com/devbox)" "" --force

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script downloads and executes a remote script via curl and bash -c. This can be a significant security risk as it allows for the execution of potentially malicious code if the remote source is compromised.

Recommendation: Verify the integrity of the downloaded script before executing it. This can be done by checking the script's checksum or using a more secure method to install the software.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script downloads and executes a remote script via curl and bash -c. This can be a significant security risk as it allows for the execution of potentially malicious code if the remote source is compromised.

Recommendation: Verify the integrity of the downloaded script before executing it. This can be done by checking the script's checksum or using a more secure method to install the software.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script downloads and executes a remote script via curl and bash -c. This can be a significant security risk as it allows for the execution of potentially malicious code if the remote source is compromised.

Recommendation: Verify the integrity of the downloaded script before executing it. This can be done by checking the script's checksum or using a more secure method to install the software.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script downloads and executes a remote script via curl and bash -c. This can be a significant security risk as it allows for the execution of potentially malicious code if the remote source is compromised.

Recommendation: Verify the integrity of the downloaded script before executing it. This can be done by checking the script's checksum or using a more secure method to install the software.

}

do_configure() {
info "[devbox] Configure"
info "[devbox][configure] Create dir"
DEVBOX_GLOBAL_DIR="$HOME/.local/share/devbox/global/default"
mkdir -p "$DEVBOX_GLOBAL_DIR"
info "[devbox][configure] Create symlinks"
ln -fs "$(pwd)/devbox/devbox.json" "$DEVBOX_GLOBAL_DIR/devbox.json"
# echo "eval '$(devbox global shellenv)'" >> ~/.zshrc
# source ~/.zshrc
# temporarily add the global packages to the current shell (this is already configured in oh-my-zsh)
source <(devbox global shellenv --init-hook)
Comment on lines +24 to +28

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script assumes the existence and correct setup of certain files and directories (e.g., devbox.json and ~/.zshrc). This can lead to failures in environments where these are not present or have restricted permissions.

Recommendation: Add checks to ensure that necessary files and directories exist before attempting to use them. Provide clear error messages if the expected conditions are not met. This will enhance the robustness and user-friendliness of the script.

devbox global install
refresh-global
}

main() {
command=$1
case $command in
"install")
shift
do_install "$@"
;;
"configure")
shift
do_configure "$@"
;;
*)
error "$(basename "$0"): '$command' is not a valid command"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error handling in the main function does not provide guidance on valid commands if an invalid command is entered. This could lead to user confusion.

Recommendation: Enhance the error message in line 45 to include a list of valid commands. This will improve the user experience by providing immediate guidance on how to correct the input.

;;
esac
}

main "$@"
28 changes: 28 additions & 0 deletions scripts/direnv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

set -e

# shellcheck source=../scripts/util.sh
source "$(pwd)/scripts/util.sh"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcing a script using an absolute path constructed with pwd can lead to issues if the script is run from a different directory. This can make the script less portable and harder to use in different environments.

Recommended Solution:
Use a relative path or determine the script's directory dynamically using ${BASH_SOURCE[0]} to make the script more robust and portable.


do_configure() {
info "[direnv] Configure"
info "[direnv][configure] Create config file symlink"
mkdir -p "${XDG_CONFIG_HOME}/direnv"
ln -fs "$(pwd)/direnv/direnv.toml" "${XDG_CONFIG_HOME}/direnv/direnv.toml"
}

main() {
command=$1
case $command in
"configure")
shift
do_configure "$@"
;;
*)
error "$(basename "$0"): '$command' is not a valid command"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error function is used to handle invalid commands, but it is not defined within this script. This will lead to a runtime error if an invalid command is passed.

Recommended Solution:
Ensure that the error function is defined in the sourced util.sh script or define it within this script to handle errors gracefully.

;;
esac
}

main "$@"
35 changes: 35 additions & 0 deletions scripts/nix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

set -e

# shellcheck source=../scripts/util.sh
source "$(pwd)/scripts/util.sh"

do_install() {
if is_installed nix; then
info "[nix] Already installed"
return
fi

info "[nix] Install"
sh <(curl -L https://nixos.org/nix/install) --daemon --yes

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script downloads and executes a remote script directly using curl and sh. This is a significant security risk as the remote script could be modified by a malicious actor, leading to potential system compromise.

Recommendation: Download the script first, verify its integrity (e.g., using a checksum), and then execute it. This reduces the risk of executing malicious code.

}

main() {
command=$1
case $command in
"install")
shift
do_install "$@"
;;
"configure")
shift
do_configure "$@"
;;
*)
error "$(basename "$0"): '$command' is not a valid command"
;;
esac
}

main "$@"
Loading