refactor: modularize home-manager config

This commit is contained in:
Michael Mandl 2022-06-26 14:42:49 +02:00
parent 98750e1a51
commit e13ed446a1
Signed by: mandlm
GPG key ID: 4AA25D647AA54CC7
28 changed files with 323 additions and 271 deletions

10
home-manager/fzf.nix Normal file
View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, user, ... }:
{
programs = {
fzf = {
enable = true;
enableZshIntegration = true;
};
};
}

39
home-manager/git.nix Normal file
View file

@ -0,0 +1,39 @@
{ config, lib, pkgs, user, ... }:
{
programs = {
git = {
enable = true;
extraConfig = {
user.private.name = "Michael Mandl";
user.private.email = "mandlm@molez.net";
user.private.signingkey = "4AA25D647AA54CC7";
user.swp.name = "Michael Mandl";
user.swp.email = "mandl@vi-bim.de";
user.swp.signingkey = "4E60F44227F611B4";
core.editor = "nvim";
fetch.writeCommitGraph = true;
format.pretty = "format:%C(yellow)%h %Cblue%>(12)%ad %C(red)%G? %Cgreen%<(7,trunc)%aN%Cred%d %Creset%s";
init.defaultBranch = "main";
log.date = "relative";
pull.rebase = true;
rebase.autostash = true;
rerere.enabled = true;
worktree.guessRemote = true;
};
aliases = {
identity = "! git config user.name \"$(git config user.$1.name)\"; git config user.email \"$(git config user.$1.email)\"; git config user.signingkey \"$(git config user.$1.signingkey)\"; git config commit.gpgsign \"true\"; :";
};
ignores = [
".env"
".direnv"
"*.swp"
];
};
};
}

View file

@ -0,0 +1,25 @@
{ config, lib, pkgs, user, ... }:
{
services.gpg-agent = {
enable = true;
enableZshIntegration = true;
pinentryFlavor = "gtk2";
extraConfig = ''
allow-loopback-pinentry
'';
};
programs.gpg = {
enable = true;
mutableKeys = false;
mutableTrust = false;
publicKeys = [{
source = ./pubring.asc;
trust = "ultimate";
}];
settings = {
pinentry-mode = "loopback";
};
};
}

37
home-manager/i3.nix Normal file
View file

@ -0,0 +1,37 @@
{ config, lib, pkgs, user, ... }:
{
xsession.windowManager.i3 = {
enable = true;
config = {
modifier = "Mod4";
terminal = "${pkgs.kitty}/bin/kitty";
fonts = {
names = [ "DejaVu Sans Mono" ];
size = 12.0;
};
window = {
titlebar = false;
border = 0;
};
floating = {
titlebar = false;
border = 0;
};
bars = [{
mode = "hide";
position = "top";
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml";
fonts = {
names = [ "DejaVu Sans Mono" ];
size = 12.0;
};
}];
};
};
}

View file

@ -0,0 +1,41 @@
{ config, lib, pkgs, user, ... }:
{
programs.i3status-rust = {
enable = true;
bars = {
default = {
theme = "solarized-dark";
icons = "awesome";
blocks = [
{
block = "memory";
display_type = "memory";
format_mem = "{mem_used_percents}";
}
{
block = "cpu";
interval = 1;
format = "{barchart} {frequency}";
}
{
block = "load";
interval = 1;
format = "{1m}";
}
{
block = "battery";
hide_missing = true;
format = "{time} ({percentage})";
}
{
block = "time";
interval = 60;
format = "%a %d.%m %R";
}
];
};
};
};
}

14
home-manager/kitty.nix Normal file
View file

@ -0,0 +1,14 @@
{ config, lib, pkgs, user, ... }:
{
programs = {
kitty = {
enable = true;
theme = "Solarized Light";
font = {
name = "DejaVu Sans Mono";
size = 12;
};
};
};
}

View file

