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

Support usage of mkPoetryEnv in dev-shell.nix evaluated by nix shell .#devShells.x86_64-linux.default #1788

Open
jtara1 opened this issue Sep 2, 2024 · 0 comments

Comments

@jtara1
Copy link

jtara1 commented Sep 2, 2024

Describe the issue

I'm unable to build a shell defined by a module in my package flake.nix.

Error:

$ nix shell .#devShells.x86_64-linux.default
error: builder for '/nix/store/bjhx3gjy6650ny4sh8md38wvc2j87pd2-interactive-python3-3.12.4-environment.drv' failed with exit code 1;
       last 10 log lines:
       > calling 'envHostTargetHook' function hook 'bintoolsWrapper_addLDVars' /nix/store/gps9qrh99j7g02840wv5x78ykmz30byp-strip.sh
       > calling 'envHostTargetHook' function hook 'ccWrapper_addCVars' /nix/store/62zpnw69ylcfhcpy1di8152zlzmbls91-gcc-wrapper-13.3.0
       > calling 'envHostTargetHook' function hook 'bintoolsWrapper_addLDVars' /nix/store/62zpnw69ylcfhcpy1di8152zlzmbls91-gcc-wrapper-13.3.0
       > calling 'envHostTargetHook' function hook 'ccWrapper_addCVars' /nix/store/pg90p34kys2famxnq7925sbgj4jrnsi8-binutils-wrapper-2.42
       > calling 'envHostTargetHook' function hook 'bintoolsWrapper_addLDVars' /nix/store/pg90p34kys2famxnq7925sbgj4jrnsi8-binutils-wrapper-2.42
       > calling 'envHostTargetHook' function hook 'ccWrapper_addCVars' /nix/store/4prjbnvjp40kkqjds62ywy9sr94j9g4b-hello-2.12.1
       > calling 'envHostTargetHook' function hook 'bintoolsWrapper_addLDVars' /nix/store/4prjbnvjp40kkqjds62ywy9sr94j9g4b-hello-2.12.1
       >
       > *** Python 'env' attributes are intended for interactive nix-shell sessions, not for building! ***
       >
       For full logs, run 'nix log /nix/store/bjhx3gjy6650ny4sh8md38wvc2j87pd2-interactive-python3-3.12.4-environment.drv'.

Additional context

dev-shell.nix

{
  pkgs ? import <nixpkgs> {},
  poetry2nix
}:
let
  myAppEnv = poetry2nix.mkPoetryEnv {
    projectDir = ./.;
    editablePackageSources = {
      my-app = ./src;
    };
  };
in myAppEnv.env.overrideAttrs (oldAttrs: {
  buildInputs = [ pkgs.hello ];
})

flake.nix

{
  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small";
  inputs.poetry2nix.url = "github:nix-community/poetry2nix";
  inputs.poetry2nix.inputs.nixpkgs.follows = "nixpkgs";

  outputs = { self, nixpkgs, poetry2nix }:
  let
    system = "x86_64-linux";

    pkgs = import nixpkgs {
      inherit system;
    };

    lib = nixpkgs.lib;
    config = nixpkgs.config;

    p2n = (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; });
    mkPoetryApplication = p2n.mkPoetryApplication;

    dev-shell = import ./dev-shell.nix { inherit pkgs; poetry2nix = p2n; };
  in {
    devShells.x86_64-linux.default = dev-shell;
  };
}
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