How can I add extensions to Freshrss on NixOS?

I have a simple freshrss config:

     services.freshrss = {
        enable = true;
        baseUrl = "http://freshrss";
        defaultUser = "Lxx";
        passwordFile = "/run/secrets/freshrss";
     };

This works as expected but I’d like to add extensions to Freshrss and as I couldn’t find a Nix option for this I tried the manual method of creating /var/lib/freshrss/extensions and placing them there. However this does not seem to have an effect.

Does anyone else here use Freshrss with extensions? How do I make them work?

1 Like

This worked for me:

    services.freshrss = {
      enable = true;
      package = pkgs.freshrss.overrideAttrs (old: {
          overrideConfig = pkgs.writeText "constants.local.php" ''
            <?php
              define('DATA_PATH', getenv('FRESHRSS_DATA_PATH'));
              define('THIRDPARTY_EXTENSIONS_PATH', getenv('FRESHRSS_DATA_PATH') . '/extensions');
              define('EXTENSIONS_PATH', getenv('FRESHRSS_DATA_PATH') . '/extensions');
        '';
      });
    ...
   

I think it was originally looking for the extensions folder inside the original derivation.
This makes it look in the data directory instead.

(I took some hints from the package derivation: https://github.com/NixOS/nixpkgs/blob/fcc147b1e9358a8386b2c4368bd928e1f63a7df2/pkgs/servers/web-apps/freshrss/default.nix#L29)

Hello there !
I also want to setup extensions and I followed your suggestion, but I can’t get it to work. I tried to put the extensions in /var/lib/freshrss/extensions/ but it is not working at all and when I check the config, even with overrideAttrs, it does not seem that the new env variables are applied…

The solution posted by @mattchrist was working until this specific commit: https://github.com/NixOS/nixpkgs/commit/29d41b7fd2ccc09a103e401ab00699eb0cdbbd23, which was rolled into 23.11.
I’m on a fresh install of 23.11 and can’t get extensions working either now (I tried changing the variable names with no luck). Not sure if existing 23.05 users who upgraded were impacted

i never thought of using this override for defining extensions.

I am not the biggest fan of it, because there are no guarantees for compatibility.

A better solution would be, implementing this in nixpkgs itself: FreshRSS : Unable to add extensions · Issue #271721 · NixOS/nixpkgs · GitHub

If you would like to fix this faster, you would have to add the runHook postInstall to the installPhase and then the copy of the config could be defined in the postInstall. I would like to prevent having this file in the package per default.

I created the MR (freshrss: cleanup + runHook by Stunkymonkey · Pull Request #273210 · NixOS/nixpkgs · GitHub) so you can enable the extensions the old way.

Hello, indeed ‘artav4’ is me on github. So chronologically I saw that post first and did not understand why that was not working, and in parallel opened the github issue, but by the time I understood that the link was sending to an older commit.
I understand the arguments of @Stunkymonkey, and I would like if I get enough knowledge about nix and nixpkgs to properly implement it in the nixpkgs, but anyway thanks for letting us install extensions through overriding.

FYI: I have a first version with freshrss-extensions: freshrss-extensions: init by Stunkymonkey · Pull Request #307459 · NixOS/nixpkgs · GitHub

1 Like