-
Notifications
You must be signed in to change notification settings - Fork 0
Add devbox support #67
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
base: master
Are you sure you want to change the base?
Changes from all commits
f2074e9
fc08d0a
68d7401
6b7091f
aa72677
245440b
3fb0223
04d1bf6
fc46f3d
bde9301
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,17 @@ | ||
| # nick4eva's dotfiles | ||
|
|
||
| Inspired by <https://github.com/georgijd/dotfiles> | ||
|
|
||
| [](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`. |
| 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": {}, | ||
| } |
| 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 |
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script downloads and executes a remote script via 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script downloads and executes a remote script via 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script downloads and executes a remote script via 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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., 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" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error handling in the 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 "$@" | ||
| 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" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sourcing a script using an absolute path constructed with Recommended Solution: |
||
|
|
||
| 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" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Recommended Solution: |
||
| ;; | ||
| esac | ||
| } | ||
|
|
||
| main "$@" | ||
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script downloads and executes a remote script directly using 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 "$@" | ||
There was a problem hiding this comment.
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
curlandbash -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.