[Nix-dev] daemon in httpd subservice

Andreas Herrmann andreash87 at gmx.ch
Sat Jul 19 20:12:22 CEST 2014


Hi,

I am now trying to get Tiny-Tiny-RSS [1] to work in NixOS via nixops. TTRSS
is an RSS/Atom aggregator and reader that you can run on your own server
and then access in multiple ways to read your news. (Including an android
app).

I implemented it as a subservice for httpd much like the mediawiki module.
And, the app itself is working fine. However, TTRSS comes with a php-cgi
script to update the feeds, that is intended to be run as a daemon [2]. And
this poses the following question:

Is it possible to define a service (daemon) from within an httpd
subservice, and how can I do that? Or, will I have to define a separate
(top-level) service that is manually activated in the machine configuration
and somehow depends on the TTRSS installation path? Which way would you
recommend, or prefer?

My current attempt looks like this:

    -- machine configuration contains
    services.httpd = {
      enable = true;
      adminAddr = "admin at example.com";
      extraSubservices = singleton
        { function = import ./ttrss-service.nix;
          siteHostName = "192.168.56.101";
        };
    };

    -- subservice configuration contains

    systemd.services.ttrssUpdate = {
      description = "TTRSS feed-update daemon";
      wantedBy = [ "multi-user.target" ];
      after = [ "postgresql.service" "httpd.service" ];
      serviceConfig = {
        ExecStart = "${php}/bin/php ${ttrssRoot}/update.php --daemon";
        User = serverInfo.serverConfig.user;
        Restart = "always";
      };
    };

Best, Andreas

[1]: http://tt-rss.org/redmine/projects/tt-rss/wiki
[2]: http://tt-rss.org/redmine/projects/tt-rss/wiki/UpdatingFeeds
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20140719/8365be9f/attachment.html 


More information about the nix-dev mailing list