frlan
frlan

Reputation: 7260

How to package plugins for an application for NixOS

How to package a plugin for an application for NixOS?

Having an application with an src tarball and multiple plugins to be installed from another source. I'm looking forward to an example how or maybe a pointer to documentation.

Upvotes: 2

Views: 359

Answers (1)

Eric
Eric

Reputation: 2884

As far as I know there is no documentation regarding this topic, but you can take example on how pidgin or input methods are managed.

The general idea is that there is:

  • A main package.
  • One or many plugins packages.
  • A wrapper package, using symlinkJoin or a similar function to join the main package and the plugins into a single package.

So for example, the fcitx input method related definitions in all-packages.nix:

  fcitx = callPackage ../tools/inputmethods/fcitx { };

  fcitx-engines = recurseIntoAttrs {

    anthy = callPackage ../tools/inputmethods/fcitx-engines/fcitx-anthy { };

    chewing = callPackage ../tools/inputmethods/fcitx-engines/fcitx-chewing { };

    hangul = callPackage ../tools/inputmethods/fcitx-engines/fcitx-hangul { };

    m17n = callPackage ../tools/inputmethods/fcitx-engines/fcitx-m17n { };

    mozc = callPackage ../tools/inputmethods/fcitx-engines/fcitx-mozc {
      inherit (pythonPackages) gyp;
      protobuf = protobuf.override { stdenv = clangStdenv; };
    };

    table-other = callPackage ../tools/inputmethods/fcitx-engines/fcitx-table-other { };

    cloudpinyin = callPackage ../tools/inputmethods/fcitx-engines/fcitx-cloudpinyin { };
  };

  fcitx-configtool = callPackage ../tools/inputmethods/fcitx/fcitx-configtool.nix { };

  fcitx-with-plugins = callPackage ../tools/inputmethods/fcitx/wrapper.nix {
    plugins = [ ];
  };

So it is possible to install fcitx with the anthy and m17n plugin by adding the following to environment.systemPackages list (or by using the dedicated nixos module):

pkgs.fcitx-with-plugins.override { plugins = [ fcitx-engines.anthy fcitx-engines.m17n ]; };

The pidgin package goes one more step in factorization by merging the main package and the wrapper.

Upvotes: 3

Related Questions