From f645147c7e166f58dae22a49d3333f32aa32e1b7 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Fri, 30 Aug 2024 00:46:36 +0200 Subject: [PATCH] nixos/services.jmusicbot: remove `with lib;` --- nixos/modules/services/audio/jmusicbot.nix | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/nixos/modules/services/audio/jmusicbot.nix b/nixos/modules/services/audio/jmusicbot.nix index d1317facf273..6cd348e68e45 100644 --- a/nixos/modules/services/audio/jmusicbot.nix +++ b/nixos/modules/services/audio/jmusicbot.nix @@ -1,18 +1,16 @@ { config, lib, pkgs, ... }: - -with lib; let cfg = config.services.jmusicbot; in { options = { services.jmusicbot = { - enable = mkEnableOption "jmusicbot, a Discord music bot that's easy to set up and run yourself"; + enable = lib.mkEnableOption "jmusicbot, a Discord music bot that's easy to set up and run yourself"; - package = mkPackageOption pkgs "jmusicbot" { }; + package = lib.mkPackageOption pkgs "jmusicbot" { }; - stateDir = mkOption { - type = types.path; + stateDir = lib.mkOption { + type = lib.types.path; description = '' The directory where config.txt and serversettings.json is saved. If left as the default value this directory will automatically be created before JMusicBot starts, otherwise the sysadmin is responsible for ensuring the directory exists with appropriate ownership and permissions. @@ -23,20 +21,20 @@ in }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { systemd.services.jmusicbot = { wantedBy = [ "multi-user.target" ]; wants = [ "network-online.target" ]; after = [ "network-online.target" ]; description = "Discord music bot that's easy to set up and run yourself!"; - serviceConfig = mkMerge [{ + serviceConfig = lib.mkMerge [{ ExecStart = "${cfg.package}/bin/JMusicBot"; WorkingDirectory = cfg.stateDir; Restart = "always"; RestartSec = 20; DynamicUser = true; } - (mkIf (cfg.stateDir == "/var/lib/jmusicbot") { StateDirectory = "jmusicbot"; })]; + (lib.mkIf (cfg.stateDir == "/var/lib/jmusicbot") { StateDirectory = "jmusicbot"; })]; }; };