Add webone, misc changes.

This commit is contained in:
Fern Garden 2025-07-09 12:02:55 +08:00
parent f1216bc9ad
commit 997b93d6ca
5 changed files with 102 additions and 22 deletions

7
flake.lock generated
View file

@ -307,17 +307,16 @@
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1752022159, "lastModified": 1752031448,
"narHash": "sha256-WFkQ1WA+BRLuwfmh6uMym3IoUSXOu2sSM5XzalsLeUQ=", "narHash": "sha256-5cWr89OO+rt0saYETbLOIsKG0XYQqlgZ33xUMeQ1a1M=",
"owner": "firewalkwithm3", "owner": "firewalkwithm3",
"repo": "webone", "repo": "webone",
"rev": "256f5e115ceffb71fd2d61e0c7cb9b6b55c7571a", "rev": "04cbb02463e52fd917944ee3f7174218d6fa42a5",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "firewalkwithm3", "owner": "firewalkwithm3",
"repo": "webone", "repo": "webone",
"rev": "256f5e115ceffb71fd2d61e0c7cb9b6b55c7571a",
"type": "github" "type": "github"
} }
} }

View file

@ -15,7 +15,7 @@
# Packages. # Packages.
fluffychat2.url = "github:NixOS/nixpkgs?ref=pull/419632/head"; # FluffyChat 2.0.0 fluffychat2.url = "github:NixOS/nixpkgs?ref=pull/419632/head"; # FluffyChat 2.0.0
feishin0_17.url = "github:NixOS/nixpkgs?ref=pull/414929/head"; # Feishin 0.17.0 feishin0_17.url = "github:NixOS/nixpkgs?ref=pull/414929/head"; # Feishin 0.17.0
webone.url = "github:firewalkwithm3/webone?rev=256f5e115ceffb71fd2d61e0c7cb9b6b55c7571a"; # WebOne HTTP proxy. webone.url = "github:firewalkwithm3/webone"; # WebOne HTTP proxy.
}; };
outputs = outputs =
@ -27,11 +27,12 @@
sops-nix, sops-nix,
fluffychat2, fluffychat2,
feishin0_17, feishin0_17,
webone,
... ...
}: }:
with nixpkgs.lib;
let let
mkHost = mkHost =
with nixpkgs.lib;
{ {
hostname, hostname,
suite, suite,
@ -43,21 +44,30 @@
system = platform; system = platform;
specialArgs = { specialArgs = {
inherit hostname suite platform user; # Inherit variables. inherit
secrets = builtins.toString inputs.secrets; # Secrets directory. hostname
# Packages suite
userPkgs = { platform
user
; # Inherit variables.
userPackages = {
fluffychat = fluffychat2.legacyPackages.${system}.fluffychat; fluffychat = fluffychat2.legacyPackages.${system}.fluffychat;
feishin = feishin0_17.legacyPackages.${system}.feishin; feishin = feishin0_17.legacyPackages.${system}.feishin;
webone = webone.packages.${system}.default; webone = webone.packages.${system}.default;
}; };
secrets = builtins.toString inputs.secrets; # Secrets directory.
}; };
modules = [ modules =
[
./suites/common.nix ./suites/common.nix
./suites/${suite}.nix ./suites/${suite}.nix
./hosts/${suite}/${hostname}.nix ./hosts/${suite}/${hostname}.nix
] ++ extraModules; ]
++ (filesystem.listFilesRecursive ./modules)
++ extraModules;
}; };
in in
{ {

View file

@ -22,5 +22,11 @@
}; };
# Open ports for DHCP server. # Open ports for DHCP server.
networking.firewall.allowedUDPPorts = [ 53 67 ]; networking.firewall.allowedUDPPorts = [
53
67
];
# Enable WebOne HTTP proxy.
services.webone.enable = true;
} }

65
modules/webone.nix Normal file
View file

@ -0,0 +1,65 @@
{
config,
lib,
userPackages,
...
}:
with lib;
let
cfg = config.services.webone;
in
{
options.services.webone.enable = mkEnableOption "Enable WebOne HTTP proxy.";
config = mkIf cfg.enable {
users.groups.webone = { };
users.users.webone = {
createHome = true;
isSystemUser = true;
home = "/var/lib/webone";
group = "webone";
};
systemd.tmpfiles.settings = {
"10-webone" = {
"/var/log/webone.log" = {
f = {
group = "webone";
mode = "0664";
user = "webone";
};
};
"/etc/webone.conf.d" = {
d = {
group = "webone";
mode = "0755";
user = "webone";
};
};
};
};
systemd.services.webone = {
description = "WebOne HTTP Proxy Server";
documentation = [ "https://github.com/atauenis/webone/wiki/" ];
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "default.target" ];
startLimitIntervalSec = 5;
startLimitBurst = 3;
environment = {
OPENSSL_CONF = "${userPackages.webone}/lib/webone/openssl_webone.cnf";
};
serviceConfig = {
Type = "simple";
User = "webone";
Group = "webone";
ExecStart = "${userPackages.webone}/bin/webone";
TimeoutStopSec = "10";
Restart = "on-failure";
RestartSec = "5";
};
};
};
}

View file

@ -1,6 +1,6 @@
{ {
pkgs, pkgs,
userPkgs, userPackages,
lib, lib,
... ...
}: }:
@ -109,7 +109,7 @@ with lib;
caligula caligula
celluloid celluloid
discord discord
userPkgs.feishin userPackages.feishin
ghostty ghostty
gimp3 gimp3
glabels-qt glabels-qt
@ -137,7 +137,7 @@ with lib;
}) })
# FluffyChat 2.0.0 with fixed desktop item. # FluffyChat 2.0.0 with fixed desktop item.
(userPkgs.fluffychat.overrideAttrs ( (userPackages.fluffychat.overrideAttrs (
finalAttrs: previousAttrs: { finalAttrs: previousAttrs: {
desktopItems = [ desktopItems = [
((builtins.elemAt previousAttrs.desktopItems 0).override { startupWMClass = "fluffychat"; }) ((builtins.elemAt previousAttrs.desktopItems 0).override { startupWMClass = "fluffychat"; })