This repository has been archived on 2025-10-08. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
nixos-config/options/home/dev.nix

178 lines
4.2 KiB
Nix

{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
mkIf
mkOption
optionals
mkEnableOption
;
inherit (lib.types)
str
listOf
package
attrsOf
;
cfg = config.home.dev;
in
{
options.home.dev = {
enable = mkEnableOption "Development settings.";
additionalDevPackages = mkOption {
type = listOf package;
default = [ ];
description = "Development additional packages: cli/tui/utils";
};
git = {
enable = mkEnableOption "Git settings.";
userName = mkOption {
type = str;
default = config.home.username;
description = "Git user name.";
};
userEmail = mkOption {
type = str;
default = "";
description = "Git user email.";
};
};
python = {
enable = mkEnableOption "Python base settings & packages.";
packages = mkOption {
type = listOf package;
default = [
pkgs.python314
pkgs.uv
];
description = "List of user python packages.";
};
};
rust = {
enable = mkEnableOption "Rust base settings & packages.";
packages = mkOption {
type = listOf package;
default = [
pkgs.gcc
pkgs.cargo
pkgs.rustc
];
description = "List of user rust packages.";
};
};
terminal = {
enable = mkEnableOption "Terminal settings & other stuff.";
shell = mkOption {
type = str;
default = if cfg.terminal.zsh.enable then "zsh" else "bash";
description = "Change standart shell for kitty";
};
aliases = mkOption {
type = attrsOf str;
default = {
gc = "sudo nix-collect-garbage -d";
dev = "nix develop --command ${cfg.terminal.shell}";
"..." = "cd ../..";
};
description = "Terminal aliases.";
};
kitty.enable = mkEnableOption "Configure kitty - terminal emulator.";
zsh = {
enable = mkEnableOption "Configure zsh - terminal shell.";
oh-my-zsh = {
enable = mkEnableOption "Configure oh-my-zsh";
plugins = mkOption {
type = listOf str;
default = [ ];
description = "Plugins for oh-my-zsh";
};
};
};
};
};
config = mkIf cfg.enable {
programs.git = mkIf cfg.git.enable {
enable = true;
package = pkgs.gitAndTools.gitFull;
userName = cfg.git.userName;
userEmail = cfg.git.userEmail;
lfs.enable = true;
aliases = {
aa = "add --all";
c = "commit";
cm = "commit -m";
br = "branch";
s = "status";
uncommit = "reset --soft HEAD^";
unadd = "reset";
d = "diff";
ds = "diff --staged";
ch = "checkout";
};
extraConfig = {
init = {
defaultbranch = "main";
};
branch = {
soft = "-committerdate";
};
pull.rebase = true;
};
};
programs.kitty = mkIf cfg.terminal.kitty.enable {
enable = true;
package = pkgs.kitty;
shellIntegration = mkIf (cfg.terminal.shell == "zsh") {
enableZshIntegration = true;
};
settings = {
shell = cfg.terminal.shell;
confirm_os_window_close = 0;
enable_audio_bell = false;
scrollback_lines = 10000;
mouse_hide_wait = "-1.0";
};
keybindings = {
"ctrl+=" = "increase_font_size";
"ctrl+-" = "decrease_font_size";
};
};
programs.zsh = mkIf cfg.terminal.zsh.enable {
enable = true;
package = pkgs.zsh;
autocd = true;
autosuggestion = {
enable = true;
strategy = [ "history" ];
};
history = {
saveNoDups = true;
size = 10000;
save = 10000;
};
oh-my-zsh = mkIf cfg.terminal.zsh.oh-my-zsh.enable {
enable = true;
plugins = cfg.terminal.zsh.oh-my-zsh.plugins;
};
syntaxHighlighting = {
enable = true;
};
shellAliases = cfg.terminal.aliases;
};
home.packages =
cfg.additionalDevPackages
++ optionals cfg.python.enable cfg.python.packages
++ optionals cfg.rust.enable cfg.rust.packages;
};
}