fix(server): nixpkgs config; migrate to new frp module

This commit is contained in:
2025-11-24 18:04:11 +08:00
parent 4509f9edf5
commit f4c1b313ce
7 changed files with 279 additions and 273 deletions

View File

@@ -176,257 +176,245 @@
]; ];
services.frp = { services.frp = {
enable = true; enable = true;
role = "client"; instances."" = {
settings = { role = "client";
serverAddr = "{{ .Envs.FRP_SERVER_ADDR }}"; settings = {
serverPort = 7000; serverAddr = "{{ .Envs.FRP_SERVER_ADDR }}";
auth.token = "{{ .Envs.FRP_AUTH_TOKEN }}"; serverPort = 7000;
proxies = [ auth.token = "{{ .Envs.FRP_AUTH_TOKEN }}";
{ proxies = [
name = "nextcloud-http"; {
type = "http"; name = "nextcloud-http";
localIP = "127.0.0.1"; type = "http";
localPort = 80; localIP = "127.0.0.1";
customDomains = [ "nextcloud.imxyy.top" ]; localPort = 80;
} customDomains = [ "nextcloud.imxyy.top" ];
{ }
name = "nextcloud-https"; {
type = "https"; name = "nextcloud-https";
localIP = "127.0.0.1"; type = "https";
localPort = 443; localIP = "127.0.0.1";
customDomains = [ "nextcloud.imxyy.top" ]; localPort = 443;
} customDomains = [ "nextcloud.imxyy.top" ];
}
{ {
name = "oidc-http"; name = "oidc-http";
type = "http"; type = "http";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 80; localPort = 80;
customDomains = [ "oidc.imxyy.top" ]; customDomains = [ "oidc.imxyy.top" ];
} }
{ {
name = "oidc-https"; name = "oidc-https";
type = "https"; type = "https";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 443; localPort = 443;
customDomains = [ "oidc.imxyy.top" ]; customDomains = [ "oidc.imxyy.top" ];
} }
{ {
name = "mail-http"; name = "mail-http";
type = "http"; type = "http";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 80; localPort = 80;
customDomains = [ "mail.imxyy.top" ]; customDomains = [ "mail.imxyy.top" ];
} }
{ {
name = "mail-https"; name = "mail-https";
type = "https"; type = "https";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 443; localPort = 443;
customDomains = [ "mail.imxyy.top" ]; customDomains = [ "mail.imxyy.top" ];
} }
{ {
name = "gitea-ssh"; name = "gitea-ssh";
type = "tcp"; type = "tcp";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 2222; localPort = 2222;
remotePort = 2222; remotePort = 2222;
} }
{ {
name = "gitea-http"; name = "gitea-http";
type = "http"; type = "http";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 80; localPort = 80;
customDomains = [ "git.imxyy.top" ]; customDomains = [ "git.imxyy.top" ];
} }
{ {
name = "gitea-https"; name = "gitea-https";
type = "https"; type = "https";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 443; localPort = 443;
customDomains = [ "git.imxyy.top" ]; customDomains = [ "git.imxyy.top" ];
} }
{ {
name = "vault-http"; name = "vault-http";
type = "http"; type = "http";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 80; localPort = 80;
customDomains = [ "vault.imxyy.top" ]; customDomains = [ "vault.imxyy.top" ];
} }
{ {
name = "vault-https"; name = "vault-https";
type = "https"; type = "https";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 443; localPort = 443;
customDomains = [ "vault.imxyy.top" ]; customDomains = [ "vault.imxyy.top" ];
} }
{ {
name = "home-http"; name = "home-http";
type = "http"; type = "http";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 80; localPort = 80;
customDomains = [ "home.imxyy.top" ]; customDomains = [ "home.imxyy.top" ];
} }
{ {
name = "home-https"; name = "home-https";
type = "https"; type = "https";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 443; localPort = 443;
customDomains = [ "home.imxyy.top" ]; customDomains = [ "home.imxyy.top" ];
} }
{ {
name = "coder-http"; name = "coder-http";
type = "http"; type = "http";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 80; localPort = 80;
customDomains = [ "coder.imxyy.top" ]; customDomains = [ "coder.imxyy.top" ];
} }
{ {
name = "coder-https"; name = "coder-https";
type = "https"; type = "https";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 443; localPort = 443;
customDomains = [ "coder.imxyy.top" ]; customDomains = [ "coder.imxyy.top" ];
} }
{ {
name = "ai-http"; name = "grafana-http";
type = "http"; type = "http";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 80; localPort = 80;
customDomains = [ "ai.imxyy.top" ]; customDomains = [ "grafana.imxyy.top" ];
} }
{ {
name = "ai-https"; name = "grafana-https";
type = "https"; type = "https";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 443; localPort = 443;
customDomains = [ "ai.imxyy.top" ]; customDomains = [ "grafana.imxyy.top" ];
} }
{ {
name = "grafana-http"; name = "siyuan-http";
type = "http"; type = "http";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 80; localPort = 80;
customDomains = [ "grafana.imxyy.top" ]; customDomains = [ "sy.imxyy.top" ];
} }
{ {
name = "grafana-https"; name = "siyuan-https";
type = "https"; type = "https";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 443; localPort = 443;
customDomains = [ "grafana.imxyy.top" ]; customDomains = [ "sy.imxyy.top" ];
} }
{ {
name = "siyuan-http"; name = "matrix-root-http";
type = "http"; type = "http";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 80; localPort = 80;
customDomains = [ "sy.imxyy.top" ]; customDomains = [ "imxyy.top" ];
} }
{ {
name = "siyuan-https"; name = "matrix-root-https";
type = "https"; type = "https";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 443; localPort = 443;
customDomains = [ "sy.imxyy.top" ]; customDomains = [ "imxyy.top" ];
} }
{
name = "matrix-http";
type = "http";
localIP = "127.0.0.1";
localPort = 80;
customDomains = [ "matrix.imxyy.top" ];
}
{
name = "matrix-https";
type = "https";
localIP = "127.0.0.1";
localPort = 443;
customDomains = [ "matrix.imxyy.top" ];
}
{ {
name = "matrix-root-http"; name = "immich-http";
type = "http"; type = "http";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 80; localPort = 80;
customDomains = [ "imxyy.top" ]; customDomains = [ "immich.imxyy.top" ];
} }
{ {
name = "matrix-root-https"; name = "immich-https";
type = "https"; type = "https";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 443; localPort = 443;
customDomains = [ "imxyy.top" ]; customDomains = [ "immich.imxyy.top" ];
} }
{
name = "matrix-http";
type = "http";
localIP = "127.0.0.1";
localPort = 80;
customDomains = [ "matrix.imxyy.top" ];
}
{
name = "matrix-https";
type = "https";
localIP = "127.0.0.1";
localPort = 443;
customDomains = [ "matrix.imxyy.top" ];
}
{ {
name = "immich-http"; name = "memo-http";
type = "http"; type = "http";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 80; localPort = 80;
customDomains = [ "immich.imxyy.top" ]; customDomains = [ "memo.imxyy.top" ];
} }
{ {
name = "immich-https"; name = "memo-https";
type = "https"; type = "https";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 443; localPort = 443;
customDomains = [ "immich.imxyy.top" ]; customDomains = [ "memo.imxyy.top" ];
} }
{
name = "memo-http";
type = "http";
localIP = "127.0.0.1";
localPort = 80;
customDomains = [ "memo.imxyy.top" ];
}
{
name = "memo-https";
type = "https";
localIP = "127.0.0.1";
localPort = 443;
customDomains = [ "memo.imxyy.top" ];
}
{ {
name = "efl-matrix-http"; name = "efl-matrix-http";
type = "http"; type = "http";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 80; localPort = 80;
customDomains = [ "mtx.eflx.top" ]; customDomains = [ "mtx.eflx.top" ];
} }
{ {
name = "efl-matrix-https"; name = "efl-matrix-https";
type = "https"; type = "https";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 443; localPort = 443;
customDomains = [ "mtx.eflx.top" ]; customDomains = [ "mtx.eflx.top" ];
} }
{ {
name = "efl-send-http"; name = "efl-send-http";
type = "http"; type = "http";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 80; localPort = 80;
customDomains = [ "send.eflx.top" ]; customDomains = [ "send.eflx.top" ];
} }
{ {
name = "efl-send-https"; name = "efl-send-https";
type = "https"; type = "https";
localIP = "127.0.0.1"; localIP = "127.0.0.1";
localPort = 443; localPort = 443;
customDomains = [ "send.eflx.top" ]; customDomains = [ "send.eflx.top" ];
} }
]; ];
};
}; };
}; };
@@ -523,7 +511,6 @@
"oidc" "oidc"
"mc" "mc"
"music" "music"
"ai"
"sy" "sy"
"immich" "immich"
]; ];

