# Custom Modules This directory contains documentation for the custom modules used in this NixOS configuration. ## Module Types The repository uses two main types of modules: 1. **NixOS Modules** - System-level configurations in `modules/nixos/` 2. **Home Manager Modules** - User-level configurations in `modules/home/` ## NixOS Modules These modules configure the system-level aspects of NixOS: - [Boot Modules](./boot.md) - Boot loader and kernel configurations - [Desktop Modules](./desktop.md) - Desktop environment configurations - [Development Modules](./development.md) - Development tools and environments - [Hardware Modules](./hardware.md) - Hardware-specific configurations - [Home Assistant Modules](./homeassistant.md) - Home automation configuration - [Networking Modules](./network.md) - Network configuration and services - [Security Modules](./security.md) - Security-related configurations - [Services Modules](./services.md) - Various service configurations - [System Modules](./system.md) - General system configurations - [Virtualization Modules](./virtualization.md) - Virtualization and containerization ## Home Manager Modules These modules configure user environments: - [Applications](./home/applications.md) - User applications - [Desktop](./home/desktop.md) - User desktop environments - [Development](./home/development.md) - User development environments - [Media](./home/media.md) - Media applications - [Shell](./home/shell.md) - Shell configurations ## Module Structure Each module follows a standard structure: ``` modules/nixos/example-module/ ├── default.nix # Main implementation ├── options.nix # Option declarations └── submodule/ # Optional submodules └── default.nix # Submodule implementation ``` ### default.nix The `default.nix` file contains the main implementation of the module: ```nix { config, lib, pkgs, namespace, ... }: let cfg = config.${namespace}.example-module; in { imports = [ ./options.nix ]; config = lib.mkIf cfg.enable { # Module implementation when enabled }; } ``` ### options.nix The `options.nix` file declares the module's configuration options: ```nix { lib, namespace, ... }: with lib; let inherit (lib.${namespace}) mkOpt; in { options.${namespace}.example-module = { enable = mkEnableOption "enable example module"; # Other option declarations }; } ``` ## Using Modules To use a module in your system configuration: 1. Enable the module in your system configuration: ```nix { config, ... }: { mjallen.example-module = { enable = true; # Other options }; } ``` ## Creating New Modules To create a new module: 1. Create a new directory in `modules/nixos/` or `modules/home/` 2. Create `default.nix` and `options.nix` files 3. Implement your module functionality 4. Import the module in your system configuration See the [Getting Started](../getting-started.md) guide for more details on creating modules.