Matrix: Difference between revisions

element-web localhost source code
m Add a script to start element-web
Line 45: Line 45:
       # See https://github.com/element-hq/element-web/blob/develop/config.sample.json
       # See https://github.com/element-hq/element-web/blob/develop/config.sample.json
       conf = {
       conf = {
        default_theme = "dark";
         show_labs_settings = true;
         show_labs_settings = true;
        default_theme = "dark";
       };
       };
     };
     };
   };
   };
}
</syntaxhighlight>Alternatively, you can write a script to start the web client on demand.<syntaxhighlight lang="nix">
let
  localhost = (if config.networking.enableIPv6 then "::1" else "127.0.0.1");
  # port = yourPort;
  web-dir = pkgs.element-web.override {
    conf = {
      default_theme = "dark";
      show_labs_settings = true;
    };
  };
  element-web = pkgs.writeScriptBin "element-web" ''
    #!${pkgs.bash}/bin/bash
    set -e
    ${pkgs.python3}/bin/python3 -m http.server ${port} -b ${localhost} -d ${web-dir}
  '';
in
{
  home.sessionPath = [ "${element-web}/bin" ];
}
}
</syntaxhighlight>
</syntaxhighlight>