Files
nixpkgs/docs/modules/nixos/overview.md
m3tm3re 44485c4c72 docs: update zellij-ps to reflect project switcher functionality
- 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)
2025-12-30 15:42:52 +01:00

2.7 KiB

NixOS Modules Overview

Overview of available NixOS modules in m3ta-nixpkgs.

Available Modules

  • ports - Port management across hosts
  • mem0 - Mem0 REST API server

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 module
  • package - 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 module
  • modules/nixos/mem0.nix - Mem0 REST API server module

Adding New Modules

  1. Create module file: modules/nixos/my-module.nix
  2. 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
  };
}
  1. Import in modules/nixos/default.nix