nixos/services.freeradius: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-28 21:19:07 +02:00 committed by Jörg Thalheim
parent a49fa6ee3b
commit 7cc95389d1

View File

@ -1,7 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.services.freeradius; cfg = config.services.freeradius;
@ -18,7 +15,7 @@ let
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.freeradius}/bin/radiusd -f -d ${cfg.configDir} -l stdout" + ExecStart = "${pkgs.freeradius}/bin/radiusd -f -d ${cfg.configDir} -l stdout" +
optionalString cfg.debug " -xx"; lib.optionalString cfg.debug " -xx";
ExecReload = [ ExecReload = [
"${pkgs.freeradius}/bin/radiusd -C -d ${cfg.configDir} -l stdout" "${pkgs.freeradius}/bin/radiusd -C -d ${cfg.configDir} -l stdout"
"${pkgs.coreutils}/bin/kill -HUP $MAINPID" "${pkgs.coreutils}/bin/kill -HUP $MAINPID"
@ -33,18 +30,18 @@ let
}; };
freeradiusConfig = { freeradiusConfig = {
enable = mkEnableOption "the freeradius server"; enable = lib.mkEnableOption "the freeradius server";
configDir = mkOption { configDir = lib.mkOption {
type = types.path; type = lib.types.path;
default = "/etc/raddb"; default = "/etc/raddb";
description = '' description = ''
The path of the freeradius server configuration directory. The path of the freeradius server configuration directory.
''; '';
}; };
debug = mkOption { debug = lib.mkOption {
type = types.bool; type = lib.types.bool;
default = false; default = false;
description = '' description = ''
Whether to enable debug logging for freeradius (-xx Whether to enable debug logging for freeradius (-xx
@ -68,7 +65,7 @@ in
###### implementation ###### implementation
config = mkIf (cfg.enable) { config = lib.mkIf (cfg.enable) {
users = { users = {
users.radius = { users.radius = {
@ -79,7 +76,7 @@ in
}; };
systemd.services.freeradius = freeradiusService cfg; systemd.services.freeradius = freeradiusService cfg;
warnings = optional cfg.debug "Freeradius debug logging is enabled. This will log passwords in plaintext to the journal!"; warnings = lib.optional cfg.debug "Freeradius debug logging is enabled. This will log passwords in plaintext to the journal!";
}; };