infrastructure

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

freshrss.nix (1165B)


      1 {
      2   config,
      3   lib,
      4   ...
      5 }:
      6 
      7 let
      8   cfg = config.services.local.freshrss;
      9 in
     10 {
     11   options.services.local.freshrss = {
     12     enable = lib.mkEnableOption "FreshRSS feed reader";
     13 
     14     domain = lib.mkOption {
     15       type = lib.types.str;
     16       description = "Domain for FreshRSS";
     17     };
     18 
     19     defaultUser = lib.mkOption {
     20       type = lib.types.str;
     21       default = "admin";
     22       description = "Default admin username";
     23     };
     24 
     25     passwordSecretName = lib.mkOption {
     26       type = lib.types.str;
     27       description = "Name of the sops secret containing the password";
     28     };
     29 
     30     baseUrl = lib.mkOption {
     31       type = lib.types.str;
     32       default = "http://localhost:8080";
     33       description = "Base URL for FreshRSS";
     34     };
     35   };
     36 
     37   config = lib.mkIf cfg.enable {
     38     sops.secrets.${cfg.passwordSecretName} = {
     39       owner = "freshrss";
     40     };
     41 
     42     services.freshrss = {
     43       enable = true;
     44       defaultUser = cfg.defaultUser;
     45       passwordFile = "/run/secrets/${cfg.passwordSecretName}";
     46       baseUrl = cfg.baseUrl;
     47       virtualHost = cfg.domain;
     48     };
     49 
     50     services.nginx.virtualHosts.${cfg.domain} = {
     51       forceSSL = true;
     52       enableACME = true;
     53     };
     54   };
     55 }