Title: NixOS optional features in packages | |
Author: Solène | |
Date: 14 October 2020 | |
Tags: nixos linux nix | |
Description: | |
As a claws-mail user, I like to have calendar support in the mail | |
client to be able to "accept" invitations. In the default NixOS | |
claws-mail package, the vcalendar module isn't installed with the | |
package. Still, it is possible to add support for the vcalendar | |
module without ugly hack. | |
It turns out, by default, the claws-mail package in Nixpkg has an | |
optional build option for the vcalendar module, we need to tell | |
nixpkg we want this module and claws-mail will be compiled. | |
As stated in the [NixOS | |
manual](https://nixos.org/manual/nixos/stable/#sec-customising-packages | |
), | |
the optionals features can't be searched yet. So what's possible | |
is to search for your package in the [NixOS packages | |
search](https://search.nixos.org/packages), click on the package | |
name to get to the details and click on the link named "Nix expression" | |
that will open a link to the package definition on GitHUB, [claws-mail | |
nix | |
expression](https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/a | |
pplications/networking/mailreaders/claws-mail/default.nix#L111) | |
As you can see on the claws-mail nix expression code, there are lot | |
of lines with **optional**, those are features we can enable. Here | |
is a sample: | |
[..] | |
++ optional (!enablePluginArchive) "--disable-archive-plugin" | |
++ optional (!enablePluginLitehtmlViewer) | |
"--disable-litehtml_viewer-plugin" | |
++ optional (!enablePluginPdf) "--disable-pdf_viewer-plugin" | |
++ optional (!enablePluginPython) "--disable-python-plugin" | |
[..] | |
In your `configuration.nix` file, where you define the package list | |
you want, you can tell you want to enable the plugin vcalendar, | |
this is done as in the following example: | |
environment.systemPackages = with pkgs; [ | |
kakoune git firefox irssi minetest | |
(pkgs.claws-mail.override { enablePluginVcalendar = true;}) | |
]; | |
When you rebuild your system to match the configuration definition, | |
claws-mail will be compiled with the extras options you defined. | |
Now, I have claws-mail with vCalendar support. |