big refactor into modules

This commit is contained in:
Ivan Dimitrov 2023-08-09 23:10:48 +03:00
parent 15339d8355
commit d9afa8cc61
22 changed files with 244 additions and 186 deletions

View File

@ -19,7 +19,7 @@
}; };
homeConfigurations = { homeConfigurations = {
ivand = home-manager.lib.homeManagerConfiguration { ivand = home-manager.lib.homeManagerConfiguration {
modules = [ ./home/laptop.nix nix-doom-emacs.hmModule ]; modules = [ ./home/laptop nix-doom-emacs.hmModule ];
pkgs = import nixpkgs { system = "x86_64-linux"; }; pkgs = import nixpkgs { system = "x86_64-linux"; };
}; };
}; };

View File

@ -1,186 +1,5 @@
{ pkgs, lib, ... }: { { config, lib, pkgs, ... }:
home = {
username = "ivand"; {
homeDirectory = "/home/ivand";
stateVersion = "23.05";
sessionPath = [ "$HOME/.local/bin/" "$HOME/.local/share/pnpm" ];
pointerCursor = {
name = "Bibata-Modern-Amber";
package = pkgs.bibata-cursors;
};
file = {
".local/bin/ec" = {
text = ''
#!/usr/bin/env bash
emacsclient -c -a 'emacs'
'';
executable = true;
};
};
packages = with pkgs; [
bemenu
brave
direnv
gopass
gopass-jsonapi
pavucontrol
nixfmt
sqlite
ripgrep
];
};
programs = {
home-manager = { enable = true; };
git = {
enable = true;
userName = "Ivan Dimitrov";
userEmail = "ivan@idimitrov.dev";
extraConfig = {
color.ui = "auto";
pull.rebase = true;
};
};
kitty = {
enable = true;
settings = {
enable_tab_bar = false;
background_opacity = "0.96";
};
};
tmux = {
enable = true;
clock24 = true;
plugins = with pkgs.tmuxPlugins; [ tilish catppuccin ];
extraConfig = ''
set -g default-command "''${SHELL}"
set -g default-terminal "tmux-256color"
set -g base-index 1
set -s escape-time 0
'';
};
swaylock = {
enable = true;
settings = {
color = "000000";
line-color = "ffffff";
show-failed-attempts = true;
};
};
neovim = {
enable = true;
viAlias = true;
extraPackages = with pkgs; [
alejandra
black
go
gopls
libclang
lua
lua-language-server
nodePackages_latest.prettier
nodePackages_latest.typescript
nodePackages_latest.typescript-language-server
nodePackages_latest."@tailwindcss/language-server"
nodePackages_latest."@prisma/language-server"
python311Packages.python-lsp-black
python311Packages.python-lsp-server
ripgrep
rnix-lsp
stylua
];
plugins = with pkgs.vimPlugins; [
nvim-surround
nvim-ts-autotag
vim-prisma
autoclose-nvim
barbar-nvim
cmp-nvim-lsp
comment-nvim
gitsigns-nvim
luasnip
nightfox-nvim
nvim-cmp
nvim-lspconfig
nvim-treesitter.withAllGrammars
nvim-web-devicons
plenary-nvim
telescope-nvim
telescope-nvim
toggleterm-nvim
vim-vinegar
];
extraLuaConfig = lib.fileContents ./cfg/nvim/init.lua;
};
doom-emacs = {
enable = true;
doomPrivateDir = ./cfg/doom.d;
};
zsh = {
enable = true;
syntaxHighlighting.enable = true;
enableAutosuggestions = true;
loginExtra = ''
[ "$(tty)" = "/dev/tty1" ] && exec sway
'';
shellAliases = {
gad = "git add . && git diff --cached";
gac = "ga && gc";
ga = "git add .";
gc = "git commit";
dev = "nix develop --command $SHELL";
};
history = {
size = 1000;
save = 1000;
expireDuplicatesFirst = true;
};
plugins = [
{
name = "zsh-powerlevel10k";
src = "${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k";
file = "powerlevel10k.zsh-theme";
}
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = "${pkgs.zsh-nix-shell}/share/zsh-nix-shell";
}
];
initExtra = ''
source "$HOME/.p10k.zsh"
eval "$(direnv hook zsh)"
'';
};
obs-studio = {
enable = true;
plugins = with pkgs.obs-studio-plugins; [ wlrobs ];
};
};
wayland = {
windowManager.sway = {
enable = true;
config = null;
extraConfig = builtins.readFile ./cfg/sway/config;
};
};
xdg.configFile = {
"nix/nix.conf" = {
text = ''
experimental-features = nix-command flakes
'';
};
"user-dirs.dirs" = {
source = pkgs.writeText "user-dirs.dirs" ''
XDG_DESKTOP_DIR="dt"
XDG_DOCUMENTS_DIR="doc"
XDG_DOWNLOAD_DIR="dl"
XDG_MUSIC_DIR="snd"
XDG_PICTURES_DIR="pic"
XDG_PUBLICSHARE_DIR="pub"
XDG_TEMPLATES_DIR="tp"
XDG_VIDEOS_DIR="vid"
'';
};
};
services = { emacs = { enable = true; }; };
} }

