Files
nix-config/modules
ryan4yin | 二花 63b7183381 feat(mihomo): keep unproxiable ranges out of TUN, fix the startup DNS race (#419)
* feat(mihomo): keep ranges that can never be proxied out of TUN

The list lives in policy.yaml as tun_exclude_address; sources.yaml may override
it. 198.18.0.0/15 stays in TUN: that is the fake-ip range itself.

* feat(mihomo): match Valve's content servers by ASN

The 20 hand-copied prefixes had drifted from what AS32590 announces. The rule
type needs GeoLite2-ASN.mmdb, so geox-url.asn points at the same mirror.

* feat(mihomo): render the gateway config from the same sources

The hand-kept copy had drifted: a manual sync carried the desktop's secret onto
the gateway and dropped external-ui-url. --redact yields a shareable template.

* fix(mihomo): open the link DNS takeover only once the core serves it

The core opens :1053 after parsing rules, and rule parsing is where missing
geodata gets fetched. Flipping at fork time made that fetch SERVFAIL, the config
fatal, and the unit unstartable.

* fix(justfile): keep local endpoints out of the agent proxy

With only HTTP_PROXY set, a request to this host's own llama-swap endpoint went
to mihomo. Node matches exact hosts only, so the literals carry it; the CIDRs
serve curl and Go.

* feat(justfile): seed mihomo geodata into the service state dir

So a cold start never needs the download that the DNS takeover made unstartable.
2026-10-09 12:31:59 +08:00
..

NixOS / Nix-Darwin's Submodules

This directory contains modular NixOS and Nix-Darwin configurations organized by platform and functionality.

Current Structure

modules/
├── README.md
├── base/                    # Common configuration for all platforms
│   ├── default.nix
│   ├── fonts.nix           # System font configuration
│   ├── nix.nix            # Nix package manager settings
│   ├── overlays.nix       # Package overlays
│   ├── packages.nix       # Essential system packages
│   ├── security.nix       # Basic security settings
│   └── users.nix          # User management
├── darwin/                  # macOS-specific modules
│   ├── README.md
│   ├── apps.nix           # macOS applications
│   ├── default.nix
│   ├── nix-core.nix       # Core Nix configuration
│   ├── security.nix       # macOS security settings
│   ├── ssh.nix           # SSH configuration
│   ├── system.nix        # System-level settings
│   └── users.nix         # macOS user management
└── nixos/                   # NixOS-specific modules
    ├── base/               # Base NixOS configuration
    │   ├── btop.nix       # System resource monitor
    │   ├── btrbk.nix      # Local btrfs snapshots
    │   ├── core.nix       # Core system settings
    │   ├── default.nix
    │   ├── i18n.nix       # Internationalization
    │   ├── locate.nix     # locate/updatedb file search
    │   ├── monitoring.nix # System monitoring
    │   ├── networking/    # Network configuration
    │   ├── nix.nix        # Nix settings
    │   ├── packages.nix   # System packages
    │   ├── restic-backup.nix # Encrypted off-host backups (see ../BACKUP.md)
    │   ├── ssh.nix        # SSH daemon configuration
    │   ├── trash.nix      # Trash retention cleanup
    │   ├── user-group.nix # User and group management
    │   └── zram.nix       # ZRAM swap configuration
    ├── desktop.nix         # Desktop environment configuration
    ├── desktop/            # Desktop-specific modules
    │   ├── canokey.nix    # CanoKey hardware token
    │   ├── computer-use.nix # Headless X11/i3 session for AI agents
    │   ├── default.nix
    │   ├── fhs.nix        # FHS environment
    │   ├── fonts.nix      # Desktop fonts
    │   ├── gaming.nix     # Gaming support
    │   ├── misc.nix       # Miscellaneous desktop settings
    │   ├── networking/    # Network-related desktop configs
    │   ├── nix.nix        # Desktop Nix settings
    │   ├── peripherals.nix # Peripheral device configuration
    │   ├── power.nix      # Power management
    │   ├── security.nix   # Desktop security settings
    │   ├── ssh.nix        # Desktop SSH configuration
    │   ├── containers.nix # Container engines (podman/docker)
    │   └── xdg.nix       # XDG base directory settings
    └── server/             # Server-specific modules
        ├── qemu-guest-hardware-configuration.nix
        ├── qemu-guest.nix  # VM guest base module (libvirt/QEMU guests)
        ├── remote-building.nix # Remote build setup
        ├── server-aarch64.nix
        ├── server-riscv64.nix # module only; the riscv64 output is disabled
        └── server.nix

System hardening modules (kernel baseline, AppArmor, app sandboxes) live under ../hardening/.

Module Categories

1. Base Modules (base/)

Common configuration shared between NixOS and macOS:

  • System fonts and localization
  • Essential packages and tools
  • Basic security settings
  • User management
  • Package overlays

2. macOS Modules (darwin/)

macOS-specific configuration:

  • macOS applications and system settings
  • Security configurations tailored for macOS
  • SSH and system-level settings
  • Package compatibility fixes

3. NixOS Modules (nixos/)

Platform-specific NixOS configuration:

  • Base: Core system settings and services
  • Desktop: Desktop environment and GUI applications
  • Server: Server-specific optimizations and services

Usage

Modules are imported based on platform detection:

  • NixOS Systems: Import nixos/ modules
  • macOS Systems: Import darwin/ modules
  • All Systems: Import base/ modules for shared configuration