1 { config, lib, pkgs, ... }:
4 cfg = config.services.freeradius;
6 freeradiusService = cfg:
8 description = "FreeRadius server";
9 wantedBy = ["multi-user.target"];
10 after = ["network.target"];
11 wants = ["network.target"];
13 ${cfg.package}/bin/radiusd -C -d ${cfg.configDir} -l stdout
17 ExecStart = "${cfg.package}/bin/radiusd -f -d ${cfg.configDir} -l stdout" +
18 lib.optionalString cfg.debug " -xx";
20 "${cfg.package}/bin/radiusd -C -d ${cfg.configDir} -l stdout"
21 "${pkgs.coreutils}/bin/kill -HUP $MAINPID"
24 ProtectSystem = "full";
26 Restart = "on-failure";
28 LogsDirectory = "radius";
33 enable = lib.mkEnableOption "the freeradius server";
35 package = lib.mkPackageOption pkgs "freeradius" { };
37 configDir = lib.mkOption {
38 type = lib.types.path;
39 default = "/etc/raddb";
41 The path of the freeradius server configuration directory.
45 debug = lib.mkOption {
46 type = lib.types.bool;
49 Whether to enable debug logging for freeradius (-xx
50 option). This should not be left on, since it includes
51 sensitive data such as passwords in the logs.
64 services.freeradius = freeradiusConfig;
70 config = lib.mkIf (cfg.enable) {
74 /*uid = config.ids.uids.radius;*/
75 description = "Radius daemon user";
82 systemd.services.freeradius = freeradiusService cfg;
83 warnings = lib.optional cfg.debug "Freeradius debug logging is enabled. This will log passwords in plaintext to the journal!";