5
home/laptop/default.nix Normal file
View File

@ -0,0 +1,5 @@
{ ... }: {
imports = [
./home.nix
];
}

51
home/laptop/home.nix Normal file
View File

@ -0,0 +1,51 @@
{ pkgs, lib, ... }: {
imports = [ ./programs ./packages ];
home = {
username = "ivand";
homeDirectory = "/home/ivand";
stateVersion = "23.05";
sessionPath = [ "$HOME/.local/bin/" "$HOME/.local/share/pnpm" ];
pointerCursor = {
name = "Bibata-Modern-Amber";
package = pkgs.bibata-cursors;
};
file = {
".local/bin/ec" = {
text = ''
#!/usr/bin/env bash
emacsclient -c -a 'emacs'
'';
executable = true;
};
};
};
programs.home-manager = { enable = true; };
wayland = {
windowManager.sway = {
enable = true;
config = null;
extraConfig = builtins.readFile ../cfg/sway/config;
};
};
xdg.configFile = {
"nix/nix.conf" = {
text = ''
experimental-features = nix-command flakes
'';
};
"user-dirs.dirs" = {
source = pkgs.writeText "user-dirs.dirs" ''
XDG_DESKTOP_DIR="dt"
XDG_DOCUMENTS_DIR="doc"
XDG_DOWNLOAD_DIR="dl"
XDG_MUSIC_DIR="snd"
XDG_PICTURES_DIR="pic"
XDG_PUBLICSHARE_DIR="pub"
XDG_TEMPLATES_DIR="tp"
XDG_VIDEOS_DIR="vid"
'';
};
};
services = { emacs = { enable = true; }; };
}

View File

@ -0,0 +1,13 @@
{ pkgs, ... }: {
home.packages = with pkgs; [
bemenu
brave
direnv
gopass
gopass-jsonapi
pavucontrol
nixfmt
sqlite
ripgrep
];
}

View File

@ -0,0 +1,3 @@
{ ... }: {
imports = [ ./neovim ./doom-emacs ./git.nix ./tmux.nix ./kitty.nix ./swaylock.nix ./zsh.nix ./obs.nix ];
}

View File

@ -0,0 +1,5 @@
{ ... }: {
imports = [
./doom.nix
];
}

View File

