nixos/ports: use _module.args

This commit is contained in:
Guanran Wang 2024-10-19 13:00:06 +08:00
parent 60d435c2af
commit 2e3649cc9d
Signed by: nyancat
GPG key ID: 91F97D9ED12639CF
10 changed files with 30 additions and 26 deletions

View file

@ -9,7 +9,6 @@
imports = [
"${modulesPath}/virtualisation/amazon-image.nix"
./anti-feature.nix
./ports.nix
./services/forgejo.nix
./services/keycloak.nix
@ -23,6 +22,8 @@
../../../nixos/profiles/sing-box-server
];
_module.args.ports = import ./ports.nix;
boot.loader.grub.device = lib.mkForce "/dev/nvme0n1";
system.stateVersion = "24.05";

View file

@ -1,11 +1,9 @@
{
lib.ports = {
keycloak = 8010;
vaultwarden = 8040;
wastebin = 8050;
keycloak = 8010;
vaultwarden = 8040;
wastebin = 8050;
prometheus = 9010;
blackbox = 9020;
alertmanager = 9030;
};
prometheus = 9010;
blackbox = 9020;
alertmanager = 9030;
}

View file

@ -1,11 +1,11 @@
{
lib,
config,
pkgs,
ports,
...
}:
let
port = config.lib.ports.keycloak;
port = ports.keycloak;
in
{
services.keycloak = {
@ -13,9 +13,10 @@ in
settings = {
cache = "local";
hostname = "id.ny4.dev";
http-enabled = true;
http-host = "127.0.0.1";
http-port = port;
proxy = "edge";
proxy-headers = "xforwarded";
};
database.passwordFile = toString (pkgs.writeText "password" "keycloak");
};

View file

@ -3,10 +3,10 @@
pkgs,
config,
nodes,
ports,
...
}:
let
inherit (config.lib) ports;
targets = lib.mapAttrsToList (_name: node: node.fqdn) nodes ++ [ "pek0.ny4.dev" ];
in
{

View file

@ -1,6 +1,11 @@
{ lib, config, ... }:
{
lib,
config,
ports,
...
}:
let
port = config.lib.ports.vaultwarden;
port = ports.vaultwarden;
in
{
services.vaultwarden = {

View file

@ -1,6 +1,6 @@
{ lib, config, ... }:
{ lib, ports, ... }:
let
port = config.lib.ports.wastebin;
port = ports.wastebin;
in
{
services.wastebin = {

View file

@ -2,7 +2,6 @@
{
imports = [
./anti-feature.nix
./ports.nix
./services/telegram-bot/danbooru_img_bot.nix
./services/ip-checker.nix
@ -11,6 +10,8 @@
../../../nixos/profiles/sing-box-server
];
_module.args.ports = import ./ports.nix;
system.stateVersion = "24.05";
networking.firewall.allowedUDPPorts = [ 443 ];

View file

@ -1,6 +1,4 @@
{
lib.ports = {
redlib = 8010;
ip-checker = 8020;
};
redlib = 8010;
ip-checker = 8020;
}

View file

@ -2,11 +2,11 @@
lib,
pkgs,
inputs,
config,
ports,
...
}:
let
port = config.lib.ports.ip-checker;
port = ports.ip-checker;
in
{
systemd.services."ip-checker" = {

View file

@ -1,6 +1,6 @@
{ lib, config, ... }:
{ lib, ports, ... }:
let
port = config.lib.ports.redlib;
port = ports.redlib;
in
{
services.redlib = {