nebula-lighthouse-service: init at 2.0.0 (#454855)

This commit is contained in:
numinit
2025-11-12 10:56:25 +00:00
committed by GitHub
7 changed files with 191 additions and 0 deletions
+6
View File
@@ -3498,6 +3498,12 @@
githubId = 37768199;
name = "Christian Bergschneider";
};
bloominstrong = {
email = "github@mail.bloominstrong.net";
github = "bloominstrong";
githubId = 114744388;
name = "bloominstrong";
};
bloveless = {
email = "brennon.loveless@gmail.com";
github = "bloveless";
@@ -128,6 +128,8 @@
- [dwl](https://codeberg.org/dwl/dwl), a compact, hackable compositor for Wayland based on wlroots. Available as [programs.dwl](#opt-programs.dwl.enable).
- [nebula-lighthouse-service](https://github.com/manuels/nebula-lighthouse-service), a public Nebula VPN lighthouse service. Available as [services.nebula-lighthouse-service](#opt-services.nebula-lighthouse-service.enable).
- [angrr](https://github.com/linyinfeng/angrr), a service that automatically cleans up old auto GC roots. Available as [services.angrr](#opt-services.angrr.enable).
- [Sharkey](https://joinsharkey.org), a Sharkish microblogging platform. Available as [services.sharkey](#opt-services.sharkey.enable).
+1
View File
@@ -1267,6 +1267,7 @@
./services/networking/ncdns.nix
./services/networking/ncps.nix
./services/networking/ndppd.nix
./services/networking/nebula-lighthouse-service.nix
./services/networking/nebula.nix
./services/networking/netbird.nix
./services/networking/netbird/server.nix
@@ -0,0 +1,77 @@
{
config,
pkgs,
lib,
...
}:
let
inherit (lib) types;
cfg = config.services.nebula-lighthouse-service;
settingsFormat = pkgs.formats.yaml { };
in
{
options.services.nebula-lighthouse-service = {
enable = lib.mkEnableOption "nebula-lighthouse-service";
user = lib.mkOption {
type = types.str;
default = "nebula-lighthouse";
description = ''
The user and group to run nebula-lighthouse-service as.
'';
example = "nebula-lighthouse";
};
settings = lib.mkOption {
type = settingsFormat.type;
default = { };
description = ''
Configuration for nebula-lighthouse-service.
'';
example = {
max-port = 65535;
min-port = 49152;
"webserver.ip" = "127.0.0.1";
"webserver.port" = 8080;
};
};
};
config = lib.mkIf cfg.enable {
services.nebula-lighthouse-service.settings = {
min-port = lib.mkDefault 49152;
max-port = lib.mkDefault 65535;
"webserver.port" = lib.mkDefault 8080;
"webserver.ip" = lib.mkDefault "127.0.0.1";
};
environment.etc."nebula-lighthouse-service/config.yaml".source =
settingsFormat.generate "nebula-lighthouse-service-config.yaml" cfg.settings;
systemd.services.nebula-lighthouse-service = {
description = "Run nebula-lighthouse-service";
wants = [ "basic.target" ];
after = [
"basic.target"
"network.target"
];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "exec";
Restart = "always";
ExecStart = "${pkgs.nebula-lighthouse-service}/bin/nebula-lighthouse-service";
StateDirectory = "nebula-lighthouse-service";
User = cfg.user;
Group = cfg.user;
};
};
users.users.${cfg.user} = {
group = cfg.user;
description = "nebula-lighthouse-service user";
isSystemUser = true;
};
users.groups.${cfg.user} = { };
};
meta.maintainers = with lib.maintainers; [
bloominstrong
];
}
+1
View File
@@ -1011,6 +1011,7 @@ in
defaults.services.ncps.cache.dataPath = "/path/to/ncps";
};
ndppd = runTest ./ndppd.nix;
nebula-lighthouse-service = runTest ./nebula-lighthouse-service.nix;
nebula.connectivity = runTest ./nebula/connectivity.nix;
nebula.reload = runTest ./nebula/reload.nix;
neo4j = runTest ./neo4j.nix;
+33
View File
@@ -0,0 +1,33 @@
{ pkgs, lib, ... }:
{
name = "nebula-lighthouse-service";
meta.maintainers = with lib.maintainers; [
bloominstrong
];
nodes.machine =
{ ... }:
{
environment.systemPackages = with pkgs; [
nebula
];
services.nebula-lighthouse-service.enable = true;
};
testScript = ''
start_all()
machine.succeed(
'nebula-cert ca -duration $((10*365*24*60))m -name "NLS Test" -out-crt ca.crt -out-key ca.key',
'nebula-cert sign -duration $((365*24*60))m -ca-crt ca.crt -ca-key ca.key -name "lighthouse" -groups "lighthouse" -ip "10.0.100.1/24" -out-crt lighthouse.crt -out-key lighthouse.key'
)
machine.wait_for_unit("nebula-lighthouse-service.service")
machine.wait_for_open_port(8080)
machine.succeed(
'curl -X POST "http://127.0.0.1:8080/lighthouse/" -F ca_crt=@./ca.crt -F host_crt=@./lighthouse.crt -F host_key=@./lighthouse.key',
'curl -X GET "http://127.0.0.1:8080/lighthouse/" -F ca_crt=@./ca.crt -F host_crt=@./lighthouse.crt -F host_key=@./lighthouse.key',
'pgrep -x nebula'
)
'';
}
@@ -0,0 +1,71 @@
{
lib,
fetchFromGitHub,
python3Packages,
nebula,
nixosTests,
nix-update-script,
}:
python3Packages.buildPythonApplication rec {
pname = "nebula-lighthouse-service";
version = "2.0.0";
pyproject = true;
src = fetchFromGitHub {
owner = "manuels";
repo = "nebula-lighthouse-service";
tag = "v${version}";
hash = "sha256-cRwmOGuPEYlURVbaf9AwaSmhvUzzZvATv5RGPUztnbY=";
};
postPatch = ''
substituteInPlace nebula_lighthouse_service/webservice.py \
--replace-fail 'from pydantic' 'from pydantic.v1'
substituteInPlace setup.py \
--replace-fail 'pydantic==1.10.21' 'pydantic>=2' \
--replace-fail 'fastapi==0.116.1' 'fastapi' \
--replace-fail 'PyYAML==6.0.2' 'PyYAML' \
--replace-fail 'uvicorn==0.35.0' 'uvicorn' \
--replace-fail 'python-multipart==0.0.20' 'python-multipart'
'';
build-system = with python3Packages; [
setuptools
wheel
];
dependencies = with python3Packages; [
fastapi
pyyaml
uvicorn
pydantic
python-multipart
nebula
];
pythonImportsCheck = [
"nebula_lighthouse_service"
];
passthru.tests = {
nebula-lighthouse-service = nixosTests.nebula-lighthouse-service;
};
passthru.updateScript = nix-update-script { };
meta = {
description = "Public Nebula VPN Lighthouse Service";
longDescription = ''
In case you don't have a publicly accessible server to run your own Nebula VPN lighthouse,
you can use a public nebula-lighthouse-service instance without passing traffic through it.
'';
homepage = "https://github.com/manuels/nebula-lighthouse-service";
license = lib.licenses.agpl3Only;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [
bloominstrong
];
mainProgram = "nebula-lighthouse-service";
};
}