home-manager/modules/programs/nheko.nix
Emily 36a53d9f26 treewide: convert all option docs to Markdown
This process was automated by [my fork of `nix-doc-munge`]. All
conversions were automatically checked to produce the same DocBook
result when converted back, modulo minor typographical/formatting
differences on the acceptable-to-desirable spectrum.

To reproduce this commit, run:

  $ NIX_PATH=nixpkgs=flake:nixpkgs/e7e69199f0372364a6106a1e735f68604f4c5a25 \
    nix shell nixpkgs#coreutils \
    -c find . -name '*.nix' \
    -exec nix run -- github:emilazy/nix-doc-munge/98dadf1f77351c2ba5dcb709a2a171d655f15099 \
    {} +
  $ ./format

[my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge/tree/home-manager
2023-07-17 18:40:56 +01:00

81 lines
2.2 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.nheko;
iniFmt = pkgs.formats.ini { };
configDir = if pkgs.stdenv.hostPlatform.isDarwin then
"Library/Application Support"
else
config.xdg.configHome;
camelCaseToSnakeCase =
replaceStrings upperChars (map (s: "_${s}") lowerChars);
inherit (generators) mkKeyValueDefault toINI;
in {
meta.maintainers = [ maintainers.gvolpe ];
options.programs.nheko = {
enable = mkEnableOption (lib.mdDoc "Qt desktop client for Matrix");
package = mkPackageOptionMD pkgs "nheko" { };
settings = mkOption {
type = iniFmt.type;
default = { };
example = literalExpression ''
{
general.disableCertificateValidation = false;
auth = {
accessToken = "SECRET";
deviceId = "MY_DEVICE";
homeServer = "https://matrix-client.matrix.org:443";
userId = "@@user:matrix.org";
};
settings.scaleFactor = 1.0;
sidebar.width = 416;
user = {
alertOnNotification = true;
animateImagesOnHover = false;
"sidebar\\roomListWidth" = 308;
};
}
'';
description = lib.mdDoc ''
Attribute set of Nheko preferences (converted to an INI file).
For now, it is recommended to run nheko and sign-in before filling in
the configuration settings in this module, as nheko writes the access
token to {file}`$XDG_CONFIG_HOME/nheko/nheko.conf` the
first time we sign in, and we need that data into these settings for the
correct functionality of the application.
This a temporary inconvenience, however, as nheko has plans to move the
authentication stuff into the local database they currently use. Once
this happens, this will no longer be an issue.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home.file."${configDir}/nheko/nheko.conf" = mkIf (cfg.settings != { }) {
text = ''
; Generated by Home Manager.
${toINI {
mkKeyValue = k: v:
mkKeyValueDefault { } "=" (camelCaseToSnakeCase k) v;
} cfg.settings}
'';
};
};
}