home-manager: modularize home configurations

This commit is contained in:
xinyangli 2023-12-24 18:53:47 +08:00
parent ac9918c759
commit 552cc4f144
16 changed files with 261 additions and 227 deletions

View file

@ -0,0 +1,31 @@
{ config, lib, ... }:
with lib;
let
cfg = config.custom-hm.alacritty;
in
{
options.custom-hm.alacritty = {
enable = mkEnableOption "alacritty";
};
config = mkIf cfg.enable {
programs.alacritty = {
enable = true;
settings = {
shell = {
program = config.programs.zellij.package + "/bin/zellij";
args = [
"attach"
"-c"
];
};
font.size = 10.0;
window = {
resize_increments = true;
dynamic_padding = true;
};
};
};
};
}

View file

@ -1,10 +1,12 @@
{ config, pkgs, ... }:
{
imports = [
./alacritty.nix
./direnv.nix
./fish.nix
./git.nix
./tmux.nix
./vim.nix
./vscode.nix
./zellij.nix
];
}

View file

@ -0,0 +1,18 @@
{ config, lib, ... }:
with lib;
let
cfg = config.custom-hm.direnv;
in
{
options.custom-hm.direnv = {
enable = mkEnableOption "direnv";
};
config = {
programs = mkIf config.custom-hm.direnv.enable {
direnv = {
enable = true;
};
};
};
}

View file

@ -6,7 +6,7 @@ let
cfg = config.custom-hm.fish;
in
{
options = {
options.custom-hm.fish = {
enable = mkEnableOption "fish";
plugins = mkOption {
type = types.listOf types.str;
@ -30,9 +30,9 @@ in
programs.fish = mkIf cfg.enable {
enable = true;
plugins = with pkgs; filter (
e: hasAttr e.name builtins.listToAttrs # { "xxx" = true; }
e: hasAttr e.name (builtins.listToAttrs # { "xxx" = true; }
(map (p: { name = p; value = true; }) cfg.plugins) # { name = "xxx"; value = true; }
) [
)) [
{
name = "pisces";
src = fishPlugins.pisces.src;

View file

@ -6,7 +6,7 @@ let
cfg = config.custom-hm.git;
in
{
options = {
options.custom-hm.git = {
enable = mkEnableOption "Enable git configuration";
};
config = {

View file

@ -6,7 +6,7 @@ let
cfg = config.custom-hm.neovim;
in
{
options = {
options.custom-hm.neovim = {
enable = mkEnableOption "neovim configurations";
};
config = mkIf cfg.enable {

View file

@ -0,0 +1,146 @@
{ inputs, config, lib, pkgs, ... }:
with lib;
let
cfg = config.custom-hm.vscode;
in
{
options.custom-hm.vscode = {
enable = mkEnableOption "Vscode config";
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
pkgs.wl-clipboard-x11
];
programs.vscode = {
enable = true;
enableUpdateCheck = false;
enableExtensionUpdateCheck = false;
mutableExtensionsDir = false;
extensions = (with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [
mkhl.direnv
bbenoist.nix
ms-azuretools.vscode-docker
ms-vscode-remote.remote-ssh
vscodevim.vim
github.vscode-pull-request-github
eamodio.gitlens
gruntfuggly.todo-tree # todo highlight
# Language support
# Python
ms-python.python
# Markdown
davidanson.vscode-markdownlint
# C/C++
ms-vscode.cmake-tools
llvm-vs-code-extensions.vscode-clangd
# Nix
jnoortheen.nix-ide
# Latex
james-yu.latex-workshop
# Vue
vue.volar
# Scale / chisel
scalameta.metals
sterben.fpga-support
ms-vscode-remote.remote-ssh-edit
mushan.vscode-paste-image
]) ++ (with pkgs.vscode-extensions; [
catppuccin.catppuccin-vsc
# Rust
rust-lang.rust-analyzer
github.copilot
]);
userSettings = {
"workbench.colorTheme" = "Catppuccin Macchiato";
"terminal.integrated.sendKeybindingsToShell" = true;
"extensions.ignoreRecommendations" = true;
"files.autoSave" = "afterDelay";
"editor.inlineSuggest.enabled" = true;
"editor.rulers" = [
80
];
"editor.mouseWheelZoom" = true;
"git.autofetch" = true;
"window.zoomLevel" = -1;
"nix.enableLanguageServer" = true;
"latex-workshop.latex.autoBuild.run" = "never";
"latex-workshop.latex.tools" = [
{
"name" = "xelatex";
"command" = "xelatex";
"args" = [
"-synctex=1"
"-interaction=nonstopmode"
"-file-line-error"
"-pdf"
"%DOCFILE%"
];
}
{
"name" = "pdflatex";
"command" = "pdflatex";
"args" = [
"-synctex=1"
"-interaction=nonstopmode"
"-file-line-error"
"%DOCFILE%"
];
}
{
"name" = "bibtex";
"command" = "bibtex";
"args" = [
"%DOCFILE%"
];
}
];
"latex-workshop.latex.recipes" = [
{
"name" = "xelatex";
"tools" = [
"xelatex"
];
}
{
"name" = "pdflatex";
"tools" = [
"pdflatex"
];
}
{
"name" = "xe->bib->xe->xe";
"tools" = [
"xelatex"
"bibtex"
"xelatex"
"xelatex"
];
}
{
"name" = "pdf->bib->pdf->pdf";
"tools" = [
"pdflatex"
"bibtex"
"pdflatex"
"pdflatex"
];
}
];
"[latex]" = {
"editor.formatOnPaste" = false;
"editor.suggestSelection" = "recentlyusedbyprefix";
"editor.wordWrap" = "bounded";
"editor.wordWrapColumn" = 80;
"editor.unicodeHighlight.ambiguousCharacters" = false;
};
};
};
};
}

View file

@ -6,7 +6,7 @@ let
cfg = config.custom-hm.zellij;
in
{
options = {
options.custom-hm.zellij = {
enable = mkEnableOption "zellij configurations";
};
config = {
@ -21,19 +21,6 @@ in
];
};
theme = "catppuccin-macchiato";
themes.dracula = {
fg = [ 248 248 242 ];
bg = [ 40 42 54 ];
black = [ 0 0 0 ];
red = [ 255 85 85 ];
green = [ 80 250 123 ];
yellow = [ 241 250 140 ];
blue = [ 98 114 164 ];
magenta = [ 255 121 198 ];
cyan = [ 139 233 253 ];
white = [ 255 255 255 ];
orange = [ 255 184 108 ];
};
};
};
};