diff --git a/devices/thinkbook/boot.nix b/devices/thinkbook/boot.nix deleted file mode 100644 index 96cd433..0000000 --- a/devices/thinkbook/boot.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ pkgs, ... }: -{ - boot = { - kernelPackages = pkgs.linuxPackages_zen; - kernelParams = [ - "quiet" - "splash" - "boot.shell_on_fail" - "loglevel=3" - "rd.systemd.show_status=false" - "rd.udev.log_level=3" - "udev.log_priority=3" - ]; - - consoleLogLevel = 0; - initrd.verbose = false; - - loader = { - timeout = 60; - efi.canTouchEfiVariables = true; - systemd-boot.enable = true; - }; - }; -} diff --git a/devices/thinkbook/default.nix b/devices/thinkbook/default.nix index 91df91b..fcfbf69 100644 --- a/devices/thinkbook/default.nix +++ b/devices/thinkbook/default.nix @@ -1,4 +1,5 @@ { + pkgs, inputs, customFunctions, ... @@ -11,14 +12,25 @@ } ++ [ inputs.nixos-hardware.nixosModules.common-cpu-intel ]; - device.laptop = { - enable = true; - battery.enable = true; - bluetooth.enable = true; - sound.enable = true; - cpu = { - enable = true; - type = "intel"; + boot = { + kernelPackages = pkgs.linuxPackages_zen; + kernelParams = [ + "quiet" + "splash" + "boot.shell_on_fail" + "loglevel=3" + "rd.systemd.show_status=false" + "rd.udev.log_level=3" + "udev.log_priority=3" + ]; + + consoleLogLevel = 0; + initrd.verbose = false; + + loader = { + timeout = 60; + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; }; }; @@ -26,4 +38,15 @@ enable = false; memoryPercent = 100; }; + + device.laptop = { + enable = true; + battery.enable = true; + bluetooth.enable = true; + sound.enable = true; + cpu = { + enable = true; + platform = "intel"; + }; + }; } diff --git a/options/device/laptop.nix b/options/device/laptop.nix index 7625fe4..0b7328e 100644 --- a/options/device/laptop.nix +++ b/options/device/laptop.nix @@ -5,57 +5,36 @@ ... }: let + inherit (lib) mkOption mkEnableOption mkIf; + inherit (lib.types) enum; + cfg = config.device.laptop; in { - options = { - device.laptop = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Settings for the laptop."; - }; + options.device.laptop = { + enable = mkEnableOption "Settings for the laptop."; + battery.enable = mkEnableOption "Battery configuration for the laptop."; + bluetooth.enable = mkEnableOption "Bluetooth configuration for the laptop."; + sound.enable = mkEnableOption "Sound configuration for the laptop."; - battery.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Battery configuration for the laptop."; - }; + cpu = { + # FIXME: Additional imports for devices config: + # inputs.nixos-hardware.nixosModules.common-cpu-intel + enable = mkEnableOption "CPU configuration for the laptop."; - bluetooth.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Bluetooth configuration for the laptop."; - }; - - cpu = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "CPU configuration for the laptop."; - }; - type = lib.mkOption { - type = lib.types.enum [ - "intel" - "amd" - ]; - 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 = false; - description = "Sound configuration for the laptop."; + platform = mkOption { + type = enum [ + "intel" + "amd" + ]; + default = "intel"; + description = "Laptop CPU type."; }; }; }; - config = lib.mkIf cfg.enable { - services.tlp = lib.mkIf cfg.battery.enable { + config = mkIf cfg.enable { + services.tlp = mkIf cfg.battery.enable { enable = true; settings = { PLATFORM_PROFILE_ON_AC = "performance"; @@ -78,7 +57,7 @@ in }; }; - hardware.bluetooth = lib.mkIf cfg.bluetooth.enable { + hardware.bluetooth = mkIf cfg.bluetooth.enable { enable = true; powerOnBoot = false; settings = { @@ -88,26 +67,26 @@ in }; }; }; - services.blueman = lib.mkIf cfg.bluetooth.enable { + services.blueman = mkIf cfg.bluetooth.enable { enable = true; }; - services.thermald = lib.mkIf (cfg.cpu.enable && cfg.cpu.type == "intel") { + services.thermald = mkIf (cfg.cpu.enable && cfg.cpu.platform == "intel") { enable = true; package = pkgs.thermald; }; - hardware.graphics = lib.mkIf (cfg.cpu.enable && cfg.cpu.type == "intel") { + hardware.graphics = mkIf (cfg.cpu.enable && cfg.cpu.platform == "intel") { enable = true; enable32Bit = true; }; - security.rtkit = lib.mkIf cfg.sound.enable { + security.rtkit = mkIf cfg.sound.enable { enable = true; }; - services.pulseaudio = lib.mkIf cfg.sound.enable { + services.pulseaudio = mkIf cfg.sound.enable { enable = false; }; - services.pipewire = lib.mkIf cfg.sound.enable { + services.pipewire = mkIf cfg.sound.enable { enable = true; pulse.enable = true; wireplumber.enable = true; diff --git a/options/home/dev.nix b/options/home/dev.nix index f06e10a..873966f 100644 --- a/options/home/dev.nix +++ b/options/home/dev.nix @@ -5,122 +5,101 @@ ... }: let + inherit (lib) + mkIf + mkOption + optionals + mkEnableOption + ; + inherit (lib.types) + str + listOf + package + attrsOf + ; + 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"; - }; + options.home.dev = { + enable = mkEnableOption "Development settings."; + additionalDevPackages = mkOption { + type = listOf 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."; - }; + 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 = 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."; - }; + 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 = 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."; - }; + 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 = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Terminal settings & other stuff."; + }; + 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 ../.."; }; - 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"; - }; + 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 = lib.mkIf cfg.enable { - programs.git = lib.mkIf cfg.git.enable { + config = mkIf cfg.enable { + programs.git = mkIf cfg.git.enable { enable = true; package = pkgs.gitAndTools.gitFull; userName = cfg.git.userName; @@ -149,10 +128,10 @@ in }; }; - programs.kitty = lib.mkIf cfg.terminal.kitty.enable { + programs.kitty = mkIf cfg.terminal.kitty.enable { enable = true; package = pkgs.kitty; - shellIntegration = lib.mkIf (cfg.terminal.shell == "zsh") { + shellIntegration = mkIf (cfg.terminal.shell == "zsh") { enableZshIntegration = true; }; settings = { @@ -168,7 +147,7 @@ in }; }; - programs.zsh = lib.mkIf cfg.terminal.zsh.enable { + programs.zsh = mkIf cfg.terminal.zsh.enable { enable = true; package = pkgs.zsh; autocd = true; @@ -181,7 +160,7 @@ in size = 10000; save = 10000; }; - oh-my-zsh = lib.mkIf cfg.terminal.zsh.oh-my-zsh.enable { + oh-my-zsh = mkIf cfg.terminal.zsh.oh-my-zsh.enable { enable = true; plugins = cfg.terminal.zsh.oh-my-zsh.plugins; }; @@ -193,7 +172,7 @@ in home.packages = cfg.additionalDevPackages - ++ lib.optionals cfg.python.enable cfg.python.packages - ++ lib.optionals cfg.rust.enable cfg.rust.packages; + ++ optionals cfg.python.enable cfg.python.packages + ++ optionals cfg.rust.enable cfg.rust.packages; }; } diff --git a/options/home/editors/default.nix b/options/home/editors/default.nix index 401639f..80a686a 100644 --- a/options/home/editors/default.nix +++ b/options/home/editors/default.nix @@ -4,14 +4,12 @@ ... }: let + inherit (lib) mkEnableOption; + cfg = config.home.editors; in { options.home.editors = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Text, media & audio editors configurations."; - }; + enable = mkEnableOption "Text, media & audio editors configurations."; }; } diff --git a/options/home/editors/helix.nix b/options/home/editors/helix.nix index d438482..ffc07bb 100644 --- a/options/home/editors/helix.nix +++ b/options/home/editors/helix.nix @@ -6,54 +6,39 @@ ... }: let + inherit (lib) + mkIf + mkOption + optional + optionals + mkEnableOption + ; + inherit (lib.types) str attrs; + cfg = config.home.editors; in { options.home.editors.helix = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Helix - text editor."; - }; - defaultEditor = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Make Helix default editor."; - }; - systemArch = lib.mkOption { - type = lib.types.str; + enable = mkEnableOption "Helix - text editor."; + defaultEditor = mkEnableOption "Make Helix default editor."; + systemArch = mkOption { + type = str; default = pkgs.system; description = "System arch for Helix flake package."; }; - keys = lib.mkOption { - type = lib.types.attrs; + keys = mkOption { + type = attrs; default = { }; description = "Hot keys in Helix editor."; }; - nix.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Nix lang support in Helix."; - }; - python.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Python lang support in Helix."; - }; - rust.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Rust lang support in Helix."; - }; - json.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "JSON support in Helix."; - }; + nix.enable = mkEnableOption "Nix lang support in Helix."; + python.enable = mkEnableOption "Python lang support in Helix."; + rust.enable = mkEnableOption "Rust lang support in Helix."; + json.enable = mkEnableOption "JSON support in Helix."; }; - config = lib.mkIf cfg.enable { - programs.helix = lib.mkIf cfg.helix.enable { + config = mkIf cfg.enable { + programs.helix = mkIf cfg.helix.enable { enable = true; defaultEditor = cfg.helix.defaultEditor; package = inputs.helix.packages.${cfg.helix.systemArch}.helix; @@ -99,16 +84,16 @@ in ignores = [ ".git/" ] - ++ lib.optionals cfg.helix.python.enable [ + ++ optionals cfg.helix.python.enable [ "__pycache__/" ".ruff_cache/" ".venv/" ] - ++ lib.optionals cfg.helix.rust.enable [ + ++ optionals cfg.helix.rust.enable [ "target/" ]; languages.language = - lib.optional cfg.helix.nix.enable { + optional cfg.helix.nix.enable { name = "nix"; file-types = [ "nix" ]; auto-format = true; @@ -121,7 +106,7 @@ in formatter.command = "${pkgs.nixfmt-rfc-style}/bin/nixfmt"; language-servers = [ "nixd" ]; } - ++ lib.optional cfg.helix.rust.enable { + ++ optional cfg.helix.rust.enable { name = "rust"; file-types = [ "rs" ]; auto-format = true; @@ -134,7 +119,7 @@ in formatter.command = "${pkgs.rustfmt}/bin/rustfmt"; language-servers = [ "rust-analyzer" ]; } - ++ lib.optional cfg.helix.python.enable { + ++ optional cfg.helix.python.enable { name = "python"; file-types = [ "py" ]; auto-format = true; @@ -154,7 +139,7 @@ in ]; }; } - ++ lib.optional cfg.helix.json.enable { + ++ optional cfg.helix.json.enable { name = "json"; auto-format = true; @@ -163,13 +148,13 @@ in formatter.command = "${pkgs.vscode-langservers-extracted}/bin/vscode-json-language-server"; }; languages.language-server = { - nixd = lib.mkIf cfg.helix.nix.enable { + nixd = mkIf cfg.helix.nix.enable { command = "${pkgs.nixd}/bin/nixd"; }; - rust-analyzer = lib.mkIf cfg.helix.rust.enable { + rust-analyzer = mkIf cfg.helix.rust.enable { command = "${pkgs.rust-analyzer}/bin/rust-analyzer"; }; - ruff = lib.mkIf cfg.helix.python.enable { + ruff = mkIf cfg.helix.python.enable { command = "${pkgs.ruff}/bin/ruff"; args = [ "server" ]; config.settings = { @@ -177,7 +162,7 @@ in logLevel = "debug"; }; }; - vscode-json = lib.mkIf cfg.helix.json.enable { + vscode-json = mkIf cfg.helix.json.enable { command = "${pkgs.vscode-langservers-extracted}/bin/vscode-json-language-server"; }; }; diff --git a/options/home/editors/vscodium.nix b/options/home/editors/vscodium.nix index 0bc5c7b..323ce86 100644 --- a/options/home/editors/vscodium.nix +++ b/options/home/editors/vscodium.nix @@ -5,69 +5,55 @@ ... }: let + inherit (lib) + mkIf + mkOption + optionals + mkEnableOption + ; + inherit (lib.types) + str + int + attrs + listOf + package + ; + cfg = config.home.editors; in { options.home.editors.vscodium = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "VSCodium - code editor."; - }; - terminalShell = lib.mkOption { - type = lib.types.str; + enable = mkEnableOption "VSCodium - code editor."; + terminalShell = mkOption { + type = str; default = "bash"; description = "VSCodium terminal shell."; }; - zoomLevel = lib.mkOption { - type = lib.types.int; + zoomLevel = mkOption { + type = int; default = 0; description = "VSCodium window zoom level."; }; - additionalExtensions = lib.mkOption { - type = lib.types.listOf lib.types.package; + additionalExtensions = mkOption { + type = listOf package; default = [ ]; description = "VSCodium additional extension packages"; }; - minimalUI.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "VSCodium minimal UI configuration."; - }; - keys = lib.mkOption { - type = lib.types.listOf lib.types.attrs; + minimalUI.enable = mkEnableOption "VSCodium minimal UI configuration."; + keys = mkOption { + type = listOf attrs; default = [ ]; description = "Hot keys in VSCodium."; }; - nix.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Nix lang support in VSCodium."; - }; - python.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Python lang support in VSCodium."; - }; - rust.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Rust lang support in VSCodium."; - }; - toml.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "TOML support in VSCodium."; - }; - markdown.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Markdown support in VSCodium."; - }; + nix.enable = mkEnableOption "Nix lang support in VSCodium."; + python.enable = mkEnableOption "Python lang support in VSCodium."; + rust.enable = mkEnableOption "Rust lang support in VSCodium."; + toml.enable = mkEnableOption "TOML support in VSCodium."; + markdown.enable = mkEnableOption "Markdown support in VSCodium."; }; - config = lib.mkIf cfg.enable { - programs.vscode = lib.mkIf cfg.vscodium.enable { + config = mkIf cfg.enable { + programs.vscode = mkIf cfg.vscodium.enable { enable = true; package = pkgs.vscodium; mutableExtensionsDir = false; @@ -76,7 +62,7 @@ in enableExtensionUpdateCheck = false; extensions = cfg.vscodium.additionalExtensions - ++ lib.optionals cfg.vscodium.nix.enable [ + ++ optionals cfg.vscodium.nix.enable [ pkgs.vscode-marketplace.bbenoist.nix pkgs.vscode-marketplace.jnoortheen.nix-ide pkgs.vscode-marketplace.kamadorueda.alejandra @@ -84,18 +70,18 @@ in pkgs.vscode-marketplace.arrterian.nix-env-selector pkgs.vscode-marketplace.jeff-hykin.better-nix-syntax ] - ++ lib.optionals cfg.vscodium.python.enable [ + ++ optionals cfg.vscodium.python.enable [ pkgs.vscode-marketplace.ms-python.python pkgs.vscode-marketplace.njpwerner.autodocstring pkgs.vscode-marketplace.ms-python.black-formatter ] - ++ lib.optionals cfg.vscodium.rust.enable [ + ++ optionals cfg.vscodium.rust.enable [ pkgs.vscode-marketplace.rust-lang.rust-analyzer ] - ++ lib.optionals cfg.vscodium.toml.enable [ + ++ optionals cfg.vscodium.toml.enable [ pkgs.vscode-marketplace.be5invis.toml ] - ++ lib.optionals cfg.vscodium.markdown.enable [ + ++ optionals cfg.vscodium.markdown.enable [ pkgs.vscode-marketplace.mervin.markdown-formatter ]; keybindings = cfg.vscodium.keys; @@ -106,7 +92,7 @@ in titleBarStyle = "custom"; }; - "[nix]" = lib.mkIf cfg.vscodium.nix.enable { + "[nix]" = mkIf cfg.vscodium.nix.enable { editor = { formatOnSave = true; formatOnPaste = false; @@ -115,11 +101,11 @@ in defaultFormatter = "brettm12345.nixfmt-vscode"; }; }; - nixfmt = lib.mkIf cfg.vscodium.nix.enable { + nixfmt = mkIf cfg.vscodium.nix.enable { path = "${pkgs.nixfmt-rfc-style}/bin/nixfmt"; }; - "[python]" = lib.mkIf cfg.vscodium.python.enable { + "[python]" = mkIf cfg.vscodium.python.enable { editor = { formatOnSave = true; formatOnPaste = true; @@ -134,12 +120,12 @@ in }; }; }; - black-formatter = lib.mkIf cfg.vscodium.python.enable { + black-formatter = mkIf cfg.vscodium.python.enable { args = [ "--line-length=70" ]; }; - files = lib.mkIf cfg.vscodium.python.enable { + files = mkIf cfg.vscodium.python.enable { exclude = { "**/.venv" = true; "**/__pycache__" = true; @@ -147,7 +133,7 @@ in autoSave = "off"; }; - "[rust]" = lib.mkIf cfg.vscodium.rust.enable { + "[rust]" = mkIf cfg.vscodium.rust.enable { editor = { formatOnSave = true; formatOnPaste = true; @@ -159,7 +145,7 @@ in }; }; - "[markdown]" = lib.mkIf cfg.vscodium.markdown.enable { + "[markdown]" = mkIf cfg.vscodium.markdown.enable { formatOnSave = true; formatOnPaste = true; formatOnType = false; @@ -179,13 +165,13 @@ in editor.defaultFormatter = "mervin.markdown-formatter"; }; - explorer = lib.mkIf cfg.vscodium.minimalUI.enable { + explorer = mkIf cfg.vscodium.minimalUI.enable { confirmDelete = false; confirmDragAndDrop = false; confirmPasteNative = false; }; - workbench = lib.mkIf cfg.vscodium.minimalUI.enable { + workbench = mkIf cfg.vscodium.minimalUI.enable { startupEditor = "none"; sideBar.location = "right"; @@ -199,17 +185,17 @@ in editor.rulers = [ 100 ]; }; - editor = lib.mkIf cfg.vscodium.minimalUI.enable { + editor = mkIf cfg.vscodium.minimalUI.enable { minimap.enabled = false; unicodeHighlight.allowedLocales = { ru = true; }; }; - chat = lib.mkIf cfg.vscodium.minimalUI.enable { + chat = mkIf cfg.vscodium.minimalUI.enable { commandCenter.enabled = false; }; - breadcrumbs = lib.mkIf cfg.vscodium.minimalUI.enable { + breadcrumbs = mkIf cfg.vscodium.minimalUI.enable { enabled = false; }; }; diff --git a/options/home/security.nix b/options/home/security.nix index 151c0ac..265abb3 100644 --- a/options/home/security.nix +++ b/options/home/security.nix @@ -5,45 +5,34 @@ ... }: let + inherit (lib) mkIf mkOption mkEnableOption; + inherit (lib.types) str; + cfg = config.home.security; in { - options = { - home.security = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Security stuff."; + options.home.security = { + enable = mkEnableOption "Security stuff."; + gpg = { + enable = mkEnableOption "GPG configurations."; + homeDir = mkOption { + type = str; + default = "${config.home.homeDirectory}/.gpg"; + description = "GPG config directory."; }; - gpg = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "GPG configurations."; - }; - homeDir = lib.mkOption { - type = lib.types.str; - default = "${config.home.homeDirectory}/.gpg"; - description = "GPG config directory."; - }; - }; - ssh = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "SSH base configurations."; - }; - homeDir = lib.mkOption { - type = lib.types.str; - default = "${config.home.homeDirectory}/.ssh"; - description = "SSH config directory."; - }; + }; + ssh = { + enable = mkEnableOption "SSH base configurations."; + homeDir = mkOption { + type = str; + default = "${config.home.homeDirectory}/.ssh"; + description = "SSH config directory."; }; }; }; - config = lib.mkIf cfg.enable { - programs.gpg = lib.mkIf cfg.gpg.enable { + config = mkIf cfg.enable { + programs.gpg = mkIf cfg.gpg.enable { enable = true; package = pkgs.gnupg; mutableKeys = true; @@ -56,12 +45,12 @@ in keyid-format = "0xlong"; }; }; - services.gpg-agent = lib.mkIf cfg.gpg.enable { + services.gpg-agent = mkIf cfg.gpg.enable { enable = true; pinentry.package = pkgs.pinentry-qt; }; - programs.ssh = lib.mkIf cfg.ssh.enable { + programs.ssh = mkIf cfg.ssh.enable { enable = true; enableDefaultConfig = false; package = pkgs.openssh; diff --git a/options/home/theme.nix b/options/home/theme.nix index a1650f6..91dfdae 100644 --- a/options/home/theme.nix +++ b/options/home/theme.nix @@ -6,39 +6,23 @@ ... }: let + inherit (lib) mkIf mkEnableOption; + cfg = config.home.theme; in { imports = [ inputs.catppuccin.homeModules.catppuccin ]; - options = { - home.theme = { - catppuccin = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Catppuccin Theme."; - }; - kitty.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Kitty catppuccin Theme."; - }; - helix.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Helix catppuccin Theme."; - }; - vscodium.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "VSCodium catppuccin Theme."; - }; - }; + options.home.theme = { + catppuccin = { + enable = mkEnableOption "Catppuccin Theme."; + kitty.enable = mkEnableOption "Kitty catppuccin Theme."; + helix.enable = mkEnableOption "Helix catppuccin Theme."; + vscodium.enable = mkEnableOption "VSCodium catppuccin Theme."; }; }; - config = lib.mkIf cfg.catppuccin.enable { + config = mkIf cfg.catppuccin.enable { fonts.fontconfig.enable = true; home.packages = with pkgs; [ noto-fonts @@ -47,7 +31,7 @@ in nerd-fonts.jetbrains-mono ]; - programs.kitty = lib.mkIf cfg.catppuccin.kitty.enable { + programs.kitty = mkIf cfg.catppuccin.kitty.enable { themeFile = "Catppuccin-Macchiato"; settings = { cursor_trail = 3; @@ -58,12 +42,12 @@ in }; }; - catppuccin.helix = lib.mkIf cfg.catppuccin.helix.enable { + catppuccin.helix = mkIf cfg.catppuccin.helix.enable { enable = true; flavor = "macchiato"; }; - programs.vscode.profiles.default = lib.mkIf cfg.catppuccin.vscodium.enable { + programs.vscode.profiles.default = mkIf cfg.catppuccin.vscodium.enable { extensions = with pkgs.vscode-marketplace; [ catppuccin.catppuccin-vsc catppuccin.catppuccin-vsc-icons diff --git a/options/host/locale.nix b/options/host/locale.nix index c888b36..aa5a6b8 100644 --- a/options/host/locale.nix +++ b/options/host/locale.nix @@ -5,26 +5,23 @@ ... }: let + inherit (lib) mkOption mkEnableOption mkIf; + inherit (lib.types) str; + cfg = config.host.locale; in { - options = { - host.locale = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Basic locale settings."; - }; + options.host.locale = { + enable = mkEnableOption "Basic locale settings."; - timeZone = lib.mkOption { - type = lib.types.str; - default = "America/New_York"; - description = "Time Zone Locale."; - }; + timeZone = mkOption { + type = str; + default = "America/New_York"; + description = "Time Zone Locale."; }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { i18n.defaultLocale = "en_US.UTF-8"; i18n.extraLocaleSettings = { LC_ADDRESS = "en_US.UTF-8"; diff --git a/options/host/nix.nix b/options/host/nix.nix index 47ceca6..ea043eb 100644 --- a/options/host/nix.nix +++ b/options/host/nix.nix @@ -5,25 +5,17 @@ ... }: let + inherit (lib) mkEnableOption mkIf; + cfg = config.host.nix; in { - options = { - host.nix = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Nix settings for host."; - }; - optimization.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Nix store optimization."; - }; - }; + options.host.nix = { + enable = mkEnableOption "Nix settings strfor host."; + optimization.enable = mkEnableOption "Nix store optimization."; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { nix = { package = pkgs.nix; @@ -36,7 +28,7 @@ in ]; }; - optimise = lib.mkIf cfg.optimization.enable { + optimise = mkIf cfg.optimization.enable { automatic = true; }; }; diff --git a/options/host/polkit.nix b/options/host/polkit.nix index ecfc2e2..8beafde 100644 --- a/options/host/polkit.nix +++ b/options/host/polkit.nix @@ -5,20 +5,16 @@ ... }: let + inherit (lib) mkEnableOption mkIf; + cfg = config.host.polkit; in { - options = { - host.polkit = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Polkit configurations for host."; - }; - }; + options.host.polkit = { + enable = mkEnableOption "Polkit configurations for host."; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { security.polkit = { enable = true; package = pkgs.polkit; diff --git a/options/host/version.nix b/options/host/version.nix index 4dec038..7429c0f 100644 --- a/options/host/version.nix +++ b/options/host/version.nix @@ -5,15 +5,16 @@ ... }: let + inherit (lib) mkOption; + inherit (lib.types) str; + cfg = config.host.version; in { - options = { - host.version = lib.mkOption { - type = lib.types.str; - default = "25.05"; - description = "System version."; - }; + options.host.version = mkOption { + type = str; + default = "25.05"; + description = "System version."; }; config.system.stateVersion = cfg; diff --git a/options/host/window_managers.nix b/options/host/window_managers.nix index b3d1082..4ee71f2 100644 --- a/options/host/window_managers.nix +++ b/options/host/window_managers.nix @@ -5,31 +5,24 @@ ... }: let + inherit (lib) mkOption mkEnableOption mkIf; + inherit (lib.types) bool; + cfg = config.host.window_managers.kde; in { - options = { - host.window_managers.kde = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "KDE Clear configurations for host."; - }; - sddm.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "SDDM configurations for host."; - }; + options.host.window_managers.kde = { + enable = mkEnableOption "KDE Clear configurations for host."; + sddm.enable = mkEnableOption "SDDM configurations for host."; - powerProfiles.enable = lib.mkOption { - type = lib.types.bool; - default = !config.device.laptop.battery.enable; - description = "Power Profiles Daemon configurations for host."; - }; + powerProfiles.enable = mkOption { + type = bool; + default = !config.device.laptop.battery.enable; + description = "Power Profiles Daemon configurations for host."; }; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.desktopManager.plasma6.enable = true; environment.plasma6.excludePackages = with pkgs.kdePackages; [ @@ -48,7 +41,7 @@ in services.power-profiles-daemon.enable = cfg.powerProfiles.enable; - services.displayManager.sddm = lib.mkIf cfg.sddm.enable { + services.displayManager.sddm = mkIf cfg.sddm.enable { enable = true; wayland.enable = true; }; diff --git a/options/host/xserver.nix b/options/host/xserver.nix index d31f685..4f76e6a 100644 --- a/options/host/xserver.nix +++ b/options/host/xserver.nix @@ -1,19 +1,15 @@ { lib, config, ... }: let + inherit (lib) mkEnableOption mkIf; + cfg = config.host.xserver; in { - options = { - host.xserver = { - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Xserver configurations for host."; - }; - }; + options.host.xserver = { + enable = mkEnableOption "Xserver configurations for host."; }; - config = lib.mkIf cfg.enable { + config = mkIf cfg.enable { services.xserver = { enable = true; xkb = { diff --git a/users/geekiot/data/default.nix b/users/geekiot/data/default.nix index 603b2d1..f082f38 100644 --- a/users/geekiot/data/default.nix +++ b/users/geekiot/data/default.nix @@ -6,37 +6,34 @@ }: let homeDir = "/home/${userName}"; - projectsDir = "${homeDir}/NewProjects"; configDir = "${projectsDir}/nixos-config"; - sopsSubmoduleDir = "${configDir}/secrets-nixos"; - securityDir = "${homeDir}/.security"; - gpgDir = "${securityDir}/gpg"; - sopsKeyFile = "${securityDir}/sops/age/keys.txt"; in { - info = { - inherit userName; + user = { + name = userName; email = "geekiot@proton.me"; }; paths = { - inherit - homeDir - - gpgDir - - configDir - sopsSubmoduleDir - sopsKeyFile - ; - - sshDir = "${homeDir}/.ssh"; + homeDir = homeDir; + projectsDir = projectsDir; downloadsDir = "${homeDir}/Downloads"; + + configDir = configDir; + sopsDir = "${configDir}/secrets-nixos"; + + securityDir = securityDir; + sshDir = "${homeDir}/.ssh"; + gpgDir = "${securityDir}/gpg"; + sopsKeyFile = "${securityDir}/sops/age/keys.txt"; + }; device = { - inherit deviceName hostName systemArch; + name = deviceName; + hostName = hostName; + systemArch = systemArch; }; } diff --git a/users/geekiot/home/default.nix b/users/geekiot/home/default.nix index 0e91425..54eb8b4 100644 --- a/users/geekiot/home/default.nix +++ b/users/geekiot/home/default.nix @@ -6,14 +6,15 @@ ... }: let - userName = userData.info.userName; - userEmail = userData.info.email; - homeDirectory = userData.paths.homeDir; + userName = userData.user.name; + userEmail = userData.user.email; + homeDirectory = userData.paths.homeDir; gpgDir = userData.paths.gpgDir; configDir = userData.paths.configDir; - sopsDir = userData.paths.sopsSubmoduleDir; + sopsDir = userData.paths.sopsDir; + scripts = userScripts pkgs; rebuild = scripts.rebuidWithSopsSubmodule configDir sopsDir; in @@ -31,7 +32,7 @@ in username = userName; stateVersion = "25.05"; sessionVariables = { - CONFIG = userData.paths.configDir; + CONFIG = configDir; }; packages = with pkgs; [ logseq diff --git a/users/geekiot/home/librewolf/settings.nix b/users/geekiot/home/librewolf/settings.nix index 6455c12..8f1429f 100644 --- a/users/geekiot/home/librewolf/settings.nix +++ b/users/geekiot/home/librewolf/settings.nix @@ -1,7 +1,10 @@ { userData, ... }: +let + downloadsDir = userData.paths.downloadsDir; +in { programs.librewolf.profiles.geekiot.settings = { - "browser.download.dir" = userData.paths.downloadsDir; + "browser.download.dir" = downloadsDir; "network.proxy.no_proxies_on" = "habr.com, hostvds.com, vk.com, telegram.org"; "privacy.clearOnShutdown_v2.cookiesAndStorage" = true; "privacy.clearOnShutdown_v2.formdata" = true; diff --git a/users/geekiot/host/users.nix b/users/geekiot/host/users.nix index 84daa00..22e4d4e 100644 --- a/users/geekiot/host/users.nix +++ b/users/geekiot/host/users.nix @@ -1,6 +1,6 @@ { pkgs, userData, ... }: let - name = userData.info.userName; + name = userData.user.name; home = userData.paths.homeDir; in { diff --git a/users/template/data/default.nix b/users/template/data/default.nix index b5a5c02..cbab2e7 100644 --- a/users/template/data/default.nix +++ b/users/template/data/default.nix @@ -8,8 +8,8 @@ let homeDir = "/home/${userName}"; in { - info = { - inherit userName; + user = { + name = userName; email = "..."; }; @@ -18,6 +18,8 @@ in }; device = { - inherit deviceName hostName systemArch; + name = deviceName; + hostName = hostName; + systemArch = systemArch; }; } diff --git a/users/template/home/default.nix b/users/template/home/default.nix index ca745c9..d6ce947 100644 --- a/users/template/home/default.nix +++ b/users/template/home/default.nix @@ -1,6 +1,6 @@ { userData, customFunctions, ... }: let - userName = userData.info.userName; + userName = userData.user.name; homeDirectory = userData.paths.homeDir; in { diff --git a/users/template/host/default.nix b/users/template/host/default.nix index 64eecb3..da3997d 100644 --- a/users/template/host/default.nix +++ b/users/template/host/default.nix @@ -1,6 +1,6 @@ { userData, customFunctions, ... }: let - name = userData.info.userName; + name = userData.user.name; home = userData.paths.homeDir; in {