From fa670d72897ca2b80e4d04d0003455e002644061 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Tue, 5 Dec 2023 12:43:57 +0300 Subject: [PATCH] modules: add octoprint module with plugins --- nixos/hosts/asus-gl553vd/default.nix | 6 +-- nixos/hosts/default.nix | 1 + nixos/modules/octoprint.nix | 58 ++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 nixos/modules/octoprint.nix diff --git a/nixos/hosts/asus-gl553vd/default.nix b/nixos/hosts/asus-gl553vd/default.nix index 3e3bf40..7f8fd82 100644 --- a/nixos/hosts/asus-gl553vd/default.nix +++ b/nixos/hosts/asus-gl553vd/default.nix @@ -84,9 +84,5 @@ services.languagetool.enable = true; # 3D printing - services.octoprint = { - enable = true; - port = 33002; - plugins = ps: [ ps.stlviewer ]; - }; + local.octoprint.enable = true; } diff --git a/nixos/hosts/default.nix b/nixos/hosts/default.nix index e6f7e30..6b24aae 100644 --- a/nixos/hosts/default.nix +++ b/nixos/hosts/default.nix @@ -43,6 +43,7 @@ in extraModules = [ hardware.common-cpu-intel ../modules/nix.nix + ../modules/octoprint.nix ../modules/wireguard-client.nix ../../home/users/jan # ../../home/users/nas diff --git a/nixos/modules/octoprint.nix b/nixos/modules/octoprint.nix new file mode 100644 index 0000000..b52dba6 --- /dev/null +++ b/nixos/modules/octoprint.nix @@ -0,0 +1,58 @@ +{ lib, pkgs, config, ... }: + +let + cfg = config.local.octoprint; +in +{ + options.local.octoprint = with lib; { + enable = mkEnableOption "octoprint"; + }; + + config = lib.mkIf cfg.enable { + services.octoprint = { + enable = true; + port = 33002; + plugins = ps: + let + octoprintDisplayLayerProgress = ps.buildPlugin rec { + pname = "DisplayLayerProgress"; + version = "1.28.0"; + + src = pkgs.fetchFromGitHub { + owner = "OllisGit"; + repo = "OctoPrint-DisplayLayerProgress"; + rev = version; + sha256 = "sha256-FoQGv7a3ktodyQKOwR69/9Up+wPoW5NDq+k5LfP9WYs="; + }; + }; + octoprintDashboard = ps.buildPlugin rec { + pname = "Dashboard"; + version = "1.19.10"; + + src = pkgs.fetchFromGitHub { + owner = "j7126"; + repo = "OctoPrint-Dashboard"; + rev = version; + sha256 = "sha256-d3HtSgJ9d6k7+F86aDuhq31jWZHdNxncFcK6MYPgUKo="; + }; + }; + octoprintBedLevelVisualizer = ps.buildPlugin rec { + pname = "BedLevelVisualizer"; + version = "1.1.1"; + + src = pkgs.fetchFromGitHub { + owner = "jneilliii"; + repo = "OctoPrint-BedLevelVisualizer"; + rev = version; + sha256 = "sha256-6JcYvYgEmphp5zz4xZi4G0yTo4FCIR6Yh+MXYK7H7+w="; + }; + }; + in + [ + octoprintDisplayLayerProgress + octoprintDashboard + octoprintBedLevelVisualizer + ]; + }; + }; +}