From 5edabf7c0b904e62b65027e2bc4dbed4e98788d1 Mon Sep 17 00:00:00 2001 From: Vladimir Serov Date: Mon, 12 Jun 2023 22:05:18 +0400 Subject: [PATCH] moonraker: add useGpiod --- nixos/modules/services/misc/moonraker.nix | 10 +++++- pkgs/servers/moonraker/default.nix | 39 ++++++++++++----------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/nixos/modules/services/misc/moonraker.nix b/nixos/modules/services/misc/moonraker.nix index 7e306d718e08..797e145c47a6 100644 --- a/nixos/modules/services/misc/moonraker.nix +++ b/nixos/modules/services/misc/moonraker.nix @@ -1,8 +1,8 @@ { config, lib, options, pkgs, ... }: with lib; let - pkg = pkgs.moonraker; cfg = config.services.moonraker; + pkg = cfg.package; opt = options.services.moonraker; format = pkgs.formats.ini { # https://github.com/NixOS/nixpkgs/pull/121613#issuecomment-885241996 @@ -18,6 +18,14 @@ in { services.moonraker = { enable = mkEnableOption (lib.mdDoc "Moonraker, an API web server for Klipper"); + package = mkOption { + type = with types; nullOr package; + default = pkgs.moonraker; + defaultText = literalExpression "pkgs.moonraker"; + example = literalExpression "pkgs.moonraker.override { useGpiod = true; }"; + description = lib.mdDoc "Moonraker package to use"; + }; + klipperSocket = mkOption { type = types.path; default = config.services.klipper.apiSocket; diff --git a/pkgs/servers/moonraker/default.nix b/pkgs/servers/moonraker/default.nix index 73595e6909ce..84e426d6ac5f 100644 --- a/pkgs/servers/moonraker/default.nix +++ b/pkgs/servers/moonraker/default.nix @@ -1,23 +1,26 @@ -{ lib, stdenvNoCC, fetchFromGitHub, python3, makeWrapper, unstableGitUpdater, nixosTests }: +{ lib, stdenvNoCC, fetchFromGitHub, python3, makeWrapper, unstableGitUpdater, nixosTests, useGpiod ? false }: let - pythonEnv = python3.withPackages (packages: with packages; [ - tornado - pyserial-asyncio - pillow - lmdb - streaming-form-data - distro - inotify-simple - libnacl - paho-mqtt - pycurl - zeroconf - preprocess-cancellation - jinja2 - dbus-next - apprise - ]); + pythonEnv = python3.withPackages (packages: + with packages; [ + tornado + pyserial-asyncio + pillow + lmdb + streaming-form-data + distro + inotify-simple + libnacl + paho-mqtt + pycurl + zeroconf + preprocess-cancellation + jinja2 + dbus-next + apprise + ] + ++ (lib.optionals useGpiod [ libgpiod ]) + ); in stdenvNoCC.mkDerivation rec { pname = "moonraker"; version = "unstable-2022-11-18";