mirror of
https://github.com/mentos1386/dotfiles.git
synced 2025-01-31 00:35:42 +00:00
feat: nix with home manager
This commit is contained in:
parent
0739b1f21e
commit
fb84096201
7 changed files with 182 additions and 208 deletions
12
README.md
12
README.md
|
@ -2,14 +2,4 @@
|
|||
|
||||
Expected configuration:
|
||||
* Fedora Silverblue as host
|
||||
* Fedora in Toolbox as development environment
|
||||
|
||||
```sh
|
||||
# Install on host
|
||||
./install.sh
|
||||
|
||||
# Enter the prepared fedora development environment
|
||||
toolbox enter fedora
|
||||
# Install in development environment
|
||||
./install.sh
|
||||
```
|
||||
* Nix with home-manager for tools and software.
|
||||
|
|
28
bat/config
28
bat/config
|
@ -1,28 +0,0 @@
|
|||
# This is `bat`s configuration file. Each line either contains a comment or
|
||||
# a command-line option that you want to pass to `bat` by default. You can
|
||||
# run `bat --help` to get a list of all possible configuration options.
|
||||
|
||||
# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes`
|
||||
# for a list of all available themes
|
||||
--theme="OneHalfLight"
|
||||
|
||||
# same as full, unless the output is piped.
|
||||
--style="auto"
|
||||
|
||||
# Enable this to use italic text on the terminal. This is not supported on all
|
||||
# terminal emulators (like tmux, by default):
|
||||
--italic-text=always
|
||||
|
||||
# Uncomment the following line to disable automatic paging:
|
||||
#--paging=never
|
||||
|
||||
# Uncomment the following line if you are using less version >= 551 and want to
|
||||
# enable mouse scrolling support in `bat` when running inside tmux. This might
|
||||
# disable text selection, unless you press shift.
|
||||
#--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse"
|
||||
|
||||
# Syntax mappings: map a certain filename pattern to a language.
|
||||
# Example 1: use the C++ syntax for Arduino .ino files
|
||||
# Example 2: Use ".gitignore"-style highlighting for ".ignore" files
|
||||
#--map-syntax "*.ino:C++"
|
||||
#--map-syntax ".ignore:Git Ignore"
|
|
@ -1,36 +0,0 @@
|
|||
[user]
|
||||
name = Tine Jozelj
|
||||
email = tine@tjo.space
|
||||
signingkey = /home/tine/.ssh/id_ed25519.pub
|
||||
|
||||
[commit]
|
||||
gpgsign = true
|
||||
|
||||
[init]
|
||||
defaultBranch = main
|
||||
|
||||
[diff]
|
||||
external = difft
|
||||
|
||||
[push]
|
||||
autoSetupRemote = true
|
||||
|
||||
[pull]
|
||||
ff = only
|
||||
|
||||
[gpg]
|
||||
format = ssh
|
||||
|
||||
[gpg "ssh"]
|
||||
allowedSignersFile = /home/tine/.ssh/allowed_signers
|
||||
|
||||
[filter "lfs"]
|
||||
clean = git-lfs clean -- %f
|
||||
smudge = git-lfs smudge -- %f
|
||||
process = git-lfs filter-process
|
||||
required = true
|
||||
|
||||
[http]
|
||||
postBuffer = 3221225472
|
||||
[credential]
|
||||
helper = libsecret
|
143
home.nix
Normal file
143
home.nix
Normal file
|
@ -0,0 +1,143 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Home Manager needs a bit of information about you and the paths it should
|
||||
# manage.
|
||||
home.username = "tine";
|
||||
home.homeDirectory = "/var/home/tine";
|
||||
|
||||
# This value determines the Home Manager release that your configuration is
|
||||
# compatible with. This helps avoid breakage when a new Home Manager release
|
||||
# introduces backwards incompatible changes.
|
||||
#
|
||||
# You should not change this value, even if you update Home Manager. If you do
|
||||
# want to update the value, then make sure to first check the Home Manager
|
||||
# release notes.
|
||||
home.stateVersion = "23.11"; # Please read the comment before changing.
|
||||
|
||||
# The home.packages option allows you to install Nix packages into your
|
||||
# environment.
|
||||
home.packages = with pkgs; [
|
||||
git
|
||||
git-lfs
|
||||
difftastic
|
||||
|
||||
# Tools
|
||||
ripgrep
|
||||
bat
|
||||
tmux
|
||||
jq
|
||||
fd
|
||||
|
||||
# Nodejs
|
||||
nodejs_20
|
||||
|
||||
# Golang
|
||||
go
|
||||
gopls
|
||||
golangci-lint
|
||||
|
||||
# C & CPP
|
||||
gcc
|
||||
|
||||
# Rust
|
||||
cargo
|
||||
|
||||
# Shell
|
||||
zsh
|
||||
shfmt
|
||||
];
|
||||
|
||||
# Home Manager is pretty good at managing dotfiles. The primary way to manage
|
||||
# plain files is through 'home.file'.
|
||||
home.file = {
|
||||
"~/.tmux.conf".source = tmux/tmux.conf;
|
||||
"~/.ssh/authorized_keys".source = ssh/authorized_keys;
|
||||
"${config.xdg.configHome}/starship.toml".source = starship/starship.toml;
|
||||
"${config.xdg.configHome}/kitty.conf".source = kitty/kitty.conf;
|
||||
"${config.xdg.configHome}/nvim" = {
|
||||
recursive = true;
|
||||
source = ./nvim;
|
||||
};
|
||||
};
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "Tine";
|
||||
userEmail = "tine@tjo.space";
|
||||
|
||||
difftastic.enable = true;
|
||||
lfs.enable = true;
|
||||
|
||||
extraConfig = {
|
||||
user = {
|
||||
signingkey = "~/.ssh/id_ed25519";
|
||||
};
|
||||
|
||||
commit = {
|
||||
gpgsign = true;
|
||||
};
|
||||
|
||||
gpg = {
|
||||
format = "ssh";
|
||||
};
|
||||
|
||||
credentials = {
|
||||
helper = "libsecret";
|
||||
};
|
||||
|
||||
init = {
|
||||
defaultBranch = "main";
|
||||
};
|
||||
|
||||
push = {
|
||||
autoSetupRemote = true;
|
||||
};
|
||||
|
||||
pull = {
|
||||
ff = "only";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
config = {
|
||||
theme = "OneHalfLight";
|
||||
italic-text = "always";
|
||||
};
|
||||
};
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
};
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
history = {
|
||||
size = 10000000;
|
||||
save = 10000000;
|
||||
ignoreAllDups = true;
|
||||
path = "${config.xdg.dataHome}/zsh/history";
|
||||
};
|
||||
enableAutosuggestions = true;
|
||||
enableCompletion = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
shellAliases = {
|
||||
"ll" = "ls -l";
|
||||
"gicm" = "(git checkout main || git checkout master) && git pull";
|
||||
"gic" = "git checkout";
|
||||
"gip" = "git pull";
|
||||
};
|
||||
};
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
}
|
122
install.sh
122
install.sh
|
@ -3,115 +3,45 @@
|
|||
REPO_DIR=$(dirname $(readlink -f $0))
|
||||
HOME_DIR=${HOME}
|
||||
|
||||
echo "REPO_DIR=${REPO_DIR}"
|
||||
echo "HOME_DIR=${HOME_DIR}"
|
||||
|
||||
workspace_backup() {
|
||||
mv $HOME_DIR/$1 $HOME_DIR/$1-old 2>/dev/null || true
|
||||
}
|
||||
|
||||
workspace_link() {
|
||||
mkdir -p $(dirname $HOME_DIR/$2)
|
||||
ln -s $REPO_DIR/$1 $HOME_DIR/$2 || true
|
||||
}
|
||||
|
||||
# On host we only install minimal dependencies.
|
||||
# Mostly just GUI applications.
|
||||
echo "==[host] Installing rpm-os tree packages"
|
||||
rpm-ostree install --idempotent --apply-live --allow-inactive \
|
||||
git git-lfs \
|
||||
kitty zsh
|
||||
|
||||
if [ ! -n "${TOOLBOX_PATH}" ]
|
||||
then
|
||||
echo "==[host] Installing rpm-os tree packages"
|
||||
rpm-ostree install --idempotent --apply-live --allow-inactive \
|
||||
git \
|
||||
git-lfs \
|
||||
neovim \
|
||||
bat \
|
||||
zsh \
|
||||
ripgrep \
|
||||
difftastic \
|
||||
nodejs
|
||||
echo "==[host] Installing flatpaks"
|
||||
flatpak install --user com.bitwarden.desktop
|
||||
flatpak install --user md.obsidian.Obsidian
|
||||
flatpak install --user org.mozilla.firefox
|
||||
flatpak install --user org.mozilla.Thunderbird
|
||||
flatpak install --user org.gnome.Builder
|
||||
flatpak install --user com.vscodium.codium
|
||||
|
||||
echo "==[host] Installing flatpaks"
|
||||
flatpak install --user com.bitwarden.desktop
|
||||
flatpak install --user md.obsidian.Obsidian
|
||||
flatpak install --user org.mozilla.firefox
|
||||
flatpak install --user org.mozilla.Thunderbird
|
||||
echo "==[host] Installing Nix"
|
||||
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
|
||||
|
||||
echo "==[host] Preparing toolbox"
|
||||
toolbox create fedora || true
|
||||
toolbox enter fedora
|
||||
else
|
||||
echo "==[toolbox] Installing dependencies"
|
||||
sudo dnf update -y --best --allowerasing
|
||||
sudo dnf install -y \
|
||||
git \
|
||||
bat \
|
||||
neovim python3-neovim \
|
||||
zsh \
|
||||
tmux \
|
||||
nodejs \
|
||||
ripgrep \
|
||||
snapd \
|
||||
cargo \
|
||||
difftastic \
|
||||
wl-clipboard \
|
||||
ripgrep jq fd-find \
|
||||
gcc g++ libstdc++-static
|
||||
fi
|
||||
echo "==[host] Installing Home Manager"
|
||||
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
|
||||
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
|
||||
nix-channel --update
|
||||
nix-shell '<home-manager>' -A install
|
||||
workspace_link home.nix .config/home-manager/home.nix
|
||||
|
||||
echo "== Prepare ~/.bin"
|
||||
mkdir -p $HOME/.bin
|
||||
echo "==[host] Installing Home Manager packages"
|
||||
home-manager switch
|
||||
|
||||
echo "== starship"
|
||||
if ! starship --help > /dev/null
|
||||
then
|
||||
sh -c "$(curl -fsSL https://starship.rs/install.sh)" -- --bin-dir=$HOME/.bin --yes
|
||||
fi
|
||||
echo "==[host] Use zsh as default shell"
|
||||
sudo chsh $USER --shell=/bin/zsh
|
||||
|
||||
echo "== Switching shell to ZSH"
|
||||
sudo chsh $USER --shell=$(which zsh)
|
||||
|
||||
echo "== Installing fonts"
|
||||
echo "==[host] Installing fonts"
|
||||
HOME_FONTS_DIR="${HOME_DIR}/.local/share/fonts"
|
||||
mkdir -p ${HOME_FONTS_DIR}
|
||||
rm -rf ${HOME_FONTS_DIR}/dotfiles-fonts
|
||||
git clone --depth 1 git@github.com:mentos1386/dotfiles-fonts.git ${HOME_FONTS_DIR}/dotfiles-fonts
|
||||
fc-cache
|
||||
|
||||
echo "== Copying configuration files..."
|
||||
# GIT
|
||||
workspace_backup .gitconfig
|
||||
workspace_link git/gitconfig .gitconfig
|
||||
|
||||
# SSH
|
||||
workspace_backup .ssh/authorized_keys
|
||||
workspace_link ssh/authorized_keys .ssh/authorized_keys
|
||||
|
||||
# TMUX
|
||||
workspace_backup .tmux.conf
|
||||
workspace_link tmux/tmux.conf .tmux.conf
|
||||
|
||||
# STARSHIP
|
||||
workspace_backup .starship.toml
|
||||
workspace_link starship/starship.toml .starship.toml
|
||||
|
||||
# ZSH
|
||||
workspace_backup .zshrc
|
||||
workspace_link zsh/zshrc .zshrc
|
||||
|
||||
# KITTY
|
||||
workspace_backup .config/kitty/kitty.conf
|
||||
workspace_link kitty/kitty.conf .config/kitty/kitty.conf
|
||||
|
||||
# BAT
|
||||
workspace_backup .config/bat/config
|
||||
workspace_link bat/config .config/bat/config
|
||||
|
||||
# NEOVIM
|
||||
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||
workspace_backup .config/nvim/init.vim
|
||||
workspace_link nvim/init.vim .config/nvim/init.vim
|
||||
for file in nvim/lua/*
|
||||
do
|
||||
workspace_backup .config/nvim/lua/$(basename $file)
|
||||
workspace_link nvim/lua/$(basename $file) .config/nvim/lua/$(basename $file)
|
||||
done
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Get editor completions based on the config schema
|
||||
"$schema" = 'https://starship.rs/config-schema.json'
|
||||
|
||||
[conda]
|
||||
disabled = true
|
||||
|
||||
|
@ -49,11 +52,16 @@ disabled = true
|
|||
[git_metrics]
|
||||
disabled = true
|
||||
|
||||
#####################
|
||||
|
||||
[container]
|
||||
symbol = ""
|
||||
style = "bold black dimmed"
|
||||
format = '[$name]($style) '
|
||||
|
||||
[git_state]
|
||||
disabled = false
|
||||
|
||||
#####################
|
||||
|
||||
[kubernetes]
|
||||
disabled = false
|
||||
symbol = ""
|
||||
|
@ -67,11 +75,11 @@ format = "[$symbol$version]($style) "
|
|||
|
||||
[aws]
|
||||
disabled = false
|
||||
symbol = " "
|
||||
symbol = "aws "
|
||||
|
||||
[git_branch]
|
||||
disabled = false
|
||||
symbol = " "
|
||||
symbol = "git "
|
||||
|
||||
[git_commit]
|
||||
disabled = true
|
||||
|
@ -79,8 +87,3 @@ commit_hash_length = 7
|
|||
tag_symbol = "🔖 "
|
||||
tag_disabled = false
|
||||
only_detached = false
|
||||
|
||||
[character]
|
||||
success_symbol = "❯"
|
||||
vicmd_symbol = "❮"
|
||||
|
||||
|
|
28
zsh/zshrc
28
zsh/zshrc
|
@ -1,28 +0,0 @@
|
|||
# History improvements
|
||||
export HISTFILE=~/.zsh_history
|
||||
export HISTFILESIZE=1000000000
|
||||
export HISTSIZE=1000000000
|
||||
export SAVEHIST=100000
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt HIST_IGNORE_ALL_DUPS
|
||||
# Vimode
|
||||
bindkey -v
|
||||
bindkey -M vicmd "?" history-incremental-search-backward
|
||||
bindkey -M vicmd "/" history-incremental-search-forward
|
||||
|
||||
# Aliases
|
||||
alias gicm="git checkout main && git pull || git checkout master && git pull"
|
||||
alias gic="git checkout"
|
||||
|
||||
alias difft="difftastic"
|
||||
alias vim="nvim"
|
||||
|
||||
# PATH
|
||||
export PATH=$PATH:$HOME/.bin:$HOME/go/bin
|
||||
|
||||
# ENV
|
||||
export EDITOR=vim
|
||||
|
||||
# Starship
|
||||
export STARSHIP_CONFIG=~/.starship.toml
|
||||
eval "$(starship init zsh)"
|
Loading…
Reference in a new issue