From ba6e7e10bb36eaffba616b3ff1213e4a17a905c5 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Fri, 30 Aug 2024 00:46:44 +0200 Subject: [PATCH] nixos/services.readarr: remove `with lib;` --- nixos/modules/services/misc/readarr.nix | 31 +++++++++++-------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/nixos/modules/services/misc/readarr.nix b/nixos/modules/services/misc/readarr.nix index b76a70859f75..15f1bde2cdfc 100644 --- a/nixos/modules/services/misc/readarr.nix +++ b/nixos/modules/services/misc/readarr.nix @@ -1,41 +1,38 @@ { config, pkgs, lib, ... }: - -with lib; - let cfg = config.services.readarr; in { options = { services.readarr = { - enable = mkEnableOption "Readarr, a Usenet/BitTorrent ebook downloader"; + enable = lib.mkEnableOption "Readarr, a Usenet/BitTorrent ebook downloader"; - dataDir = mkOption { - type = types.str; + dataDir = lib.mkOption { + type = lib.types.str; default = "/var/lib/readarr/"; description = "The directory where Readarr stores its data files."; }; - package = mkPackageOption pkgs "readarr" { }; + package = lib.mkPackageOption pkgs "readarr" { }; - openFirewall = mkOption { - type = types.bool; + openFirewall = lib.mkOption { + type = lib.types.bool; default = false; description = '' Open ports in the firewall for Readarr ''; }; - user = mkOption { - type = types.str; + user = lib.mkOption { + type = lib.types.str; default = "readarr"; description = '' User account under which Readarr runs. ''; }; - group = mkOption { - type = types.str; + group = lib.mkOption { + type = lib.types.str; default = "readarr"; description = '' Group under which Readarr runs. @@ -44,7 +41,7 @@ in }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { systemd.tmpfiles.settings."10-readarr".${cfg.dataDir}.d = { inherit (cfg) user group; mode = "0700"; @@ -64,11 +61,11 @@ in }; }; - networking.firewall = mkIf cfg.openFirewall { + networking.firewall = lib.mkIf cfg.openFirewall { allowedTCPPorts = [ 8787 ]; }; - users.users = mkIf (cfg.user == "readarr") { + users.users = lib.mkIf (cfg.user == "readarr") { readarr = { description = "Readarr service"; home = cfg.dataDir; @@ -77,7 +74,7 @@ in }; }; - users.groups = mkIf (cfg.group == "readarr") { + users.groups = lib.mkIf (cfg.group == "readarr") { readarr = { }; }; };