Skip to content

Commit a5bda9e

Browse files
committed
Allow overriding which Python version is used when building the Opsqueue Python library
1 parent 1c934cf commit a5bda9e

5 files changed

Lines changed: 7 additions & 29 deletions

File tree

default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
let
55
pkgs = import ./nix/nixpkgs-pinned.nix { };
66

7-
pythonEnv = pkgs.pythonChannable.withPackages (
7+
pythonEnv = pkgs.python.withPackages (
88
p: with p; [
99
click
1010
mypy

justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ mypy:
8989

9090
# Build Nix-derivations of binary and all libraries (release profile)
9191
[group('nix')]
92-
nix-build: (_nix-build "opsqueue" "pythonChannable.pkgs.opsqueue_python")
92+
nix-build: (_nix-build "opsqueue" "python.pkgs.opsqueue_python")
9393

9494
# Build Nix-derivation of binary (release profile)
9595
[group('nix')]
9696
nix-build-bin: (_nix-build "opsqueue")
9797

9898
# Build Nix-derivation of Python client library (release profile)
9999
[group('nix')]
100-
nix-build-python: (_nix-build "pythonChannable.pkgs.opsqueue_python")
100+
nix-build-python: (_nix-build "python.pkgs.opsqueue_python")
101101

102102
_nix-build +TARGETS:
103103
nix build --file nix/nixpkgs-pinned.nix --print-out-paths --print-build-logs --no-link --option sandbox true {{TARGETS}}

nix/overlay.nix

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,18 @@ let
88
# as we use when _not_ using Nix.
99
#
1010
# When using opsqueue as part of your own Nix derivations,
11-
# be sure to use an overlay to set `rustPlatform`
11+
# be sure to use an overlay to set `rustToolchain`
1212
# to the desired Rust version
1313
# if you want to use a different version from the default.
1414
rustToolchain = final.rust-bin.fromRustupToolchainFile ../rust-toolchain.toml;
15-
rustPlatform = prev.makeRustPlatform {
16-
rustc = rustToolchain;
17-
cargo = rustToolchain;
18-
};
1915

2016
crane = import sources.crane { pkgs = final; };
2117
craneLib = crane.overrideToolchain (pkgs: rustToolchain);
2218
in
2319
{
24-
# inherit naersk;
2520
inherit rustToolchain;
2621
opsqueue = final.callPackage ../opsqueue/opsqueue.nix { };
2722

28-
# The explicit choice is made not to override `python312`, as this will cause a rebuild of many
29-
# packages when nixpkgs uses python 3.12 as default python environment.
30-
# These packages should not be affected, e.g. cachix. This is because of a transitive
31-
# dependency on the Python packages that we override.
32-
# In our case cachix > ghc > shpinx > Python libraries.
33-
pythonChannable = prev.python312.override { packageOverrides = pythonOverlay; };
23+
python = prev.python312.override { packageOverrides = pythonOverlay; };
3424

3525
}

nix/sources.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,6 @@
1111
"url": "https://github.com/ipetkov/crane/archive/0bda7e7d005ccb5522a76d11ccfbf562b71953ca.tar.gz",
1212
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
1313
},
14-
"naersk": {
15-
"branch": "master",
16-
"description": "Build Rust projects in Nix - no configuration, no code generation, no IFD, sandbox friendly.",
17-
"homepage": "",
18-
"owner": "nix-community",
19-
"repo": "naersk",
20-
"rev": "8d97452673640eb7fabe428e8b6a425bc355008b",
21-
"sha256": "0sgs8dh8yw62dzpd0mm6byf2q4vwqab3r0i62qy52las85f4p1qw",
22-
"type": "tarball",
23-
"url": "https://github.com/nix-community/naersk/archive/8d97452673640eb7fabe428e8b6a425bc355008b.tar.gz",
24-
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
25-
},
2614
"nixpkgs": {
2715
"branch": "nixpkgs-unstable",
2816
"description": "Nix Packages collection",

opsqueue/opsqueue.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
useNextest ? false, # Disabled for now. Re-enable as part of https://github.com/channable/opsqueue/issues/81
1111
perl,
1212
git,
13-
python312,
13+
python,
1414
}:
1515
let
1616
sources = import ../nix/sources.nix;
@@ -32,7 +32,7 @@ let
3232
commonArgs = {
3333
inherit src version pname;
3434
strictDeps = true;
35-
nativeBuildInputs = [ python312 ];
35+
nativeBuildInputs = [ python ];
3636
};
3737
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
3838
in

0 commit comments

Comments
 (0)