From 54475ae42b6307565fe24b03fa1381acd692f841 Mon Sep 17 00:00:00 2001 From: Marten Wijnja Date: Mon, 20 Apr 2026 12:26:17 +0200 Subject: [PATCH] Allow overriding Python version when calling the opsqueue_python Nix package --- README.md | 11 ++++++++++- libs/opsqueue_python/opsqueue_python.nix | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 71b5855..d372060 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,16 @@ Opsqueue's client libraries and binary itself are also available through `niv`. 2. Package the now available `opsqueue` library as part of your overlay, using e.g. ```nix -opsqueue = self.callPackage (sources.opsqueue + "/libs/opsqueue_python/opsqueue_python.nix") { }; +opsqueue_client = self.callPackage (sources.opsqueue + "/libs/opsqueue_python/opsqueue_python.nix") { }; +``` + +- If you want to override which Rust version is used, you can set the `rustToolchain` either in an overlay or by passing it as parameter directly to `callPackage`. +- If you want to override which Python version is used for the Python client, you can set `python` either in an overlay or by passing it as parameter directly to `callPackage`. + +For example: + +```nix +opsqueue_client = self.callPackage (sources.opsqueue + "/libs/opsqueue_python/opsqueue_python.nix") { python = mySpecialPython; }; ``` ## For devs modifying Opsqueue: Building, running, testing diff --git a/libs/opsqueue_python/opsqueue_python.nix b/libs/opsqueue_python/opsqueue_python.nix index 19e1365..079c3da 100644 --- a/libs/opsqueue_python/opsqueue_python.nix +++ b/libs/opsqueue_python/opsqueue_python.nix @@ -23,9 +23,12 @@ opentelemetry-api, opentelemetry-exporter-otlp, opentelemetry-sdk, + + # Downstream users can override which precise Python version is used. + # This is opt-in; by default we will use whatever 'python3' is in scope. + python ? (pkgs.python3), }: let - python = pkgs.python3; sources = import ../../nix/sources.nix; crane = import sources.crane { pkgs = pkgs; }; craneLib = crane.overrideToolchain (pkgs: rustToolchain);