- Update package description and fix mainProgram typo - Rewrite documentation to describe project switching, not process viewing - Add PROJECT_FOLDERS configuration and usage examples - Update all references across docs (README, guides, module overviews)
2.7 KiB
2.7 KiB
NixOS Modules Overview
Overview of available NixOS modules in m3ta-nixpkgs.
Available Modules
Importing Modules
Import All Modules
{config, ...}: {
imports = [
m3ta-nixpkgs.nixosModules.default
];
}
Import Specific Module
{config, ...}: {
imports = [
m3ta-nixpkgs.nixosModules.ports
m3ta-nixpkgs.nixosModules.mem0
];
}
Module Namespace
All NixOS modules use the m3ta.* namespace:
# Port management
m3ta.ports = {
enable = true;
definitions = {nginx = 80;};
};
# Mem0 service
m3ta.mem0 = {
enable = true;
port = 8000;
};
Common Patterns
Enable Module
All modules follow the pattern:
m3ta.moduleName = {
enable = true;
# ... options
};
Configuration
Modules typically provide these sections:
enable- Enable/disable modulepackage- Custom package (optional)- Configuration options specific to module
Integration Examples
With Port Management
{config, ...}: {
imports = [
m3ta-nixpkgs.nixosModules.default
];
m3ta.ports = {
enable = true;
definitions = {
nginx = 80;
grafana = 3000;
mem0 = 8000;
};
currentHost = config.networking.hostName;
};
m3ta.mem0 = {
enable = true;
port = config.m3ta.ports.get "mem0";
};
services.nginx = {
enable = true;
httpConfig = ''
server {
listen ${toString (config.m3ta.ports.get "nginx")};
root /var/www;
}
'';
};
}
With Home Manager
{config, ...}: {
# NixOS modules
imports = [
m3ta-nixpkgs.nixosModules.default
];
# Home Manager integration
home-manager.users.myusername = {
imports = [
m3ta-nixpkgs.homeManagerModules.default
];
m3ta.ports = {
enable = true;
definitions = {
dev-server = 3000;
};
currentHost = config.networking.hostName;
};
};
}
Module Locations
modules/nixos/ports.nix- Port management modulemodules/nixos/mem0.nix- Mem0 REST API server module
Adding New Modules
- Create module file:
modules/nixos/my-module.nix - Follow standard pattern:
{ config, lib, pkgs, ... }:
with lib; let
cfg = config.m3ta.myModule;
in {
options.m3ta.myModule = {
enable = mkEnableOption "my module";
};
config = mkIf cfg.enable {
# Configuration
};
}
- Import in
modules/nixos/default.nix
Related
- Port Management Guide - Detailed port management usage
- Using Modules Guide - How to use modules
- Home Manager Modules - User-level modules