I’m not super sure what’s happening here. I thought it’d be a good idea to get going quickly with flakes for a throwaway python project, so I pulled something from dev-templates and tweaked it.
I ended up with this:
{
description = "A Nix-flake-based Python development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
flake-utils.url = "github:numtide/flake-utils";
mach-nix.url = "github:/DavHau/mach-nix";
};
outputs =
{ self
, nixpkgs
, flake-utils
, mach-nix
}:
flake-utils.lib.eachDefaultSystem (system:
let
# overlays = [
# (self: super: {
# python = super.python311;
# })
# ];
# pkgs = import nixpkgs { inherit overlays system; };
pkgs = import nixpkgs { inherit system; };
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [ python311 virtualenv protobuf ] ++
(with pkgs.python311Packages; [ pip protobuf ]);
shellHook = ''
${pkgs.python}/bin/python --version
'';
};
});
}
which throws a relatively weird error.
error: builder for '/nix/store/8v2nc3j1z6m1k3fzw51nn8sxlmxjp0h0-python3.11-pyext-0.8.drv' failed with exit code 1;
last 10 log lines:
> Executing setuptoolsBuildPhase
> Traceback (most recent call last):
> File "/private/tmp/nix-build-python3.11-pyext-0.8.drv-0/source/nix_run_setup", line 8, in <module>
> exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
> File "setup.py", line 6, in <module>
> import pyext
> File "/private/tmp/nix-build-python3.11-pyext-0.8.drv-0/source/pyext.py", line 118, in <module>
> oargspec = inspect.getargspec
> ^^^^^^^^^^^^^^^^^^
> AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?
For full logs, run 'nix log /nix/store/8v2nc3j1z6m1k3fzw51nn8sxlmxjp0h0-python3.11-pyext-0.8.drv'.
error: 1 dependencies of derivation '/nix/store/45hvqqc10rgqjyn716cpb23x3xf2qhq1-python3.11-protobuf-4.21.8.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ixisv4p5j0yw8l9d8a372x7xg3gyic5q-nix-shell-env.drv' failed to build
Not sure how to even start debugging this.
Ticket for the same on Github: Tweaked Python file throws error · Issue #20 · the-nix-way/dev-templates · GitHub