Skip to content

feat(wrapperModules.iamb): init#551

Open
aliaslion wants to merge 1 commit into
BirdeeHub:mainfrom
aliaslion:iamb
Open

feat(wrapperModules.iamb): init#551
aliaslion wants to merge 1 commit into
BirdeeHub:mainfrom
aliaslion:iamb

Conversation

@aliaslion
Copy link
Copy Markdown

Adds wrapper module for iamb, a TUI Matrix client with vi-like keybinds.

Note that I'm not completely sure what generatedConfig.output and .placeholder do, I cobbled this together from the Alacritty and Yazi modules. Would appreciate some info about that :)

@BirdeeHub
Copy link
Copy Markdown
Owner

Note that I'm not completely sure what generatedConfig.output and .placeholder do, I cobbled this together from the Alacritty and Yazi modules. Would appreciate some info about that :)

So, basically, when we have many files we want to make into a directory, the placeholder value is used as the location you group them together in in the derivation.

Placeholders are weird values. They point at the associated output in whatever derivation they END UP in.

So, outside of that derivation, you can't really use them.

You don't need most of that for this module.

using constructFiles gives you both placeholder paths, and final ones usable from outside the module.

Since we are only generating 1 file, that is probably enough, but passing the thing out via passthru is still nice.

{
  config,
  lib,
  wlib,
  pkgs,
  ...
}:
{
  imports = [ wlib.modules.default ];
  options = {
    settings = lib.mkOption {
      type = wlib.types.structuredValueWith {
        nullable = false;
        typeName = "TOML";
      };
      default = { };
      description = ''
        Configuration of iamb.
        See {manpage}`iamb(5)` or <https://iamb.chat/configure.html>

        Note: profiles is required for first startup.
      '';
      example.profiles.myuser.user_id = "@user2:example.com";
    };
  };
  config.package = lib.mkDefault pkgs.iamb;
  config.flags."--config-directory" = dirOf (dirOf config.constructFiles.config.path);
  config.passthru.generatedConfig = dirOf (dirOf config.constructFiles.config.outPath);
  config.constructFiles.config = {
    relPath = "${config.binName}-config/iamb/config.toml";
    content = builtins.toJSON config.settings;
    builder = ''${pkgs.remarshal}/bin/json2toml "$1" "$2"'';
  };
  config.meta.maintainers = [ wlib.maintainers.aliaslion ];
}

Maybe something like that?

@aliaslion
Copy link
Copy Markdown
Author

OK, thank you, I think I understand it now. Also didn't know about dirOf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants