Skip to content

Commit 884bfcc

Browse files
committed
Cryptpad: move module to a separate file
1 parent dcf8bfd commit 884bfcc

File tree

2 files changed

+28
-23
lines changed

2 files changed

+28
-23
lines changed

projects/Cryptpad/default.nix

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,7 @@
2222
nixos.modules.services = {
2323
cryptpad = {
2424
name = "cryptpad";
25-
module =
26-
{ config, ... }:
27-
let
28-
cfg = config.services.cryptpad;
29-
in
30-
{
31-
imports = [
32-
"${sources.inputs.nixpkgs}/nixos/modules/services/web-apps/cryptpad.nix"
33-
];
34-
35-
# TODO: add to nixpkgs
36-
options.services.cryptpad.openPorts = lib.mkOption {
37-
type = lib.types.bool;
38-
default = false;
39-
description = ''
40-
Whether to open the port specified in `settings.httpPort` in the firewall.
41-
'';
42-
};
43-
config = lib.mkIf cfg.openPorts {
44-
networking.firewall.allowedTCPPorts = [ cfg.settings.httpPort ];
45-
networking.firewall.allowedUDPPorts = [ cfg.settings.httpPort ];
46-
};
47-
};
25+
module = ./module.nix;
4826
examples.demo = {
4927
module = ./demo.nix;
5028
description = "Deployment for demo purposes";

projects/Cryptpad/module.nix

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
lib,
3+
config,
4+
modulesPath,
5+
...
6+
}:
7+
let
8+
cfg = config.services.cryptpad;
9+
in
10+
{
11+
imports = [
12+
"${modulesPath}/services/web-apps/cryptpad.nix"
13+
];
14+
15+
# TODO: add to nixpkgs
16+
options.services.cryptpad.openPorts = lib.mkOption {
17+
type = lib.types.bool;
18+
default = false;
19+
description = ''
20+
Whether to open the port specified in `settings.httpPort` in the firewall.
21+
'';
22+
};
23+
config = lib.mkIf cfg.openPorts {
24+
networking.firewall.allowedTCPPorts = [ cfg.settings.httpPort ];
25+
networking.firewall.allowedUDPPorts = [ cfg.settings.httpPort ];
26+
};
27+
}

0 commit comments

Comments
 (0)