{
  config,
  lib,
  namespace,
  ...
}:
with lib;
let
  name = "code-server";
  cfg = config.${namespace}.services.${name};

  codeServerConfig = lib.${namespace}.mkModule {
    inherit config name;
    description = "vscode server";
    options = { };
    moduleConfig = {
      # Configure the standard NixOS code-server service
      services.code-server = {
        enable = true;
        port = cfg.port;
        user = "admin";
        group = "jallen-nas";
        host = cfg.listenAddress;
        auth = "none"; # "password"
        disableTelemetry = true;
        disableUpdateCheck = true;
        extraEnvironment = cfg.extraEnvironment;
        extraGroups = [
          "admin"
          "wheel"
        ];
      }
      // optionalAttrs (cfg.hashedPassword != null) {
        hashedPassword = cfg.hashedPassword;
      };
    };
  };
in
{
  imports = [ codeServerConfig ];
}