@ -0,0 +1,93 @@
{ config, lib, pkgs, user, ... }:
{
home.packages = with pkgs; [
# LSP
sumneko-lua-language-server
rnix-lsp
terraform-ls
tflint
nodePackages.bash-language-server
rust-analyzer
];
programs = {
neovim = {
enable = true;
plugins = with pkgs.vimPlugins; [
# theme
nvim-solarized-lua
delimitMate
vim-bbye
ansible-vim
# session handling
vim-obsession
vim-prosession
nvim-web-devicons
nvim-treesitter
markdown-preview-nvim # use({ "iamcco/markdown-preview.nvim", run = ":call mkdp#util#install()" })
toggleterm-nvim
nvim-notify
comment-nvim
lualine-nvim
tabline-nvim
indent-blankline-nvim
plenary-nvim
# git
gitsigns-nvim
vim-fugitive
gv-vim
# snippets
friendly-snippets
luasnip
# auto-completion
nvim-cmp
cmp-nvim-lsp
cmp-buffer
cmp-path
cmp-cmdline
cmp-nvim-lua
cmp_luasnip
cmp-calc
# telescope
telescope-nvim
telescope-fzf-native-nvim
telescope-ui-select-nvim
# LSP
nvim-lspconfig
lsp-status-nvim
rust-tools-nvim
lua-dev-nvim
];
extraConfig = ''
lua << EOF
${builtins.readFile ./keymaps.lua }
${builtins.readFile ./options.lua }
${builtins.readFile ./treesitter.lua }
${builtins.readFile ./lspconfig.lua }
${builtins.readFile ./toggleterm.lua }
${builtins.readFile ./notify.lua }
${builtins.readFile ./comment.lua }
${builtins.readFile ./lualine.lua }
${builtins.readFile ./tabline.lua }
${builtins.readFile ./indent-blankline.lua }
${builtins.readFile ./gitsigns.lua }
${builtins.readFile ./luasnip.lua }
${builtins.readFile ./nvim-cmp.lua }
${builtins.readFile ./telescope.lua }
${builtins.readFile ./themes.lua }
EOF
'';
};
};
}

11
home-manager/starship.nix Normal file
View file

@ -0,0 +1,11 @@
{ config, lib, pkgs, user, ... }:
{
programs.starship = {
enable = true;
settings = {
format = lib.concatStrings [ "$all" "$directory" "$character" ];
hostname.format = "[$ssh_symbol$hostname]($style) ";
};
};
}

20
home-manager/tmux.nix Normal file
View file

@ -0,0 +1,20 @@
{ config, lib, pkgs, user, ... }:
{
programs.tmux = {
enable = true;
newSession = true;
keyMode = "vi";
escapeTime = 10;
terminal = "tmux-256color";
extraConfig = ''
set-option -g status off
'';
plugins = with pkgs.tmuxPlugins; [
vim-tmux-navigator
tmux-colors-solarized
];
};
}

20
home-manager/zsh.nix Normal file
View file

@ -0,0 +1,20 @@
{ config, lib, pkgs, user, ... }:
{
programs.zsh = {
enable = true;
enableSyntaxHighlighting = true;
history.size = 10000;
oh-my-zsh = {
enable = true;
plugins = [ "direnv" "tmux" "vi-mode" ];
};
localVariables = {
ZSH_TMUX_AUTOSTART = true;
ZSH_TMUX_AUTOCONNECT = true;
ZSH_TMUX_UNICODE = true;
};
};
}

View file

