Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single-file or env-only packages allowed? #1251

Open
con-f-use opened this issue Aug 9, 2023 · 1 comment
Open

Single-file or env-only packages allowed? #1251

con-f-use opened this issue Aug 9, 2023 · 1 comment

Comments

@con-f-use
Copy link

con-f-use commented Aug 9, 2023

Assuming python-poetry/poetry#8292 has a resolution, could poetry2nix deal with that? I.e. can I specify a poetry.lock and nothing else to get a python environment from poetry2nix? E.g. with

myenv = poetry2nix.legacyPackages.${system}.mkPoetryEnv {
      projectDir = null;
      pyproject = null;
      poetrylock = ./poetry.lock;
};
@con-f-use con-f-use changed the title Single-file or env-only packages not allowed? Single-file or env-only packages allowed? Aug 9, 2023
@con-f-use
Copy link
Author

con-f-use commented Aug 10, 2023

Closest I've come is this:

{
  description = "bare-env, use with `nix develop`";

  inputs.nixpkgs.url = "github:NixOS/nixpkgs/9607b9149c9d81fdf3dc4f3bcc278da146ffbd77";
  inputs.poetry2nix = {
    url = "github:nix-community/poetry2nix";
    inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { self, nixpkgs, poetry2nix }: let
    system = "x86_64-linux";
    pkgs = nixpkgs.legacyPackages.${system};
    gftools = poetry2nix.legacyPackages.${system}.mkPoetryEnv {
      projectDir = null;
      pyproject = pkgs.writeText "pyproject.toml" ''
        [tool.poetry]
        name = "bare-env"
        version = "0.1.0"
        description = "Just a virtual environment managed with poetry"
        authors = ["confus"]

        [tool.poetry.dependencies]
        python = ">=3.9, <4.0"
        platformdirs = "*"


        [build-system]
        requires = ["poetry-core"]
        build-backend = "poetry.core.masonry.api"
      '';
      poetrylock = ./poetry.lock;
      preferWheels = true;
    };
  in
  {
    devShells.${system}.default = gftools.env;
  };
}

but I think, you shouldn't need the dummy pyproject = pkgs.writeText ... part at all, null there and a single lockfile should be enough for poetry2nix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant