How can I install a self made python packages globally?

I want to use a python pkg, that is not in nix pkgs. I posted a package request last month, but no one replied to me. So I tried package it. I used nix build.
nix-build -E 'with import <nixpkgs> {}; with pkgs.python3Packages; callPackage ./default.nix {}'
It is build successfully but I still can’t use it global.
And I wish to configure my nix machines so that whenever I launch python all installed packages are available with out needing a custom environment. Actually I want to use it as a extraPackage of another app.
I am using home manager to manage my user’s packages.
Here is the pkg:

{ lib
, buildPythonPackage
, fetchPypi
, setuptools-scm
}:

buildPythonPackage rec {
  pname = "materialyoucolor";
  version = "2.0.9";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256:277e7ffe1ded5a7db47f97a3e8e5dac3834a9f1ba783dabb9b413865ff4f530e";
  };


  build-system = [
    setuptools-scm
  ];

  meta = {
    homepage = "https://github.com/T-Dynamos/materialyoucolor-python";
    description = "Material You color algorithms for python!";
    license = lib.licenses.mit;
  };
}

Here is how I use it, but it doesn’t work.

{ inputs, pkgs, pkgs-stable, ... }:
let
  materialyoucolor = pkgs.python3Packages.callPackage ./materialyoucolor.nix {};
in
{
  imports = [
    inputs.ags.homeManagerModules.default   
  ];

  home.packages = [
     materialyoucolor
  ];

  programs.ags = {
    enable = true;
    configDir = null;#./ags;
    extraPackages = [
         materialyoucolor
    ];
  };
}

It’s a python module, you likely need something like:

extraPackages = [
  (python3.withPackages (_: [
    materialyoucolor
  ])
];
1 Like

Looks like someone reviewed it but it hasn’t been merged yet. Might check out the Nixpkgs Python that is part of the official NixOS matrix space. → https://matrix.to/#/#python:nixos.org

Ah, I see. hope could be merged asap

that works! thanks!!!