[Nix-dev] daemon in httpd subservice

Bit Shift bitshift at bigmacintosh.net
Sun Jul 20 04:35:52 CEST 2014


On 19/07/2014 19:12, Andreas Herrmann wrote:
> 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 <mailto: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
>
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>

I'm not at all familiar in-depth with Nix yet, so I'm open to being 
corrected on this, but could you not define a crontab entry that invokes 
the updater, a la the "locate" service example [1] in the manual?

- B

[1]: http://nixos.org/nixos/manual/#locate-example



More information about the nix-dev mailing list