mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 21:01:34 +01:00
privatebin: Init module
This commit is contained in:
parent
1b698ece70
commit
337a0e0755
1 changed files with 46 additions and 0 deletions
46
modules/system/services/privatebin.nix
Normal file
46
modules/system/services/privatebin.nix
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
config,
|
||||
pkgs-unstable,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.custom.services.privatebin;
|
||||
in
|
||||
{
|
||||
options.custom.services.privatebin = {
|
||||
enable = lib.mkEnableOption "";
|
||||
domain = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
default = "";
|
||||
};
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 61009;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
meta = {
|
||||
domains.list = [ cfg.domain ];
|
||||
ports.tcp.list = [ cfg.port ];
|
||||
};
|
||||
|
||||
services = {
|
||||
privatebin = {
|
||||
enable = true;
|
||||
package = pkgs-unstable.privatebin; # Unstable to get version 2.0
|
||||
enableNginx = true;
|
||||
virtualHost = "privatebin";
|
||||
settings.main.basepath = "https://${cfg.domain}";
|
||||
};
|
||||
|
||||
nginx.virtualHosts.privatebin.listen = [
|
||||
{
|
||||
addr = "localhost";
|
||||
inherit (cfg) port;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue