Adding Multiple Custom Python Packages

Hi everyone, I’m trying to have a shell.nix file that sets up python and two custom packages that I need. One is on my local machine while the other is hosted on Github. Following the wikis/manuals, I was able to reach this:

with (import <nixpkgs> {});
with pkgs.python3Packages;

buildPythonPackage rec {
  name = "aisysprojutils";
  src = "/local/path/to/package";
}

This works so far, I just don’t know how I can extend this file to add another package and fetch it from Github. I’m not even sure if this is the way to achieve this. Would anyone know how to go about this?
I’d be really grateful for any pointers, I’m still learning the ways of Nix :slight_smile:

You can use mkShell, like in a shell.nix:

{ pkgs ? import <nixpkgs> {} }:
  pkgs.mkShell {
    buildInputs = with pkgs;[
      (python3Packages.buildPythonPackage rec {
        name = "aisysprojutils";
        src = ./path/to/package;
      })
      (python3Packages.buildPythonPackage rec {
        name = "aisysprojutils";
        src = fetchFromGithub {
              owner = "foo";
              repo = name;
             rev = "your-commit-or-version";
             sha256 = "";
        };
      })
    ];
}
1 Like

Thanks, this worked :smiley: