diff options
author | Felix Buehler | 2024-08-24 22:05:51 +0200 |
---|---|---|
committer | Felix Buehler | 2024-08-30 23:00:55 +0200 |
commit | d40cf96f750d38568991d807e1b76480e2fecc92 (patch) | |
tree | 65bc6c9118e72226b7e15aee02d15ce74c0bc1d6 | |
parent | a99bf845302c6d2f28314dc25e8ceeeb3724ad2f (diff) |
nixos/services.octoprint: remove `with lib;`
-rw-r--r-- | nixos/modules/services/misc/octoprint.nix | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/nixos/modules/services/misc/octoprint.nix b/nixos/modules/services/misc/octoprint.nix index 6290a6a7a537..42b2926a7a1e 100644 --- a/nixos/modules/services/misc/octoprint.nix +++ b/nixos/modules/services/misc/octoprint.nix @@ -1,7 +1,4 @@ { config, lib, pkgs, ... }: - -with lib; - let cfg = config.services.octoprint; @@ -13,7 +10,7 @@ let webcam.ffmpeg = "${pkgs.ffmpeg.bin}/bin/ffmpeg"; }; - fullConfig = recursiveUpdate cfg.extraConfig baseConfig; + fullConfig = lib.recursiveUpdate cfg.extraConfig baseConfig; cfgUpdate = pkgs.writeText "octoprint-config.yaml" (builtins.toJSON fullConfig); @@ -29,58 +26,58 @@ in services.octoprint = { - enable = mkEnableOption "OctoPrint, web interface for 3D printers"; + enable = lib.mkEnableOption "OctoPrint, web interface for 3D printers"; - host = mkOption { - type = types.str; + host = lib.mkOption { + type = lib.types.str; default = "0.0.0.0"; description = '' Host to bind OctoPrint to. ''; }; - port = mkOption { - type = types.port; + port = lib.mkOption { + type = lib.types.port; default = 5000; description = '' Port to bind OctoPrint to. ''; }; - openFirewall = mkOption { - type = types.bool; + openFirewall = lib.mkOption { + type = lib.types.bool; default = false; description = "Open ports in the firewall for OctoPrint."; }; - user = mkOption { - type = types.str; + user = lib.mkOption { + type = lib.types.str; default = "octoprint"; description = "User for the daemon."; }; - group = mkOption { - type = types.str; + group = lib.mkOption { + type = lib.types.str; default = "octoprint"; description = "Group for the daemon."; }; - stateDir = mkOption { - type = types.path; + stateDir = lib.mkOption { + type = lib.types.path; default = "/var/lib/octoprint"; description = "State directory of the daemon."; }; - plugins = mkOption { - type = types.functionTo (types.listOf types.package); + plugins = lib.mkOption { + type = lib.types.functionTo (lib.types.listOf lib.types.package); default = plugins: [ ]; - defaultText = literalExpression "plugins: []"; - example = literalExpression "plugins: with plugins; [ themeify stlviewer ]"; + defaultText = lib.literalExpression "plugins: []"; + example = lib.literalExpression "plugins: with plugins; [ themeify stlviewer ]"; description = "Additional plugins to be used. Available plugins are passed through the plugins input."; }; - extraConfig = mkOption { - type = types.attrs; + extraConfig = lib.mkOption { + type = lib.types.attrs; default = { }; description = "Extra options which are added to OctoPrint's YAML configuration file."; }; @@ -91,16 +88,16 @@ in ##### implementation - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { - users.users = optionalAttrs (cfg.user == "octoprint") { + users.users = lib.optionalAttrs (cfg.user == "octoprint") { octoprint = { group = cfg.group; uid = config.ids.uids.octoprint; }; }; - users.groups = optionalAttrs (cfg.group == "octoprint") { + users.groups = lib.optionalAttrs (cfg.group == "octoprint") { octoprint.gid = config.ids.gids.octoprint; }; @@ -137,6 +134,6 @@ in }; }; - networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.port ]; + networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [ cfg.port ]; }; } |