Skip to content

Commit

Permalink
Merge pull request #268 from himkt/nix-modularized
Browse files Browse the repository at this point in the history
misc(nix): make some configs nix modules
  • Loading branch information
himkt authored Dec 7, 2024
2 parents d0021ec + 979813d commit 69bb61a
Show file tree
Hide file tree
Showing 13 changed files with 143 additions and 143 deletions.
9 changes: 0 additions & 9 deletions git/bin/setup.sh

This file was deleted.

13 changes: 0 additions & 13 deletions git/config.d/config

This file was deleted.

19 changes: 0 additions & 19 deletions git/config.d/ignore

This file was deleted.

3 changes: 3 additions & 0 deletions nix/config.d/home/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

imports = [
./home/packages.nix
./programs/git.nix
./programs/tmux.nix
./programs/wezterm.nix
./programs/zsh.nix
];

Expand Down
3 changes: 0 additions & 3 deletions nix/config.d/home/home/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
pkgs.jq
pkgs.tree

pkgs.git
pkgs.git-lfs
pkgs.gh
pkgs.ghq

pkgs.zsh
pkgs.zsh-autocomplete
pkgs.zsh-syntax-highlighting
pkgs.zoxide
Expand Down
39 changes: 39 additions & 0 deletions nix/config.d/home/programs/git.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{ ... }:

{
programs.git = {
enable = true;
aliases = {
remove-merged = "!remove-merged-branches";
};

userEmail = "[email protected]";
userName = "himkt";

ignores = [
".vim"
".vscode"
".rakeTasks"
".rubocop.yml"
".venv"
"*.egg-info"
".mypy_cache"
".idea"
".DS_Store"
];

lfs = {
enable = true;
};

extraConfig = {
format = {
pretty = "format:%C(yellow)%h %C(green)%cd %C(reset)%s %C(red)%d %C(cyan)[%an]";
date = "iso";
};
pull = {
rebase = false;
};
};
};
}
55 changes: 55 additions & 0 deletions nix/config.d/home/programs/tmux.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{ ... }:

{
programs.tmux = {
enable = true;

extraConfig = ''
unbind C-b
# default config
set -g status-interval 2
set -g default-terminal "screen-256color"
set -g status-justify left
# enable mouse mode
setw -g mode-keys vi
bind-key -T copy-mode-vi y send -X copy-selection-and-cancel\; run "tmux save -|pbcopy"
bind-key -T copy-mode-vi Enter send -X copy-selection-and-cancel\; run "tmux save -|pbcopy"
# color
set -g status-fg colour231
set -g status-bg colour234
# window
window_status_current_format1="#[fg=colour234,bg=colour31] #[fg=colour117,bg=colour31]"
window_status_current_format2="#I #[fg=colour231]#W #[fg=colour31,bg=colour234,nobold]"
window_status_current_format=$window_status_current_format1' '$window_status_current_format2
set -g window-status-format "#[fg=colour244,bg=colour234] #I #[fg=colour240] #[default]#W"
set -g window-status-current-format $window_status_current_format
# take over current directory path
bind-key '"' split-window -c "#{pane_current_path}"
bind-key % split-window -h -c "#{pane_current_path}"
bind-key c new-window -c "#{pane_current_path}"
# status bar
set -g status-left-length 20
status_left1="#{?client_prefix,#[fg=colour254]#[bg=colour31],#[fg=colour16]#[bg=colour254]}"
status_left2="#S #{?client_prefix,#[fg=colour31]#[bg=colour234]#[nobold],#[fg=colour254]#[bg=colour234]#[nobold]}"
set -qg status-left $status_left1' '$status_left2
set -qg status-right '%H:%M #[fg=colour16,bg=colour254]'
# tmux config
set -g escape-time 10
set -g history-limit 50000
bind ^h select-layout even-horizontal
bind ^v select-layout even-vertical
# NOTE Commands `search-xxx-incremental` is new feature, it counldn't use in some environments
# For old tmux, please comment out following statement
bind-key -T copy-mode-vi / command-prompt -i -I "#{pane_search_string}" -p "(search down)" "send -X search-forward-incremental \"%%%\""
bind-key -T copy-mode-vi ? command-prompt -i -I "#{pane_search_string}" -p "(search up)" "send -X search-backward-incremental \"%%%\""
'';
};
}
46 changes: 46 additions & 0 deletions nix/config.d/home/programs/wezterm.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{ ... }:

{
programs.wezterm = {
enable = true;

extraConfig = ''
local wezterm = require 'wezterm'
local config = {}
config.keys = {}
config.scrollback_lines = 9999999
-- Use the defaults as a base
config.hyperlink_rules = wezterm.default_hyperlink_rules()
-- Font
config.font = wezterm.font 'JetBrains Mono NL'
config.font_size = 16.0
-- https://wezfurlong.org/wezterm/colorschemes/g/index.html
config.color_scheme = 'Guezwhoz'
config.colors = {cursor_bg = 'cyan', cursor_fg = 'black'}
config.default_cursor_style = 'SteadyUnderline'
config.window_background_opacity = 0.8
-- skip confirmation prompt when quitting app
config.window_close_confirmation = 'NeverPrompt'
-- fullscreen shortcut
config.native_macos_fullscreen_mode = true
config.keys[1] = {
key = 'f',
mods = 'CMD|CTRL',
action = wezterm.action.ToggleFullScreen,
}
config.keys[2] = {
key = 'Enter',
mods = 'CMD',
action = wezterm.action.ToggleFullScreen,
}
return config
'';
};
}
3 changes: 0 additions & 3 deletions tmux/bin/setup.sh

This file was deleted.

51 changes: 0 additions & 51 deletions tmux/config.d/tmux.conf

This file was deleted.

4 changes: 0 additions & 4 deletions wezterm/bin/setup.sh

This file was deleted.

37 changes: 0 additions & 37 deletions wezterm/config.d/wezterm.lua

This file was deleted.

4 changes: 0 additions & 4 deletions zsh/bin/setup.sh

This file was deleted.

0 comments on commit 69bb61a

Please sign in to comment.