Installing pip packages

I have this pip package amulet-map-editor.
How do I wrap this to nix. How can I install this

`

1 Like

I don’t know what I’m doing but fumbled around enough to get it running. When I open the “3D Editor” tab it crashes with an OpenGL error though. Maybe this will be a useful starting point for someone:

{ pkgs ? import <nixpkgs> {} }:
with pkgs.python3Packages;

let
  amulet-core = buildPythonPackage rec {
    pname = "amulet-core";
    version = "1.4.8";
    propagatedBuildInputs = [ amulet-nbt cython numpy pymctranslate ];
    src = fetchPypi { inherit pname version; sha256 = "0ksk40llpdn708n6bx3yyzpskx7vrcq25xal7hxlmgm748a75ddp"; };
    doCheck = false;
  };

  amulet-nbt = buildPythonPackage rec {
    pname = "amulet-nbt";
    version = "1.0.3.10";
    propagatedBuildInputs = [ cython numpy ];
    src = fetchPypi { inherit pname version; sha256 = "1rpzl1zgasg7rhcp9i0dnf9j1wk6mz2f2550ib2kmqvs1vi5izn6"; };
    doCheck = false;
  };

  minecraft-resource-pack = buildPythonPackage rec {
    pname = "minecraft-resource-pack";
    version = "1.2.4";
    propagatedBuildInputs = [ cython numpy pillow ];
    src = fetchPypi { inherit pname version; sha256 = "1mzfh2gws13hs4asx765w1qpl8zswz8mmqgcw5md59nb7b7x51d3"; };
    doCheck = false;
  };

  pymctranslate = buildPythonPackage rec {
    pname = "pymctranslate";
    version = "1.0.10";
    propagatedBuildInputs = [ amulet-nbt cython numpy ];
    src = fetchPypi { inherit version; pname = "PyMCTranslate"; sha256 = "0xyyyan2wq4sq9q05ya46zm6bmdbzzcl6j4whanb1d0xj9z2369z"; };
    doCheck = false;
  };
in
buildPythonApplication rec {
  pname = "amulet-map-editor";
  version = "0.8.15";
  propagatedBuildInputs = [ amulet-core amulet-nbt cython numpy minecraft-resource-pack pymctranslate pyopengl setuptools six wxPython_4_1 ];
  src = fetchPypi { inherit pname version; sha256 = "01h5lav7m5jziwagggz7db16657h60gampp2y3lkq7y27gf4jk48"; };
  doCheck = false;
}

1 Like

Thanks so much Andrew, I will try this out. If this works, I think we could publish this to nixpkgs. @_Andrew

Also, did you generate this. If so, could you please tell me the tool.

How did you run this?

I have almost no experience doing python development with Nix or NixOS, but I think this might help you: [NixOS - Nixpkgs 21.05 manual](https://python section of nixpkgs manual)