Skip to content

Commit

Permalink
More refactoring from installs.fish to myinstall
Browse files Browse the repository at this point in the history
  • Loading branch information
JafarAbdi committed Oct 7, 2024
1 parent d48057b commit 9d2e071
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 67 deletions.
61 changes: 1 addition & 60 deletions fish/conf.d/installs.fish
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ function install-bloaty
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../install .. && make install -j(nproc)
end
function install-ccache
sudo apt install -y ccache
end
function setup-cpp-screatches
mkdir -p $WORKSPACE_DIR/cpp
cd $CPP_SCREATCHES_DIR/..
Expand All @@ -48,14 +44,6 @@ function setup-cpp-screatches
sed -i 's/ /\n/g' compile_flags.txt
end
function install-clang-build-analyzer
cd ~/.local/bin
install-from-github aras-p/ClangBuildAnalyzer ClangBuildAnalyzer-linux
mv ClangBuildAnalyzer-linux ClangBuildAnalyzer
chmod +x ClangBuildAnalyzer
cd -
end
function install-bazel
sudo apt install -y bazel
set -l TMP_DIR (mktemp -d -p /tmp install-XXXXXX)
Expand All @@ -66,45 +54,6 @@ function install-bazel
cd -
end
## Utilities ##
function install-gh
if test (uname -s) = "Darwin"
brew install gh
else
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch="(dpkg --print-architecture)" signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install -y gh
end
gh auth login
gh extension install github/gh-copilot
gh config set git_protocol ssh
end
function install-mold
if test (lsb_release -sr) = "unstable"
sudo apt install -y mold
else
set -l TMP_DIR (mktemp -d -p /tmp install-XXXXXX)
cd $TMP_DIR
install-from-github rui314/mold "mold-.*-x86_64-linux.tar.gz"
tar -vxzf mold* -C ~/.local --strip-components=1
cd -
end
end
function install-difftastic
set -l TMP_DIR (mktemp -d -p /tmp install-XXXXXX)
cd $TMP_DIR
install-from-github Wilfred/difftastic difft-x86_64-unknown-linux-gnu.tar.gz
ex difft-x86_64-unknown-linux-gnu.tar.gz
mv difft ~/.local/bin
cd -
end
## LSPs + Linters ##
function install-pre-commit
if test (lsb_release -sr) = "unstable"
sudo apt install -y pre-commit black cpplint cmake-format
Expand All @@ -122,15 +71,6 @@ end
## ROS ##
function install-catkin
sudo sh \
-c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" \
> /etc/apt/sources.list.d/ros-latest.list'
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install python3-catkin-tools
end
function install-colcon
sudo apt install -y 'python3-colcon-*' python3-vcstool python3-rosdep
colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
Expand Down Expand Up @@ -202,6 +142,7 @@ function unstow-configs
yamllint \
zathura
end
function stow-configs
stow --no-folding --target ~ --ignore=.mypy_cache --ignore=.ruff_cache --stow cargo \
clangd \
Expand Down
10 changes: 4 additions & 6 deletions fish/config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -768,12 +768,10 @@ export COMPOSE_DOCKER_CLI_BUILD=1
###################

function register-argcomplete
if type -f register-python-argcomplete &> /dev/null
set -l script_path ~/.config/fish/completions/$argv[1].fish
if command -v $argv[1] &> /dev/null
if ! test -e $script_path
register-python-argcomplete --shell fish $argv[1] > $script_path
end
set -l script_path ~/.config/fish/completions/$argv[1].fish
if command -v $argv[1] &> /dev/null
if ! test -e $script_path
pixi run --frozen --manifest-path ~/myconfigs register-python-argcomplete -s fish --shell fish $argv[1] > $script_path
end
end
end
Expand Down
45 changes: 44 additions & 1 deletion scripts/.local/bin/myinstall
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ case "${1:-}" in
sshfs \
universal-ctags \
pdfgrep \
atool
atool \
ccache
mkdir -p ~/.local/bin || true
$0 ripgrep
$0 fzf
Expand Down Expand Up @@ -445,6 +446,48 @@ case "${1:-}" in
popd || exit 1
;;

gh)
if [ "$(uname -s)" = "Darwin" ]; then
brew install gh
else
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
install_package gh
fi
gh auth login
gh extension install github/gh-copilot
gh config set git_protocol ssh
;;

mold)
if [ "$(lsb_release -sr)" = "unstable" ]; then
install_package mold
else
TMP_DIR=$(mktemp -d -p /tmp install-XXXXXX)
pushd "$TMP_DIR" || exit 1
install_from_github rui314/mold "mold-.*-x86_64-linux.tar.gz"
tar -vxzf mold* -C ~/.local --strip-components=1
popd || exit 1
fi
;;

difftastic)
TMP_DIR=$(mktemp -d -p /tmp install-XXXXXX)
pushd "$TMP_DIR" || exit 1
install_from_github Wilfred/difftastic difft-x86_64-unknown-linux-gnu.tar.gz
extract difft-x86_64-unknown-linux-gnu.tar.gz
mv difft ~/.local/bin
popd || exit 1
;;

clang-build-analyzer)
pushd ~/.local/bin
install_from_github aras-p/ClangBuildAnalyzer ClangBuildAnalyzer-linux
mv ClangBuildAnalyzer-linux ClangBuildAnalyzer
chmod +x ClangBuildAnalyzer
popd || exit 1
;;

*)
echo "Usage: $(basename "$0") <option>" >&2
list_options
Expand Down

0 comments on commit 9d2e071

Please sign in to comment.