@ -0,0 +1,9 @@
;;; config.el --- the emacs config
;;; Commentary:
;;; Code:
(setq doom-theme 'doom-tokyo-night)
(use-package! lsp-tailwindcss)
;;; config.el ends here

View File

@ -0,0 +1,8 @@
;;; packages.el --- a list of packages
;;; Commentary:
;;; Code:
(package! lsp-tailwindcss :recipe (:host github :repo "merrickluo/lsp-tailwindcss"))
;;; packages.el ends here

View File

@ -0,0 +1,6 @@
{ pkgs, lib, ... }: {
programs.doom-emacs = {
enable = true;
doomPrivateDir = ./doom.d;
};
}

View File

@ -0,0 +1,11 @@
{ pkgs, lib, ... }: {
programs.git = {
enable = true;
userName = "Ivan Dimitrov";
userEmail = "ivan@idimitrov.dev";
extraConfig = {
color.ui = "auto";
pull.rebase = true;
};
};
}

View File

@ -0,0 +1,9 @@
{ pkgs, lib, ... }: {
programs.kitty = {
enable = true;
settings = {
enable_tab_bar = false;
background_opacity = "0.96";
};
};
}

View File

@ -0,0 +1,5 @@
{ ... }: {
imports = [
./neovim.nix
];
}

View File

@ -0,0 +1,47 @@
{ pkgs, lib, ... }: {
programs.neovim = {
enable = true;
viAlias = true;
extraPackages = with pkgs; [
alejandra
black
go
gopls
libclang
lua
lua-language-server
nodePackages_latest.prettier
nodePackages_latest.typescript
nodePackages_latest.typescript-language-server
nodePackages_latest."@tailwindcss/language-server"
nodePackages_latest."@prisma/language-server"
python311Packages.python-lsp-black
python311Packages.python-lsp-server
ripgrep
rnix-lsp
stylua
];
plugins = with pkgs.vimPlugins; [
nvim-surround
nvim-ts-autotag
vim-prisma
autoclose-nvim
barbar-nvim
cmp-nvim-lsp
comment-nvim
gitsigns-nvim
luasnip
nightfox-nvim
nvim-cmp
nvim-lspconfig
nvim-treesitter.withAllGrammars
nvim-web-devicons
plenary-nvim
telescope-nvim
telescope-nvim
toggleterm-nvim
vim-vinegar
];
extraLuaConfig = lib.fileContents ./nvim/init.lua;
};
}

View File

@ -0,0 +1,6 @@
{ pkgs, lib, ... }: {
programs.obs-studio = {
enable = true;
plugins = with pkgs.obs-studio-plugins; [ wlrobs ];
};
}

View File

@ -0,0 +1,10 @@
{ pkgs, lib, ... }: {
programs.swaylock = {
enable = true;
settings = {
color = "000000";
line-color = "ffffff";
show-failed-attempts = true;
};
};
}

View File

@ -0,0 +1,13 @@
{ pkgs, lib, ... }: {
programs.tmux = {
enable = true;
clock24 = true;
plugins = with pkgs.tmuxPlugins; [ tilish catppuccin ];
extraConfig = ''
set -g default-command "''${SHELL}"
set -g default-terminal "tmux-256color"
set -g base-index 1
set -s escape-time 0
'';
};
}

View File

@ -0,0 +1,38 @@
{ pkgs, lib, ... }: {
programs.zsh = {
enable = true;
syntaxHighlighting.enable = true;
enableAutosuggestions = true;
loginExtra = ''
[ "$(tty)" = "/dev/tty1" ] && exec sway
'';
shellAliases = {
gad = "git add . && git diff --cached";
gac = "ga && gc";
ga = "git add .";
gc = "git commit";
dev = "nix develop --command $SHELL";
};
history = {
size = 1000;
save = 1000;
expireDuplicatesFirst = true;
};
plugins = [
{
name = "zsh-powerlevel10k";
src = "${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k";
file = "powerlevel10k.zsh-theme";
}
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = "${pkgs.zsh-nix-shell}/share/zsh-nix-shell";
}
];
initExtra = ''
source "$HOME/.p10k.zsh"
eval "$(direnv hook zsh)"
'';
};
}