Compare commits

...

3 commits

9 changed files with 209 additions and 11 deletions

View file

@ -1 +0,0 @@
Опции для конфигурации устройства.

View file

@ -18,20 +18,20 @@ in
battery.enable = lib.mkOption {
type = lib.types.bool;
default = true;
default = false;
description = "Battery configuration for the laptop.";
};
bluetooth.enable = lib.mkOption {
type = lib.types.bool;
default = true;
default = false;
description = "Bluetooth configuration for the laptop.";
};
cpu = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
default = false;
description = "CPU configuration for the laptop.";
};
type = lib.mkOption {
@ -42,11 +42,13 @@ in
default = "intel";
description = "Laptop CPU type.";
};
# FIXME: Additional imports for devices config:
# inputs.nixos-hardware.nixosModules.common-cpu-intel
};
sound.enable = lib.mkOption {
type = lib.types.bool;
default = true;
default = false;
description = "Sound configuration for the laptop.";
};
};

198
options/home/dev.nix Normal file
View file

@ -0,0 +1,198 @@
{
lib,
pkgs,
config,
...
}:
let
cfg = config.home.dev;
in
{
options = {
home.dev = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Development settings.";
};
additionalDevPackages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
description = "Development additional packages: cli/tui/utils";
};
git = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Git settings.";
};
userName = lib.mkOption {
type = lib.types.str;
default = config.home.username;
description = "Git user name.";
};
userEmail = lib.mkOption {
type = lib.types.str;
default = "";
description = "Git user email.";
};
};
python = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Python base settings & packages.";
};
packages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [
pkgs.python314
pkgs.uv
];
description = "List of user python packages.";
};
};
rust = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Rust base settings & packages.";
};
packages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [
pkgs.gcc
pkgs.cargo
pkgs.rustc
];
description = "List of user rust packages.";
};
};
terminal = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Terminal settings & other stuff.";
};
shell = lib.mkOption {
type = lib.types.str;
default = if cfg.terminal.zsh.enable then "zsh" else "bash";
description = "Change standart shell for kitty";
};
aliases = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = {
gc = "sudo nix-collect-garbage -d";
dev = "nix develop --command ${cfg.terminal.shell}";
"..." = "cd ../..";
};
description = "Terminal aliases.";
};
kitty.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Configure kitty - terminal emulator.";
};
zsh = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Configure zsh - terminal shell.";
};
oh-my-zsh = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Configure oh-my-zsh.";
};
plugins = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = "Plugins for oh-my-zsh";
};
};
};
};
};
};
config = lib.mkIf cfg.enable {
programs.git = lib.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";
};
extraConfig = {
init = {
defaultbranch = "main";
};
branch = {
soft = "-committerdate";
};
pull.rebase = true;
};
};
programs.kitty = lib.mkIf cfg.terminal.kitty.enable {
enable = true;
package = pkgs.kitty;
shellIntegration = lib.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 = lib.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 = lib.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
++ lib.optionals cfg.python.enable cfg.python.packages
++ lib.optionals cfg.rust.enable cfg.rust.packages;
};
}

View file

@ -1 +0,0 @@
Опции для конфигурации хоста (системы).

View file

@ -12,7 +12,7 @@ in
host.locale = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
default = false;
description = "Basic locale settings.";
};

View file

@ -12,7 +12,7 @@ in
host.nix = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
default = false;
description = "Nix settings for host.";
};
optimization.enable = lib.mkOption {

View file

@ -12,7 +12,7 @@ in
host.polkit = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
default = false;
description = "Polkit configurations for host.";
};
};

View file

@ -23,7 +23,7 @@ in
powerProfiles.enable = lib.mkOption {
type = lib.types.bool;
default = !config.device.battery.enable;
default = !config.device.laptop.battery.enable;
description = "Power Profiles Daemon configurations for host.";
};
};

View file

@ -7,7 +7,7 @@ in
host.xserver = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
default = false;
description = "Xserver configurations for host.";
};
};