Open skyl4b opened 3 months ago
I'm sorry you have this problem. I don't use NixOS. Hope someone can solve it.
It seems to me that pixi requires a similar workflow as conda with nix, therefore expecting an FHS user environment created with a pixi-shell command (or similar, since it's a bit confusing). Inside this environment, it should be possible to add / execute packages.
Yes, correct. I just solved this by first creating a nix FHS shell, with the following flake.nix
:
{
description = "pixi env";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ flake-utils, nixpkgs, ... }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
fhs = pkgs.buildFHSUserEnv {
name = "pixi-env";
targetPkgs = _: [ pkgs.pixi ];
};
in
{
devShell = fhs.env;
}
);
}
Drop this in your python project, and then execute nix develop
. (You'll need flake support activated)
This is the same way I use conda/micromamba.
I also have not that much experience with NixOS, but I don't think that this can be solved in the pixi package itself.
Any packages you install outside of nix that include pre-compiled binaries are going to give you trouble on NixOS. pixi
is really just a little package manager has no concept of nix's inner workings. FHS environment should be a viable solution in theory, but I always ended up having trouble with it back when I tried it with micromamba
. Another viable option is nix-ld
/nix-ld-rs
; it's working nicely for me... depending on what packages you're using, you may need to add some libraries to programs.nix-ld.libraries
(I needed to add pkgs.libGL
for one of my projects). Including this in your system configuration should get you started:
programs = {
nix-ld = {
enable = true;
package = pkgs.nix-ld-rs;
libraries = [
# pkgs.libGL, any other libraries your code may need...
# See nix-alien and nix-autobahn for help finding which
# libraries you need to install... not sure the best way
# to use these to find required libraries for Python packages
];
};
};
I prefer using pkgs.buildFHSUserEnv
to wrap pixi
installed using home-manager (so that I don't have to use nix develop
and bash).
Here's what I did:
{ lib, pkgs, ... }:
{
home.packages = [
(pkgs.buildFHSUserEnv {
name = "pixi";
runScript = "pixi";
targetPkgs = pkgs: with pkgs; [ pixi ];
})
];
}
Describe the bug
I've been trying out the pixi package manager from prefix.dev on NixOS and I can't seem to use any packages installed with it. To the best of my knowledge, this is because it is based on the conda ecosystem, therefore requiring a FHS environment.
Steps To Reproduce
Steps to reproduce the behavior:
pixi
package availablepixi
Expected behavior
The package is added properly and is available with
pixi shell
.It seems to me that pixi requires a similar workflow as conda with nix, therefore expecting an FHS user environment created with a
pixi-shell
command (or similar, since it's a bit confusing). Inside this environment, it should be possible to add / execute packages.Additional context
I have a limited experience with Nix. If I am wrong about this, I would appreciate some suggestions / criticism.
Notify maintainers
@aaronjheng @edmundmiller
Metadata
Add a :+1: reaction to issues you find important.