View File

@@ -55,7 +55,7 @@ in
} }
''; '';
}; };
services.frp.settings.proxies = [ services.frp.instances."".settings.proxies = [
{ {
name = "plant-http"; name = "plant-http";
type = "http"; type = "http";

View File

@@ -36,7 +36,7 @@ in
reverse_proxy :8100 reverse_proxy :8100
''; '';
}; };
services.frp.settings.proxies = [ services.frp.instances."".settings.proxies = [
{ {
name = "rsshub-http"; name = "rsshub-http";
type = "http"; type = "http";

View File

@@ -30,7 +30,7 @@
reverse_proxy :8101 reverse_proxy :8101
''; '';
}; };
services.frp.settings.proxies = [ services.frp.instances."".settings.proxies = [
{ {
name = "sshwifty-http"; name = "sshwifty-http";
type = "http"; type = "http";

View File

@@ -42,15 +42,19 @@ local servers = {
command = { "nixfmt" }, command = { "nixfmt" },
}, },
nixpkgs = { nixpkgs = {
-- language=nix
expr = [[ expr = [[
let if builtins.pathExists ./flake.lock then
lock = builtins.fromJSON (builtins.readFile ./flake.lock); let
nodeName = lock.nodes.root.inputs.nixpkgs; lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in nodeName = lock.nodes.root.inputs.nixpkgs;
import (fetchTarball { in
url = lock.nodes.${nodeName}.locked.url or "https://github.com/NixOS/nixpkgs/archive/${lock.nodes.${nodeName}.locked.rev}.tar.gz"; import (fetchTarball {
sha256 = lock.nodes.${nodeName}.locked.narHash; url = lock.nodes.${nodeName}.locked.url or "https://github.com/NixOS/nixpkgs/archive/${lock.nodes.${nodeName}.locked.rev}.tar.gz";
}) { } sha256 = lock.nodes.${nodeName}.locked.narHash;
}) { }
else
import <nixpkgs> { }
]], ]],
}, },
}, },

View File

@@ -1,8 +1,8 @@
{ {
self, self,
withSystem,
lib, lib,
inputs, inputs,
pkgsParams,
... ...
}: }:
let let
@@ -15,9 +15,11 @@ let
); );
pkgsModule = pkgsModule =
{ config, ... }: { config, ... }:
withSystem config.nixpkgs.hostPlatform.system (perSystem: { {
nixpkgs.pkgs = perSystem.pkgs; nixpkgs = pkgsParams // {
}); inherit (config.nixpkgs.hostPlatform) system;
};
};
hmModule = { hmModule = {
home-manager = { home-manager = {
sharedModules = [ sharedModules = [
@@ -26,6 +28,10 @@ let
inputs.stylix.homeModules.stylix inputs.stylix.homeModules.stylix
inputs.noctalia.homeModules.default inputs.noctalia.homeModules.default
inputs.zen.homeModules.beta inputs.zen.homeModules.beta
{
nixpkgs = lib.mkForce { };
}
]; ];
useGlobalPkgs = true; useGlobalPkgs = true;
}; };

View File

@@ -2,29 +2,38 @@
inputs, inputs,
lib, lib,
config, config,
pkgsParams,
... ...
}: }:
{ {
perSystem = _module.args = {
{ system, pkgs, ... }: pkgsParams = {
{ overlays = builtins.attrValues config.flake.overlays ++ [
_module.args.pkgs = import inputs.nixpkgs { inputs.go-musicfox.overlays.default
inherit system; inputs.niri.overlays.niri
overlays = builtins.attrValues config.flake.overlays ++ [ inputs.fenix.overlays.default
inputs.go-musicfox.overlays.default inputs.angrr.overlays.default
inputs.niri.overlays.niri (final: prev: {
inputs.fenix.overlays.default darkly-qt5 = inputs.darkly.packages.${final.stdenv.hostPlatform.system}.darkly-qt5;
inputs.angrr.overlays.default darkly-qt6 = inputs.darkly.packages.${final.stdenv.hostPlatform.system}.darkly-qt6;
(final: prev: {
darkly-qt5 = inputs.darkly.packages.${final.stdenv.hostPlatform.system}.darkly-qt5;
darkly-qt6 = inputs.darkly.packages.${final.stdenv.hostPlatform.system}.darkly-qt6;
noctalia-shell = inputs.noctalia.packages.${final.stdenv.hostPlatform.system}.default; noctalia-shell = inputs.noctalia.packages.${final.stdenv.hostPlatform.system}.default;
}) })
]; ];
config.allowUnfree = true; config.allowUnfree = true;
flake.setNixPath = false; flake.setNixPath = false;
}; };
};
perSystem =
{
system,
pkgs,
...
}:
let
in
{
_module.args.pkgs = import inputs.nixpkgs (pkgsParams // { inherit system; });
legacyPackages = pkgs; legacyPackages = pkgs;