nixos/services.plikd: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-30 00:46:41 +02:00
parent 8553d979a1
commit 66fecabb5f

View File

@ -1,7 +1,4 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.plikd;
@ -11,15 +8,15 @@ in
{
options = {
services.plikd = {
enable = mkEnableOption "plikd, a temporary file upload system";
enable = lib.mkEnableOption "plikd, a temporary file upload system";
openFirewall = mkOption {
type = types.bool;
openFirewall = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Open ports in the firewall for the plikd.";
};
settings = mkOption {
settings = lib.mkOption {
type = format.type;
default = {};
description = ''
@ -30,8 +27,8 @@ in
};
};
config = mkIf cfg.enable {
services.plikd.settings = mapAttrs (name: mkDefault) {
config = lib.mkIf cfg.enable {
services.plikd.settings = lib.mapAttrs (name: lib.mkDefault) {
ListenPort = 8080;
ListenAddress = "localhost";
DataBackend = "file";
@ -75,7 +72,7 @@ in
};
};
networking.firewall = mkIf cfg.openFirewall {
networking.firewall = lib.mkIf cfg.openFirewall {
allowedTCPPorts = [ cfg.settings.ListenPort ];
};
};