@ -25,280 +25,23 @@
direnv
tree
light
# LSP
sumneko-lua-language-server
rnix-lsp
terraform-ls
tflint
nodePackages.bash-language-server
rust-analyzer
];
stateVersion = "22.05";
};
services.gpg-agent = {
enable = true;
enableZshIntegration = true;
pinentryFlavor = "gtk2";
extraConfig = ''
allow-loopback-pinentry
'';
};
programs.home-manager.enable = true;
programs = {
fzf = {
enable = true;
enableZshIntegration = true;
};
git = {
enable = true;
extraConfig = {
user.private.name = "Michael Mandl";
user.private.email = "mandlm@molez.net";
user.private.signingkey = "4AA25D647AA54CC7";
user.swp.name = "Michael Mandl";
user.swp.email = "mandl@vi-bim.de";
user.swp.signingkey = "4E60F44227F611B4";
core.editor = "nvim";
fetch.writeCommitGraph = true;
format.pretty = "format:%C(yellow)%h %Cblue%>(12)%ad %C(red)%G? %Cgreen%<(7,trunc)%aN%Cred%d %Creset%s";
init.defaultBranch = "main";
log.date = "relative";
pull.rebase = true;
rebase.autostash = true;
rerere.enabled = true;
worktree.guessRemote = true;
};
aliases = {
identity = "! git config user.name \"$(git config user.$1.name)\"; git config user.email \"$(git config user.$1.email)\"; git config user.signingkey \"$(git config user.$1.signingkey)\"; git config commit.gpgsign \"true\"; :";
};
ignores = [
".env"
".direnv"
"*.swp"
];
};
kitty = {
enable = true;
theme = "Solarized Light";
font = {
name = "DejaVu Sans Mono";
size = 12;
};
};
neovim = {
enable = true;
plugins = with pkgs.vimPlugins; [
# theme
nvim-solarized-lua
delimitMate
vim-bbye
ansible-vim
# session handling
vim-obsession
vim-prosession
nvim-web-devicons
nvim-treesitter
markdown-preview-nvim # use({ "iamcco/markdown-preview.nvim", run = ":call mkdp#util#install()" })
toggleterm-nvim
nvim-notify
comment-nvim
lualine-nvim
tabline-nvim
indent-blankline-nvim
plenary-nvim
# git
gitsigns-nvim
vim-fugitive
gv-vim
# snippets
friendly-snippets
luasnip
# auto-completion
nvim-cmp
cmp-nvim-lsp
cmp-buffer
cmp-path
cmp-cmdline
cmp-nvim-lua
cmp_luasnip
cmp-calc
# telescope
telescope-nvim
telescope-fzf-native-nvim
telescope-ui-select-nvim
# LSP
nvim-lspconfig
lsp-status-nvim
rust-tools-nvim
lua-dev-nvim
];
extraConfig = ''
lua << EOF
${builtins.readFile ./nvim/keymaps.lua }
${builtins.readFile ./nvim/options.lua }
${builtins.readFile ./nvim/treesitter.lua }
${builtins.readFile ./nvim/lspconfig.lua }
${builtins.readFile ./nvim/toggleterm.lua }
${builtins.readFile ./nvim/notify.lua }
${builtins.readFile ./nvim/comment.lua }
${builtins.readFile ./nvim/lualine.lua }
${builtins.readFile ./nvim/tabline.lua }
${builtins.readFile ./nvim/indent-blankline.lua }
${builtins.readFile ./nvim/gitsigns.lua }
${builtins.readFile ./nvim/luasnip.lua }
${builtins.readFile ./nvim/nvim-cmp.lua }
${builtins.readFile ./nvim/telescope.lua }
${builtins.readFile ./nvim/themes.lua }
EOF
'';
};
tmux = {
enable = true;
newSession = true;
keyMode = "vi";
escapeTime = 10;
terminal = "tmux-256color";
extraConfig = ''
set-option -g status off
'';
plugins = with pkgs.tmuxPlugins; [
vim-tmux-navigator
tmux-colors-solarized
];
};
gpg = {
enable = true;
mutableKeys = false;
mutableTrust = false;
publicKeys = [{
source = ./gnupg/pubring.asc;
trust = "ultimate";
}];
settings = {
pinentry-mode = "loopback";
};
};
zsh = {
enable = true;
enableSyntaxHighlighting = true;
history.size = 10000;
oh-my-zsh = {
enable = true;
plugins = [ "direnv" "tmux" "vi-mode" ];
};
localVariables = {
ZSH_TMUX_AUTOSTART = true;
ZSH_TMUX_AUTOCONNECT = true;
ZSH_TMUX_UNICODE = true;
};
};
starship = {
enable = true;
settings = {
format = lib.concatStrings [ "$all" "$directory" "$character" ];
hostname.format = "[$ssh_symbol$hostname]($style) ";
};
};
i3status-rust = {
enable = true;
bars = {
default = {
theme = "solarized-dark";
icons = "awesome";
blocks = [
{
block = "memory";
display_type = "memory";
format_mem = "{mem_used_percents}";
}
{
block = "cpu";
interval = 1;
format = "{barchart} {frequency}";
}
{
block = "load";
interval = 1;
format = "{1m}";
}
{
block = "battery";
hide_missing = true;
format = "{time} ({percentage})";
}
{
block = "time";
interval = 60;
format = "%a %d.%m %R";
}
];
};
};
};
home-manager.enable = true;
};
xsession.windowManager.i3 = {
enable = true;
config = {
modifier = "Mod4";
terminal = "${pkgs.kitty}/bin/kitty";
fonts = {
names = [ "DejaVu Sans Mono" ];
size = 12.0;
};
window = {
titlebar = false;
border = 0;
};
floating = {
titlebar = false;
border = 0;
};
bars = [{
mode = "hide";
position = "top";
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml";
fonts = {
names = [ "DejaVu Sans Mono" ];
size = 12.0;
};
}];
};
};
imports = [
home-manager/fzf.nix
home-manager/git.nix
home-manager/kitty.nix
home-manager/neovim
home-manager/gpg
home-manager/tmux.nix
home-manager/zsh.nix
home-manager/starship.nix
home-manager/i3.nix
home-manager/i3status-rust.nix
];
}

1
nvim/.gitignore vendored
View file

@ -1 +0,0 @@
/plugin/