diff --git a/.github/pictures/color-scheme.png b/.github/pictures/color-scheme.png new file mode 100644 index 0000000..f4d2aa5 Binary files /dev/null and b/.github/pictures/color-scheme.png differ diff --git a/.github/pictures/color-theme.png b/.github/pictures/color-theme.png deleted file mode 100644 index 4001e51..0000000 Binary files a/.github/pictures/color-theme.png and /dev/null differ diff --git a/.github/scripts/publish.bash b/.github/scripts/publish.bash index d3f3701..20831d1 100644 --- a/.github/scripts/publish.bash +++ b/.github/scripts/publish.bash @@ -3,7 +3,7 @@ # A script to build and push the image # Build the image -podman --storage-opt=overlay.mount_program=/usr/bin/fuse-overlayfs build --squash-all -t ${IMAGENAME} . +podman build --squash-all -t ${IMAGENAME} . # Login to the GHCR echo ${GHCR_PAT} | podman login ghcr.io -u ${USERNAME} --password-stdin diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8b1936c..a1bd522 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: - name: Checkout the repository uses: actions/checkout@master - name: Build the image - run: podman --storage-opt=overlay.mount_program=/usr/bin/fuse-overlayfs build --squash-all -t dev . + run: podman build --squash-all -t dev . - name: Run a container run: | podman run --name container -td dev diff --git a/Dockerfile b/Dockerfile index 98d7103..de86e63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ # Base image -FROM docker.io/bitnami/minideb:buster +FROM docker.io/bitnami/git:2 # Meta information LABEL maintainer="Pavel Sobolev (https://github.com/Paveloom)" -LABEL version="0.5.0" +LABEL version="0.6.0" LABEL description="This is an image containing paveloom's personal development environment." LABEL github-repository="https://github.com/paveloom-d/dev" LABEL image-repository="https://github.com/orgs/paveloom-d/packages/container/package/dev" @@ -17,11 +17,11 @@ RUN chmod -R +x /build-scripts # Install essential packages RUN /build-scripts/root/install-essential-packages.bash -# Install Zsh -RUN /build-scripts/root/install-zsh.bash +# Install Fish +RUN /build-scripts/root/install-fish.bash -# Set `SHELL` to Zsh -ENV SHELL /bin/zsh +# Set `SHELL` to Fish +ENV SHELL /bin/fish # Specify new user ENV USER=paveloom @@ -36,19 +36,16 @@ RUN /build-scripts/root/set-up-a-new-user.bash WORKDIR $HOME # Copy user scripts -COPY user-scripts Scripts +COPY --chown=$USER:$USER user-scripts Scripts # Allow their execution and let the user own them -RUN chown -R $USER:$USER Scripts && chmod -R +x Scripts +RUN chmod -R +x Scripts # Switch to the created user USER $USER -# Point to the hosts file for SSH -RUN /build-scripts/user/add-configs.bash - -# Install OhMyZsh -RUN /build-scripts/user/install-ohmyzsh.bash +# Copy the user's configuration files +COPY --chown=$USER:$USER configs /home/$USER # Remove build scripts RUN sudo rm -rf /build-scripts diff --git a/LICENSE.md b/LICENSE.md index 2681a1c..aeac6bf 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Pavel Sobolev +Copyright (c) 2021 Pavel Sobolev Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 334b50e..74ff570 100644 --- a/README.md +++ b/README.md @@ -19,47 +19,29 @@ See all details under the spoiler:
Content of the image
@@ -104,10 +86,10 @@ You can then run a container based on this image as follows: podman run --name container -t -d dev ``` -Since Zsh is the default shell, you can enter the container using the following command: +Since Fish is the default shell, you can enter the container using the following command: ```bash -podman exec -it container zsh +podman exec -it container fish ``` ### I don't see any password requests. Is that normal? @@ -147,7 +129,7 @@ This will prompt for the `username`'s password. If you haven't done this yet, Instead of calling `ssh-add` every time you log-in, you can add your SSH key(s) using [`keychain`](https://linux.die.net/man/1/keychain). The corresponding lines are present -in the `~/.zshrc`, just uncomment them and specify your keys. +in the `~/.config/fish/config.fish`, just uncomment them and specify your keys. ### Auxiliary user scripts, huh? What's that? @@ -159,7 +141,7 @@ Also, scripts to install the latest stable versions of Julia and Rust are includ They are located in `~/Scripts`. -### Theme adjustments? Why? +### Color scheme? Different terminals (like Xterm), programs (like Visual Studio Code) and utilities (like PuTTY) have their own color pallettes. So the current theme can look ugly depending @@ -195,4 +177,4 @@ It's based on [`synthwave-everything`](https://atomcorp.github.io/themes/?theme=synthwave-everything). With everything else set correctly, the terminal window should look like this: -![](https://github.com/paveloom-d/dev/raw/master/.github/pictures/color-theme.png) +![](./.github/pictures/color-scheme.png) diff --git a/build-scripts/root/install-essential-packages.bash b/build-scripts/root/install-essential-packages.bash index 34ac010..5a32d5b 100644 --- a/build-scripts/root/install-essential-packages.bash +++ b/build-scripts/root/install-essential-packages.bash @@ -2,17 +2,20 @@ echo -e '\n\e[1;36mInstalling essential packages:\e[0m' +# Create a symbolic link to Git +ln -s /opt/bitnami/git/bin/git /usr/bin/git + echo -e '\e[1;36m> Installing `apt-utils`...\e[0m' install_packages apt-utils >/dev/null 2>&1 -echo -e '\e[1;36m> Installing `htop`...\e[0m' -install_packages htop >/dev/null +echo -e '\e[1;36m> Installing `exa`...\e[0m' +install_packages exa >/dev/null -echo -e '\e[1;36m> Installing `ca-certificates`...\e[0m' -install_packages ca-certificates >/dev/null +echo -e '\e[1;36m> Installing `ncurses-bin`...\e[0m' +install_packages ncurses-bin >/dev/null -echo -e '\e[1;36m> Installing `git`...\e[0m' -install_packages git >/dev/null +echo -e '\e[1;36m> Installing `htop`...\e[0m' +install_packages htop >/dev/null echo -e '\e[1;36m> Installing `ncdu`...\e[0m' install_packages ncdu >/dev/null @@ -29,18 +32,9 @@ install_packages less >/dev/null echo -e '\e[1;36m> Installing `wget`...\e[0m' install_packages wget >/dev/null -echo -e '\e[1;36m> Installing `curl`...\e[0m' -install_packages curl >/dev/null - echo -e '\e[1;36m> Installing `gpg` and `gnupg-agent`...\e[0m' install_packages gpg gnupg-agent >/dev/null -echo -e '\e[1;36m> Installing `sudo`...\e[0m' -install_packages sudo >/dev/null - -echo -e '\e[1;36m> Installing `ssh`...\e[0m' -install_packages ssh >/dev/null - echo -e '\e[1;36m> Installing `keychain`...\e[0m' install_packages keychain >/dev/null diff --git a/build-scripts/root/install-fish.bash b/build-scripts/root/install-fish.bash new file mode 100644 index 0000000..ff1a493 --- /dev/null +++ b/build-scripts/root/install-fish.bash @@ -0,0 +1,13 @@ +#!/bin/bash + +echo -e '\n\e[1;36mInstalling Fish:\e[0m' + +echo -e '\e[1;36m> Installing the package...\e[0m' +echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_10/ /' >> /etc/apt/sources.list.d/shells:fish:release:3.list +curl -fsSL https://download.opensuse.org/repositories/shells:fish:release:3/Debian_10/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/shells_fish_release_3.gpg > /dev/null +install_packages fish >/dev/null + +echo -e '\e[1;36m> Changing the default shell...\e[0m' +sed -i -e "s/bin\/ash/usr\/bin\/fish/" /etc/passwd + +echo diff --git a/build-scripts/root/install-zsh.bash b/build-scripts/root/install-zsh.bash deleted file mode 100644 index edbadcd..0000000 --- a/build-scripts/root/install-zsh.bash +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -echo -e '\n\e[1;36mInstalling Zsh:\e[0m' - -echo -e '\e[1;36m> Installing the package...\e[0m' -install_packages zsh >/dev/null - -echo -e '\e[1;36m> Changing the default shell...\e[0m' -sed -i -e "s/bin\/ash/bin\/zsh/" /etc/passwd - -echo diff --git a/build-scripts/root/set-up-a-new-user.bash b/build-scripts/root/set-up-a-new-user.bash index 479c8bf..0925976 100644 --- a/build-scripts/root/set-up-a-new-user.bash +++ b/build-scripts/root/set-up-a-new-user.bash @@ -3,7 +3,7 @@ echo -e '\n\e[1;36mSetting up a user:\e[0m' echo -e '\e[1;36m> Adding a user...\e[0m' -useradd -ms /bin/zsh $USER +useradd -ms /usr/bin/fish $USER echo -e '\e[1;36m> Disabling the password prompt...\e[0m' echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER @@ -14,4 +14,8 @@ chmod 0440 /etc/sudoers.d/$USER echo -e '\e[1;36m> Letting the user to own the home directory...\e[0m' chown -R $USER:$USER $HOME +echo -e '\e[1;36m> Creating `/etc/wsl.conf`...\e[0m' +echo -e "[user] +default = $USER" > /etc/wsl.conf + echo diff --git a/build-scripts/user/add-configs.bash b/build-scripts/user/add-configs.bash deleted file mode 100644 index 4851f93..0000000 --- a/build-scripts/user/add-configs.bash +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -echo -e '\n\e[1;36mAdding configs:\e[0m' - -echo -e '\e[1;36m> Creating `~/.ssh/config`...\e[0m' -mkdir -p ~/.ssh -echo -e 'UserKnownHostsFile ~/.ssh/known_hosts' > ~/.ssh/config - -echo -e '\e[1;36m> Creating `/etc/wsl.conf`...\e[0m' -sudo bash -c "echo -e '[user] -default = ${USER}' > /etc/wsl.conf" - -echo diff --git a/build-scripts/user/install-ohmyzsh.bash b/build-scripts/user/install-ohmyzsh.bash deleted file mode 100644 index 28d23ea..0000000 --- a/build-scripts/user/install-ohmyzsh.bash +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash - -echo -e '\n\e[1;36mInstalling OhMyZsh:\e[0m' - -echo -e '\e[1;36m> Installing the framework...\e[0m' -(sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)") >/dev/null 2>&1 - -echo -e '\e[1;36m> Downloading the `zsh-autosuggestions` plugin...\e[0m' -git clone --quiet https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions >/dev/null - -echo -e '\e[1;36m> Activating the plugin...\e[0m' -sed -i '/plugins=(git)/c\plugins=(git zsh-autosuggestions)' ~/.zshrc - -echo -e '\e[1;36m> Activating `zshcfg` alias...\e[0m' -sed -i '/# alias zshconfig="mate ~\/\.zshrc"/c\alias zshcfg="nano ~\/\.zshrc"' ~/.zshrc - -echo -e '\e[1;36m> Appending custom config changes...\e[0m' -echo ' -# Key bindings - -## Bind `Ctrl+Backspace` to delete a word behind the cursor -bindkey '\''^H'\'' backward-kill-word - -## Bind `Ctrl+Delete` to delete a word after the cursor -bindkey '\''5~'\'' kill-word - -# Settings for the `zsh-autosuggestions` plugin - -## Change the color of a suggestion -ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ff00ff" - -# Theme settings - -## Change colors of public directories in the `ls` output -export LS_COLORS="$LS_COLORS:ow=1;35:tw=1;35:" - -# SSH / Keychain - -## Start an `ssh-agent` -eval "$(ssh-agent -s)" >/dev/null 2>&1 - -## Start SSH service -sudo service ssh start >/dev/null - -## Add an SSH key to the keys chain -# keychain ~/.ssh/id_rsa 2>/dev/null -# . ~/.keychain/`uname -n`-sh - -# Other - -## Fix `TTY` for GPG -export GPG_TTY=$(tty) - -## Switch to UTF-8 encoding -export LC_ALL=C.UTF-8 - -## Make `less` not open a window -## if text takes up less space -export LESS=-FXR - -## Set up the display (for WSL) -export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0 - -## Go home at the start -cd $HOME' >> ~/.zshrc - -echo -e '\e[1;36m> Creating a theme...\e[0m' -echo 'PROMPT="%(?:%{$fg_bold[green]%}~>:%{$fg_bold[red]%}~>)" -PROMPT+='\'' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'\'' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}<" -ZSH_THEME_GIT_PROMPT_SUFFIX=">%{$reset_color%} "' > ~/.oh-my-zsh/custom/themes/paveloom.zsh-theme - -echo -e '\e[1;36m> Adjusting the theme...\e[0m' -sed -i '/ZSH_THEME="robbyrussell"/c\ZSH_THEME="paveloom"' ~/.zshrc - -echo -e '\e[1;36m> Activating `nano`'\''s default syntax highlighting...\e[0m' -echo 'include /usr/share/nano/*.nanorc' > ~/.nanorc - -echo -e '\e[1;36m> Adding the configuration before sourcing...\e[0m' -sed -i '/source $ZSH\/oh-my-zsh./c\ -# Change the colors of public directories\ -export LS_COLORS="$LS_COLORS:di=1;34:ow=1;31:tw=1;31:"\ -\ -# Disable the verification of insecure directories\ -ZSH_DISABLE_COMPFIX="true"\ -\ -source $ZSH/oh-my-zsh.sh' ~/.zshrc - -echo diff --git a/configs/.config/fish/config.fish b/configs/.config/fish/config.fish new file mode 100644 index 0000000..7ec06d1 --- /dev/null +++ b/configs/.config/fish/config.fish @@ -0,0 +1,31 @@ +# Go home +cd $HOME + +# Disable greeting +set fish_greeting + +# Key bindings + +## Bind `Ctrl+Backspace` to delete a word behind the cursor +bind \b backward-kill-word + +## Bind `Ctrl+Delete` to delete a word after the cursor +bind \e\[3\;5~ kill-word + +# Variables + +## Switch to UTF-8 encoding +set -gx LC_ALL C.UTF-8 + +## Make `less` not open a window if text takes up less space +set -gx LESS -FXR + +## Set up the display (for WSL) +set -gx DISPLAY (cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0 + +# Aliases +alias ls=exa +alias cfg="nano ~/.config/fish/config.fish" + +# Keychain +# eval keychain -q --noask --eval id_rsa >/dev/null diff --git a/configs/.config/fish/functions/fish_prompt.fish b/configs/.config/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..26ce8eb --- /dev/null +++ b/configs/.config/fish/functions/fish_prompt.fish @@ -0,0 +1,37 @@ +function fish_prompt --description 'Write out the prompt' + set -l last_pipestatus $pipestatus + + set -g __fish_git_prompt_show_informative_status 1 + set -g __fish_git_prompt_hide_untrackedfiles 1 + set -g __fish_git_prompt_color_branch magenta --bold + set -g __fish_git_prompt_showupstream informative + set -g __fish_git_prompt_char_upstream_ahead "↑" + set -g __fish_git_prompt_char_upstream_behind "↓" + set -g __fish_git_prompt_char_upstream_prefix "" + set -g __fish_git_prompt_char_stagedstate "●" + set -g __fish_git_prompt_char_dirtystate "✚" + set -g __fish_git_prompt_char_untrackedfiles "…" + set -g __fish_git_prompt_char_invalidstate "✖" + set -g __fish_git_prompt_char_cleanstate "" + set -g __fish_git_prompt_char_stateseparator + set -g __fish_git_prompt_color red + set -g __fish_git_prompt_color_dirtystate blue + set -g __fish_git_prompt_color_stagedstate yellow + set -g __fish_git_prompt_color_invalidstate red + set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal + set -g __fish_git_prompt_color_cleanstate green --bold + + set -l prefix_color + if test $pipestatus = 0 + set prefix_color green + else + set prefix_color red + end + + # PWD + echo -n (set_color $prefix_color)"~> "(set_color -o cyan)(basename (prompt_pwd))(set_color normal) + set_color normal + + printf '%s' (fish_vcs_prompt) + echo -n ' ' +end diff --git a/configs/.nanorc b/configs/.nanorc new file mode 100644 index 0000000..7fa0d6c --- /dev/null +++ b/configs/.nanorc @@ -0,0 +1 @@ +include /usr/share/nano/*.nanorc diff --git a/configs/.ssh/config b/configs/.ssh/config new file mode 100644 index 0000000..a5c8f7d --- /dev/null +++ b/configs/.ssh/config @@ -0,0 +1 @@ +UserKnownHostsFile ~/.ssh/known_hosts diff --git a/user-scripts/Julia.bash b/user-scripts/Julia.bash index 75f20f0..40f525e 100644 --- a/user-scripts/Julia.bash +++ b/user-scripts/Julia.bash @@ -19,9 +19,9 @@ tar -xf ~/Other/julia/julia-${JULIA_VERSION}-linux-x86_64.tar.gz -C ~/Other/juli echo -e '\e[1;36m> Deleting the tarball...\e[0m' rm ~/Other/julia/julia*.tar.gz -echo -e '\e[1;36m> Explicitly updating the PATH variable in the `~/.zshrc`...\e[0m' +echo -e '\e[1;36m> Explicitly updating the PATH variable in the `~/.config/fish/config.fish`...\e[0m' echo ' # Add Julia binary to the `PATH` -export PATH=$PATH:/home/$USER/Other/julia/bin' >> ~/.zshrc +set -a PATH /home/$USER/Other/julia/bin' >> ~/.config/fish/config.fish echo diff --git a/user-scripts/Rust.bash b/user-scripts/Rust.bash index eb169aa..0129b39 100644 --- a/user-scripts/Rust.bash +++ b/user-scripts/Rust.bash @@ -10,9 +10,9 @@ echo -e '\n\e[1;36mInstalling Rust:\e[0m' echo -e '\e[1;36m> Installing `rustup`...\e[0m' curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh &>/dev/null -s -- -y -echo -e '\e[1;36m> Explicitly updating the PATH variable in the `~/.zshrc`...\e[0m' +echo -e '\e[1;36m> Explicitly updating the PATH variable in the `~/.config/fish/config.fish`...\e[0m' echo ' # Add Rust binaries to the `PATH` -export PATH=$PATH:/home/$USER/.cargo/bin' >> ~/.zshrc +set -a PATH /home/$USER/.cargo/bin' >> ~/.config/fish/config.fish echo