{
  config,
  pkgs,
  lib,
  ...
}: let
  choose = paths: builtins.head (builtins.filter (p: builtins.pathExists p) paths);
in {
  options.local = {
    hostname = lib.mkOption {
      type = lib.types.str;
      default = "nixos-default";
      description = "System hostname";
    };
    username = lib.mkOption {
      type = lib.types.str;
      default = "user";
      description = "Primary user username";
    };
    userDescription = lib.mkOption {
      type = lib.types.str;
      default = "NixOS User";
      description = "Primary user description";
    };
    address = lib.mkOption {
      type = lib.types.str;
      default = "10.1.1.100";
      description = "Static IP address";
    };
  };

  imports = [
    (choose [./modules/desktop-manager/sway_greetd_homemanager.nix ../desktop-manager/sway_greetd_homemanager.nix])
    (choose [./modules/local/hostname_username.nix ../local/hostname_username.nix])
    (choose [./modules/local/networking_local.nix ../local/networking_local.nix])
    (choose [./modules/bootloader/seabios-assigned-iso-at-birth.nix ../bootloader/seabios-assigned-iso-at-birth.nix])
    (choose [./modules/lix-default.nix ../lix-default.nix])
    # Optionally: (choose [ ./modules/toolsets/remote_building.nix ../toolsets/remote_building.nix ])
    ## Compose modules for Portainer service
    (choose [./modules/songsheet/wavelog/docker-compose.nix ../songsheet/wavelog/docker-compose.nix])
    (choose [./modules/secrets-config/sops-composesongsheet.nix ../secrets-config/sops-composesongsheet.nix])
  ];

  config = {
    local.hostname = "christine-teamspeak";
    local.username = "teamspeak_christine";
    local.userDescription = "NixOS Teamspeak Service";
    local.address = "10.1.1.248";

    services.teamspeak3 = {
      enable = true;
      openFirewall = true;
    };

    # Add podman with docker compose
    # Enable common container config files in /etc/containers
    virtualisation.containers.enable = true;
    virtualisation = {
      podman = {
        enable = true;

        # Create a `docker` alias for podman, to use it as a drop-in replacement
        dockerCompat = true;

        # Required for containers under podman-compose to be able to talk to each other.
        defaultNetwork.settings.dns_enabled = true;
      };
    };
    environment.systemPackages = with pkgs; [
      dive # look into docker image layers
      podman-tui # status of containers in the terminal
      docker-compose # start group of containers for dev
      #podman-compose # start group of containers for dev
    ];

    ## Add Conduit for Matrix

    # See https://search.nixos.org/options?channel=unstable&query=services.matrix-conduit.
    # and https://docs.conduit.rs/configuration.html
    services.matrix-conduit = {
      enable = true;
      settings.global = {
        allow_registration = true;
        # You will need this token when creating your first account.
        #registration_token = "testtoken1234";
        # server_name = yourDomainName;
        port = 12244;
        # Bind to all interfaces so Traefik on the network can reach Conduit.
        address = "0.0.0.0";
        database_backend = "rocksdb";
        server_name = "lgbtq.prg-radio.org";
        allow_federation = true;
        allow_check_for_updates = true;

        trusted_servers = ["matrix.org"];

        # See https://docs.conduit.rs/turn.html, and https://github.com/element-hq/synapse/blob/develop/docs/turn-howto.md for more details
        # turn_uris = [
        #  "turn:your.turn.url?transport=udp"
        #  "turn:your.turn.url?transport=tcp"
        # ];
        # turn_secret = "your secret";
      };
    };
    # PostgreSQL for the Relay
    services.postgresql = {
      enable = true;
      ensureDatabases = ["discord-mautrix"];
      authentication = pkgs.lib.mkOverride 10 ''
        #type database  DBuser  auth-method
        local all       all     trust
        host    all       all     127.0.0.1/32     scram-sha-256
        host    all       all     10.1.1.248/32    scram-sha-256
        host    all       all     ::1/128          scram-sha-256
      '';
    };

    networking.firewall.allowedTCPPorts = [
      80
      443
      12244
      8448
      29334
      5432
    ];
    networking.firewall.allowedUDPPorts = [
      80
      443
      12244
      8448
      29334
      5432
    ];

    system.stateVersion = "25.11";
  };
}
