nixos/alice-lg: init

Janik H 8ed86700 c2690b65

Changed files
+149
nixos
doc
manual
release-notes
modules
services
networking
tests
+2
nixos/doc/manual/release-notes/rl-2305.section.md
···
- [photoprism](https://photoprism.app/), a AI-Powered Photos App for the Decentralized Web. Available as [services.photoprism](options.html#opt-services.photoprism.enable).
+
- [alice-lg](github.com/alice-lg/alice-lg), a looking-glass for BGP sessions. Available as [services.alice-lg](#opt-services.alice-lg.enable).
+
- [peroxide](https://github.com/ljanyst/peroxide), a fork of the official [ProtonMail bridge](https://github.com/ProtonMail/proton-bridge) that aims to be similar to [Hydroxide](https://github.com/emersion/hydroxide). Available as [services.peroxide](#opt-services.peroxide.enable).
- [autosuspend](https://github.com/languitar/autosuspend), a python daemon that suspends a system if certain conditions are met, or not met.
+1
nixos/modules/module-list.nix
···
./services/network-filesystems/yandex-disk.nix
./services/networking/3proxy.nix
./services/networking/adguardhome.nix
+
./services/networking/alice-lg.nix
./services/networking/amuled.nix
./services/networking/antennas.nix
./services/networking/aria2.nix
+101
nixos/modules/services/networking/alice-lg.nix
···
+
{ config, lib, pkgs, ... }:
+
+
with lib;
+
+
let
+
cfg = config.services.alice-lg;
+
settingsFormat = pkgs.formats.ini { };
+
in
+
{
+
options = {
+
services.alice-lg = {
+
enable = mkEnableOption (lib.mdDoc "Alice Looking Glass");
+
+
package = mkPackageOptionMD pkgs "alice-lg" { };
+
+
settings = mkOption {
+
type = settingsFormat.type;
+
default = { };
+
description = lib.mdDoc ''
+
alice-lg configuration, for configuration options see the example on [github](https://github.com/alice-lg/alice-lg/blob/main/etc/alice-lg/alice.example.conf)
+
'';
+
example = literalExpression ''
+
{
+
server = {
+
# configures the built-in webserver and provides global application settings
+
listen_http = "127.0.0.1:7340";
+
enable_prefix_lookup = true;
+
asn = 9033;
+
store_backend = postgres;
+
routes_store_refresh_parallelism = 5;
+
neighbors_store_refresh_parallelism = 10000;
+
routes_store_refresh_interval = 5;
+
neighbors_store_refresh_interval = 5;
+
};
+
postgres = {
+
url = "postgres://postgres:postgres@localhost:5432/alice";
+
min_connections = 2;
+
max_connections = 128;
+
};
+
pagination = {
+
routes_filtered_page_size = 250;
+
routes_accepted_page_size = 250;
+
routes_not_exported_page_size = 250;
+
};
+
}
+
'';
+
};
+
};
+
};
+
+
config = lib.mkIf cfg.enable {
+
environment = {
+
etc."alice-lg/alice.conf".source = settingsFormat.generate "alice-lg.conf" cfg.settings;
+
};
+
systemd.services = {
+
alice-lg = {
+
wants = [ "network.target" ];
+
after = [ "network.target" ];
+
wantedBy = [ "multi-user.target" ];
+
description = "Alice Looking Glass";
+
serviceConfig = {
+
DynamicUser = true;
+
Type = "simple";
+
Restart = "on-failure";
+
RestartSec = 15;
+
ExecStart = "${cfg.package}/bin/alice-lg";
+
StateDirectoryMode = "0700";
+
UMask = "0007";
+
CapabilityBoundingSet = "";
+
NoNewPrivileges = true;
+
ProtectSystem = "strict";
+
PrivateTmp = true;
+
PrivateDevices = true;
+
PrivateUsers = true;
+
ProtectHostname = true;
+
ProtectClock = true;
+
ProtectKernelTunables = true;
+
ProtectKernelModules = true;
+
ProtectKernelLogs = true;
+
ProtectControlGroups = true;
+
RestrictAddressFamilies = [ "AF_INET AF_INET6" ];
+
LockPersonality = true;
+
MemoryDenyWriteExecute = true;
+
RestrictRealtime = true;
+
RestrictSUIDSGID = true;
+
PrivateMounts = true;
+
SystemCallArchitectures = "native";
+
SystemCallFilter = "~@clock @privileged @cpu-emulation @debug @keyring @module @mount @obsolete @raw-io @reboot @setuid @swap";
+
BindReadOnlyPaths = [
+
"-/etc/resolv.conf"
+
"-/etc/nsswitch.conf"
+
"-/etc/ssl/certs"
+
"-/etc/static/ssl/certs"
+
"-/etc/hosts"
+
"-/etc/localtime"
+
];
+
};
+
};
+
};
+
};
+
}
+44
nixos/tests/alice-lg.nix
···
+
# This test does a basic functionality check for alice-lg
+
+
{ system ? builtins.currentSystem
+
, pkgs ? import ../.. { inherit system; config = { }; }
+
}:
+
+
let
+
inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;
+
inherit (pkgs.lib) optionalString;
+
in
+
makeTest {
+
name = "birdwatcher";
+
nodes = {
+
host1 = {
+
environment.systemPackages = with pkgs; [ jq ];
+
services.alice-lg = {
+
enable = true;
+
settings = {
+
server = {
+
listen_http = "[::]:7340";
+
enable_prefix_lookup = true;
+
asn = 1;
+
routes_store_refresh_parallelism = 5;
+
neighbors_store_refresh_parallelism = 10000;
+
routes_store_refresh_interval = 5;
+
neighbors_store_refresh_interval = 5;
+
};
+
housekeeping = {
+
interval = 5;
+
force_release_memory = true;
+
};
+
};
+
};
+
};
+
};
+
+
testScript = ''
+
start_all()
+
+
host1.wait_for_unit("alice-lg.service")
+
host1.wait_for_open_port(7340)
+
host1.succeed("curl http://[::]:7340 | grep 'Alice BGP Looking Glass'")
+
'';
+
}
+1
nixos/tests/all-tests.nix
···
airsonic = handleTest ./airsonic.nix {};
akkoma = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./akkoma.nix {};
akkoma-confined = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./akkoma.nix { confined = true; };
+
alice-lg = handleTest ./alice-lg.nix {};
allTerminfo = handleTest ./all-terminfo.nix {};
alps = handleTest ./alps.nix {};
amazon-init-shell = handleTest ./amazon-init-shell.nix {};