I always struggle to run python on my NixOS machine and today is no exception Would one of you kind folk please tell me what I’m doing wrong here!?
I think this flake.nix
file should work:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
mach-nix = {
url = "mach-nix/3.5.0";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = { self, nixpkgs, flake-utils, mach-nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
mach = import mach-nix {
inherit pkgs;
python = "python39";
};
requirements = ''
coloredlogs==7.3
python-jenkins==0.4.16
PyYAML==3.13
requests==2.20.0
tqdm==4.28
'';
python = mach.mkPython {
inherit requirements;
};
in rec {
defaultPackage = mach.buildPythonPackage {
inherit requirements;
src = ./.;
};
devShell = pkgs.mkShell {
buildInputs = [
python
];
};
});
}
It fails to build python3.9-pyyaml-3.13, the only errors that I can find apear to be logic errors in the code:
ext/_yaml.c: In function ‘__Pyx_modinit_type_init_code’:
ext/_yaml.c:25698:25: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
25698 | __pyx_type_5_yaml_Mark.tp_print = 0;
| ^
ext/_yaml.c:25718:28: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
25718 | __pyx_type_5_yaml_CParser.tp_print = 0;
| ^
ext/_yaml.c:25732:29: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
25732 | __pyx_type_5_yaml_CEmitter.tp_print = 0;
| ^
(Line 25,698… WTF!) The full log is below here: nix log /nix/store/g6ifi449xh98f5n5jbgp37f7889w2s7y-python3.9-pyyaml-3.13.drv
For the full picture I am trying to run the script in this repo: Librem5 / librem5-flash-image · GitLab.
I’m really hoping there’s something dumb that I’m missing and someone smarter with more experience can spot it right away