further catogorize profile/web, add python-docs

This commit is contained in:
2023-02-26 02:46:35 +01:00
parent 71ac683efa
commit 181edd92e5
65 changed files with 282 additions and 262 deletions
@@ -2,6 +2,8 @@
{
# AutoSSH reverse tunnels
# TODO: add noximilien to this list, deselect is using hostname
services.autossh.sessions = let
mkSshSession = {user, name, host, rport, monitoringPort}: {
user = user; # local user
+2 -2
View File
@@ -4,8 +4,8 @@
systemd.services.domeneshop-updater = {
description = "domene.shop domain updater";
#after = [ "something?.service" ];
#wants = [ "something?.service" ];
after = [ "network-online.target" ]; # TODO: multi-user ?
wants = [ "network-online.target" ]; # TODO: multi-user ?
serviceConfig = let
prog = pkgs.writeShellApplication {
name = "domeneshop-dyndns-updater.sh";
-140
View File
@@ -1,140 +0,0 @@
{ lib, pkgs, config, ... }:
#with builtins;
let
lib_ = lib;
in
let
cfg = config.services.webhook;
hooksFormat = pkgs.formats.json {};
lib = lib_ // { mdDoc = x: x; }; # HACK
in {
options.services.webhook = with lib; {
enable = mkEnableOption "webhook service";
package = mkPackageOption pkgs "webhook" { };
user = mkOption {
type = types.str;
default = "webhook";
description = lib.mdDoc "User under which Webhook runs.";
};
group = mkOption {
type = types.str;
default = "webhook";
description = lib.mdDoc "Group under which Webhook runs.";
};
listenHost = mkOption {
type = types.str;
default = "127.0.0.1";
description = lib.mdDoc "Which address Webhook should listen to for HTTP.";
};
listenPort = mkOption {
type = types.port;
default = 8080;
description = lib.mdDoc "Which port Webhook should listen to for HTTP.";
};
openFirewall = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
Open the configured ports in the firewall for the Webhook server.
Preferably the Webhook server is instead put behind a reverse proxy.
'';
};
urlPrefix = mkOption {
type = types.str;
default = "hooks";
description = lib.mdDoc ''
Url prefix to use for served hooks.
`http://listen:port/PREFIX/:hook-id`
'';
};
httpMethods = mkOption {
type = types.listOf types.str;
default = ["POST"];
defaultText = literalExpression ''["POST"]'';
description = lib.mdDoc "Default allowed HTTP methods";
};
verbose = mkOption {
type = types.bool;
default = true;
description = lib.mdDoc "Whether to log events or not.";
};
extraArgs = mkOption {
type = types.listOf types.str;
default = [];
description = lib.mdDoc ''
Extra command-line arguments.
If you want to set CORS headers, you can set [ "-header" "name=value" ]
to the appropriate CORS headers to passed along with each response.
'';
};
settings = mkOption {
type = hooksFormat.type;
default = [];
example = lib.literalExpression ''
[
{
id = "my-webhook";
execute-command = pkgs.writeShellScript "handle-my-webhook.sh" '${""}'
echo "foobar"
'${""}';
}
]
'';
description = lib.mdDoc ''
The configured hooks for Webhook to serve.
Here is a collection of hook examples:
<https://github.com/adnanh/webhook#examples>
'';
};
};
config = lib.mkIf cfg.enable {
systemd.services.webhook = {
description = lib.mdDoc "Webhook Server";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = let
args = [
"-ip" cfg.listenHost
"-port" cfg.listenPort
"-http-methods" (lib.strings.concatStringsSep "," cfg.httpMethods)
"-urlprefix" cfg.urlPrefix
"-hooks" (hooksFormat.generate "hooks.json" cfg.settings)
] ++ lib.optional cfg.verbose "-verbose"
++ cfg.extraArgs;
in rec {
User = cfg.user;
Group = cfg.group;
DynamicUser = cfg.user == "webhook";
ExecStart = "${cfg.package}/bin/webhook " + (lib.strings.escapeShellArgs args);
Restart = "on-failure";
};
};
networking.firewall = lib.mkIf cfg.openFirewall {
allowedTCPPorts = [ cfg.listenPort ];
};
};
meta.maintainers = with lib.maintainers; [ pbsds ];
}
-1
View File
@@ -1 +0,0 @@
* [ ] make ACME a function
+24
View File
@@ -0,0 +1,24 @@
{ config, pkgs, lib, mkDomain, ... }:
let
python-versions = (lib.attrNames pkgs.pythonDocs.html);
mkLinkFarmEntry = python-version: {
name = python-version;
path = "${builtins.toString pkgs.pythonDocs.html.${python-version}}/share/doc/${python-version}/html";
};
in
{
services.nginx.virtualHosts.${mkDomain "python-docs"} = {
forceSSL = true; # addSSL = true;
enableACME = true; #useACMEHost = acmeDomain;
root = pkgs.linkFarm "python-docs" ([
{ name = "index.html"; path = pkgs.writeText "my-file" ''
<!DOCTYPE html>
<ul>
${lib.concatStringsSep "\n" (
builtins.map (name: ''<li><a href="${name}/">${name}/</a>'') python-versions
)}
</ul>
''; }
] ++ (builtins.map mkLinkFarmEntry python-versions));
};
}
@@ -1,15 +1,13 @@
{ config, pkgs, lib, unstable, mkDomain, ... }:
{ config, pkgs, lib, inputs, mkDomain, ... }:
{
# Invidious
# An open source alternative front-end to YouTube
/**/
imports = [
({ disabledModules = [ "services/web-apps/invidious.nix" ]; })
#<nixos-unstable/nixos/modules/services/web-apps/invidious.nix>
(unstable + "/nixos/modules/services/web-apps/invidious.nix")
({ services.invidious.package = unstable.invidious; })
];
disabledModules = [ "services/web-apps/invidious.nix" ];
#imports = [ <nixos-unstable/nixos/modules/services/web-apps/invidious.nix> ];
imports = [ ("${inputs.unstable}/nixos/modules/services/web-apps/invidious.nix") ];
services.invidious.package = pkgs.unstable.invidious;
/**/
services.invidious = {
@@ -1,14 +1,12 @@
{ config, pkgs, lib, unstable, mkDomain, ... }:
{ config, pkgs, lib, inputs, mkDomain, ... }:
{
# Jellyfin
/**/
imports = [
({ disabledModules = [ "services/misc/jellyfin.nix" ]; })
#<nixos-unstable/nixos/modules/services/misc/jellyfin.nix>
(unstable + "/nixos/modules/services/misc/jellyfin.nix")
({ services.jellyfin.package = unstable.jellyfin; })
];
disabledModules = [ "services/misc/jellyfin.nix" ];
#imports = [<nixos-unstable/nixos/modules/services/misc/jellyfin.nix> ];
imports = [ "${inputs.unstable}/nixos/modules/services/misc/jellyfin.nix" ];
services.jellyfin.package = pkgs.unstable.jellyfin;
/**/
services.jellyfin = {
+1 -1
View File
@@ -4,7 +4,7 @@
* configure stuff to send its shit here
* [ ] https://noted.lol/2-self-hosted-alternatives-to-doodle-meeting-scheduling/
* [ ] kukkee
* [ ] rallly - https://rallly.co/
* [ ] rallly
* [ ] Rocketchat - A self-hosted discord/slack alternative
* [ ] upterm / tmate - Secure terminal-session sharing