Skip to content

Commit

Permalink
Cryptpad module
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderwallau committed Jul 28, 2024
1 parent 12f650b commit 54c3dc0
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
8 changes: 8 additions & 0 deletions machines/mayer/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
port = "3134";
};
};
cryptpad = {
enable = true;
domain = "cryptpad.alexanderwallau.de";
httpSafeOrigin = "cryptpad-sb.alexanderwallau.de";
Port = 3001;
websocketPort = 3002;
#adminKeys = [ "[
};
docker.enable = true;
# enable freshrss
freshrss = {
Expand Down
55 changes: 55 additions & 0 deletions modules/cryptpad/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# RSS aggregator and reader
{ config, lib, pkgs, ... }:
let
cfg = config.awallau.cryptpad;
in
{
options.awallau.cryptpad = with lib; {
enable = lib.mkEnableOption "Cryptpad - a collaboration suite that is end-to-end-encrypted and open-source ";

domain = mkOption {
type = types.str;
example = "https://cryptpad.example.com";
default = "";
description = "This is the URL that users will enter to load your instance";
};
httpSafeOrigin = mkOption {
type = types.nullOr types.str;
example = "https://cryptpad-ui.example.com. Apparently optional but recommended.";
description = "Cryptpad sandbox URL";
};
Port = mkOption {
type = types.int;
default = 3001;
description = "Port on which the Node.js server should listen";
};
websocketPort = mkOption {
type = types.int;
default = 3002;
description = "Port for the websocket that needs to be separate";
};
adminKeys = mkOption {
type = types.listOf types.str;
default = [ ];
description = "List of public signing keys of users that can access the admin panel";
example = [ "[[email protected]/YZgXQxKR0Rcb6r6CmxHPdAGLVludrAF2lEnkbx1vVOo=]" ];
};
};

config = lib.mkIf cfg.enable {
services = {
cryptpad.settings = {
httpUnsafeOrigin = "${cfg.domain}";
httpsSafeOrigin = "${cfg.httpSafeOrigin}";
httpPort = "${cfg.Port}";
websocketPort = "${cfg.websocketPort}";
adminKeys = "${cfg.adminKeys}";
};


nginx.virtualHosts."${cfg.domain}" = {
locations."/".proxyPass = "http://127.0.0.1:3001";
};
};
};
}

0 comments on commit 54c3dc0

Please sign in to comment.