mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 06:29:23 +08:00
add ua
This commit is contained in:
@@ -298,6 +298,7 @@
|
||||
};
|
||||
};
|
||||
coturn.enable = true;
|
||||
httpua.enable = true;
|
||||
};
|
||||
};})
|
||||
];
|
||||
|
||||
@@ -30,6 +30,7 @@ inputs:
|
||||
./nix-serve.nix
|
||||
./send.nix
|
||||
./huginn.nix
|
||||
./httpua
|
||||
];
|
||||
options.nixos.services = let inherit (inputs.lib) mkOption types; in
|
||||
{
|
||||
|
||||
25
modules/services/httpua/default.nix
Normal file
25
modules/services/httpua/default.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
inputs:
|
||||
{
|
||||
options.nixos.services.httpua = let inherit (inputs.lib) mkOption types; in
|
||||
{
|
||||
enable = mkOption { type = types.bool; default = false; };
|
||||
hostname = mkOption { type = types.nonEmptyStr; default = "ua.chn.moe"; };
|
||||
};
|
||||
config =
|
||||
let
|
||||
inherit (inputs.config.nixos.services) httpua;
|
||||
inherit (inputs.lib) mkIf;
|
||||
inherit (builtins) toString;
|
||||
in mkIf httpua.enable
|
||||
{
|
||||
nixos.services =
|
||||
{
|
||||
phpfpm.instances.httpua = {};
|
||||
nginx.http.${httpua.hostname}.php =
|
||||
{
|
||||
root = toString ./.;
|
||||
fastcgiPass = inputs.config.nixos.services.phpfpm.instances.httpua.fastcgi;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
1
modules/services/httpua/index.php
Normal file
1
modules/services/httpua/index.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php echo $_SERVER['HTTP_USER_AGENT']; ?>
|
||||
@@ -3,14 +3,12 @@ inputs:
|
||||
options.nixos.services.huginn = let inherit (inputs.lib) mkOption types; in
|
||||
{
|
||||
enable = mkOption { type = types.bool; default = false; };
|
||||
hostname = mkOption { type = types.str; default = "huginn.chn.moe"; };
|
||||
hostname = mkOption { type = types.nonEmptyStr; default = "huginn.chn.moe"; };
|
||||
};
|
||||
config =
|
||||
let
|
||||
inherit (inputs.lib) mkIf;
|
||||
inherit (inputs.localLib) attrsToList;
|
||||
inherit (inputs.config.nixos.services) huginn;
|
||||
inherit (builtins) map listToAttrs toString;
|
||||
in mkIf huginn.enable
|
||||
{
|
||||
virtualisation.oci-containers.containers.huginn =
|
||||
|
||||
@@ -7,7 +7,7 @@ inputs:
|
||||
autoStart = mkOption { type = types.bool; default = true; };
|
||||
port = mkOption { type = types.ints.unsigned; default = 9726; };
|
||||
redis.port = mkOption { type = types.ints.unsigned; default = 3545; };
|
||||
hostname = mkOption { type = types.str; default = "misskey.chn.moe"; };
|
||||
hostname = mkOption { type = types.nonEmptyStr; default = "misskey.chn.moe"; };
|
||||
meilisearch =
|
||||
{
|
||||
enable = mkOption { type = types.bool; default = true; };
|
||||
|
||||
@@ -3,7 +3,7 @@ inputs:
|
||||
options.nixos.services.nextcloud = let inherit (inputs.lib) mkOption types; in
|
||||
{
|
||||
enable = mkOption { type = types.bool; default = false; };
|
||||
hostname = mkOption { type = types.str; default = "nextcloud.chn.moe"; };
|
||||
hostname = mkOption { type = types.nonEmptyStr; default = "nextcloud.chn.moe"; };
|
||||
};
|
||||
config =
|
||||
let
|
||||
|
||||
@@ -3,7 +3,7 @@ inputs:
|
||||
options.nixos.services.photoprism = let inherit (inputs.lib) mkOption types; in
|
||||
{
|
||||
enable = mkOption { type = types.bool; default = false; };
|
||||
hostname = mkOption { type = types.str; default = "photoprism.chn.moe"; };
|
||||
hostname = mkOption { type = types.nonEmptyStr; default = "photoprism.chn.moe"; };
|
||||
port = mkOption { type = types.ints.unsigned; default = 2342; };
|
||||
};
|
||||
config =
|
||||
|
||||
@@ -8,7 +8,13 @@ inputs:
|
||||
{
|
||||
user = mkOption { type = types.nullOr types.nonEmptyStr; default = null; };
|
||||
group = mkOption { type = types.nullOr types.nonEmptyStr; default = null; };
|
||||
package = mkOption { type = types.nullOr types.package; default = null; };
|
||||
package = mkOption { type = types.nullOr types.package; default = inputs.pkgs.php; };
|
||||
fastcgi = mkOption
|
||||
{
|
||||
type = types.nonEmptyStr;
|
||||
readOnly = true;
|
||||
default = "unix:${inputs.config.services.phpfpm.pools.${submoduleInputs.config._module.args.name}.socket}";
|
||||
};
|
||||
};}));
|
||||
default = {};
|
||||
};
|
||||
@@ -28,7 +34,7 @@ inputs:
|
||||
{
|
||||
user = if pool.value.user == null then pool.name else pool.value.user;
|
||||
group = if pool.value.group == null then inputs.config.users.users.${user}.group else pool.value.group;
|
||||
phpPackage = if pool.value.package == null then inputs.pkgs.php else pool.value.package;
|
||||
phpPackage = pool.value.package;
|
||||
settings =
|
||||
{
|
||||
"pm" = "ondemand";
|
||||
@@ -42,18 +48,10 @@ inputs:
|
||||
users =
|
||||
{
|
||||
users = listToAttrs (map
|
||||
(pool:
|
||||
{
|
||||
inherit (pool) name;
|
||||
value = { isSystemUser = true; group = pool.name; };
|
||||
})
|
||||
(pool: { inherit (pool) name; value = { isSystemUser = true; group = pool.name; }; })
|
||||
(filter (pool: pool.value.user == null) (attrsToList phpfpm.instances)));
|
||||
groups = listToAttrs (map
|
||||
(pool:
|
||||
{
|
||||
inherit (pool) name;
|
||||
value = {};
|
||||
})
|
||||
(pool: { inherit (pool) name; value = {}; })
|
||||
(filter (pool: pool.value.user == null) (attrsToList phpfpm.instances)));
|
||||
};
|
||||
};
|
||||
|
||||
@@ -4,12 +4,11 @@ inputs:
|
||||
{
|
||||
enable = mkOption { type = types.bool; default = false; };
|
||||
port = mkOption { type = types.ints.unsigned; default = 5221; };
|
||||
hostname = mkOption { type = types.str; default = "rsshub.chn.moe"; };
|
||||
hostname = mkOption { type = types.nonEmptyStr; default = "rsshub.chn.moe"; };
|
||||
};
|
||||
config =
|
||||
let
|
||||
inherit (inputs.config.nixos.services) rsshub;
|
||||
inherit (inputs.localLib) stripeTabs;
|
||||
inherit (inputs.lib) mkIf;
|
||||
inherit (builtins) map listToAttrs toString;
|
||||
in mkIf rsshub.enable
|
||||
|
||||
@@ -3,14 +3,12 @@ inputs:
|
||||
options.nixos.services.send = let inherit (inputs.lib) mkOption types; in
|
||||
{
|
||||
enable = mkOption { type = types.bool; default = false; };
|
||||
hostname = mkOption { type = types.str; default = "send.chn.moe"; };
|
||||
hostname = mkOption { type = types.nonEmptyStr; default = "send.chn.moe"; };
|
||||
};
|
||||
config =
|
||||
let
|
||||
inherit (inputs.lib) mkIf;
|
||||
inherit (inputs.localLib) attrsToList;
|
||||
inherit (inputs.config.nixos.services) send;
|
||||
inherit (builtins) map listToAttrs toString;
|
||||
in mkIf send.enable
|
||||
{
|
||||
virtualisation.oci-containers.containers.send =
|
||||
|
||||
@@ -5,7 +5,7 @@ inputs:
|
||||
enable = mkOption { type = types.bool; default = false; };
|
||||
autoStart = mkOption { type = types.bool; default = true; };
|
||||
port = mkOption { type = types.ints.unsigned; default = 8008; };
|
||||
hostname = mkOption { type = types.str; default = "synapse.chn.moe"; };
|
||||
hostname = mkOption { type = types.nonEmptyStr; default = "synapse.chn.moe"; };
|
||||
};
|
||||
config =
|
||||
let
|
||||
|
||||
@@ -6,7 +6,7 @@ inputs:
|
||||
autoStart = mkOption { type = types.bool; default = true; };
|
||||
port = mkOption { type = types.ints.unsigned; default = 8000; };
|
||||
websocketPort = mkOption { type = types.ints.unsigned; default = 3012; };
|
||||
hostname = mkOption { type = types.str; default = "vaultwarden.chn.moe"; };
|
||||
hostname = mkOption { type = types.nonEmptyStr; default = "vaultwarden.chn.moe"; };
|
||||
};
|
||||
config =
|
||||
let
|
||||
|
||||
Reference in New Issue
Block a user