1 { config, lib, pkgs, ... }:
3 cfg = config.services.alice-lg;
4 settingsFormat = pkgs.formats.ini { };
9 enable = lib.mkEnableOption "Alice Looking Glass";
11 package = lib.mkPackageOption pkgs "alice-lg" { };
13 settings = lib.mkOption {
14 type = settingsFormat.type;
17 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)
19 example = lib.literalExpression ''
22 # configures the built-in webserver and provides global application settings
23 listen_http = "127.0.0.1:7340";
24 enable_prefix_lookup = true;
26 store_backend = postgres;
27 routes_store_refresh_parallelism = 5;
28 neighbors_store_refresh_parallelism = 10000;
29 routes_store_refresh_interval = 5;
30 neighbors_store_refresh_interval = 5;
33 url = "postgres://postgres:postgres@localhost:5432/alice";
35 max_connections = 128;
38 routes_filtered_page_size = 250;
39 routes_accepted_page_size = 250;
40 routes_not_exported_page_size = 250;
48 config = lib.mkIf cfg.enable {
50 etc."alice-lg/alice.conf".source = settingsFormat.generate "alice-lg.conf" cfg.settings;
54 wants = [ "network.target" ];
55 after = [ "network.target" ];
56 wantedBy = [ "multi-user.target" ];
57 description = "Alice Looking Glass";
61 Restart = "on-failure";
63 ExecStart = "${cfg.package}/bin/alice-lg";
64 StateDirectoryMode = "0700";
66 CapabilityBoundingSet = "";
67 NoNewPrivileges = true;
68 ProtectSystem = "strict";
70 PrivateDevices = true;
72 ProtectHostname = true;
74 ProtectKernelTunables = true;
75 ProtectKernelModules = true;
76 ProtectKernelLogs = true;
77 ProtectControlGroups = true;
78 RestrictAddressFamilies = [ "AF_INET AF_INET6" ];
79 LockPersonality = true;
80 MemoryDenyWriteExecute = true;
81 RestrictRealtime = true;
82 RestrictSUIDSGID = true;
84 SystemCallArchitectures = "native";
85 SystemCallFilter = "~@clock @privileged @cpu-emulation @debug @keyring @module @mount @obsolete @raw-io @reboot @setuid @swap";
90 "-/etc/static/ssl/certs"