Skip to content

A Nix flake packaging Comentario, an open-source comment engine.

Notifications You must be signed in to change notification settings

SignalWalker/nix.pkg.comentario

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nix Flake for Comentario

A Nix flake packaging Comentario, an open-source comment engine.

Usage

Import the nixpkgs overlay and NixOS module:

inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs";
    comentario = {
        url = "github:SignalWalker/nix.pkg.comentario";
        inputs.nixpkgs.follows = "nixpkgs";
    };
};
outputs = inputs @ {
    self,
    nixpkgs,
    comentario,
    ...
}: {
    nixosConfigurations."example" = nixpkgs.lib.nixosSystem {
        modules = [
            comentario.nixosModules.default
            ({config, pkgs, lib, ...}: {
                config = {
                    nixpkgs.overlays = [
                        comentario.overlays.default
                    ];
                };
             })
        ];
    };
};

Configure the service:

{ config, pkgs, lib, ...}: let
    com = config.services.comentario;
in {
    config = {
        services.comentario = {
            enable = true;
            # These are the environment variables defined in the Comentario docs: https://docs.comentario.app/en/configuration/backend/static/
            settings = {
                HOST = "localhost";
                PORT = 8080;
                BASE_URL = "https://${com.virtualHost.domain}";
                # The service will fail if the secrets file doesn't exist or isn't accessible at runtime.
                # Make sure to make it readable by the comentario user/group (`config.services.comentario.user`).
                SECRETS_FILE = "/etc/comentario/secrets.yaml";
            };
            virtualHost = {
                domain = "comments.website.example";
                # This enables a simple NGINX vhost.
                nginx.enable = true;
            };
        };
        services.nginx = {
            enable = true;
            virtualHosts.${com.virtualHost.domain} = {
                # SSL is optional
                enableACME = true;
                forceSSL = true;
            };
        };
    };
};

About

A Nix flake packaging Comentario, an open-source comment engine.

Topics

Resources

Stars

Watchers

Forks

Languages