Closed sandangel closed 3 weeks ago
@sandangel can you please provide a full example how to reproduce the issue?
@thenonameguy do you have an idea what should we do to support such use cases?
We'd probably have to write our own autoPatchelfHook
.
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
devenv.url = "github:cachix/devenv";
devenv.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, devenv }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
deps = with pkgs; [
(python3.withPackages (ps: with ps; [
poetry
]))
postgresql
stdenv.cc.cc.lib
autoPatchelfHook
];
ciDeps = with pkgs; [
awscli2
curl
git-lfs
jq
];
devDeps = with pkgs; [
pre-commit
redis
];
in
with pkgs;
{
packages.default = pkgs.buildEnv {
name = "my-app";
paths = deps;
};
devShells.ci = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
{
packages = deps ++ ciDeps;
}
];
};
devShells.default = devenv.lib.mkShell {
inherit inputs pkgs;
# nativeBuildInputs = [ pkgs.autoPatchelfHook ]; does not work
modules = [
{
packages = deps ++ ciDeps ++ devDeps;
}
];
};
}
);
}
this is my flake.nix file.
We'll need to write a version of autoPatchelf that doesn't use setup hooks.
It would be great if devenv automatically add LD_LIBRARY_PATH and we don't even need autoPatchelf in nativeBuildInputs
That's not ideal to do by default but you can point to ${env.DEVENV_PROFILE}/lib yourself :)
Can you try with recently released 1.0?
I have another issue though:
# devenv.nix
{ pkgs, ... }:
{
dotenv.disableHint = true;
packages =
(with pkgs.darwin.apple_sdk.frameworks; [
CoreFoundation
Accelerate
Security
SystemConfiguration
AppKit
WebKit
])
++ (with pkgs; [
pkg-config
openssl
libiconv
]);
languages.rust.enable = true;
languages.rust.channel = "stable";
}
# devenv.yaml
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
fenix:
url: github:nix-community/fenix
inputs:
nixpkgs:
follows: nixpkgs
allowUnfree: true
Then run:
export PYAPP_PROJECT_NAME=cowsay
export PYAPP_PROJECT_VERSION=6.0
cargo install pyapp --root out
Error:
note: ld: library not found for -liconv
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
error: could not compile `ring` (build script) due to 1 previous error
error: failed to compile `pyapp v0.16.0`, intermediate artifacts can be found at `/var/folders/rc/h9d5_1292lz6841wzkw14yrw0000gq/T/cargo-installv1Zwkl`.
Using nativeBuildInputs in the pkgs.mkShell does not have this issue.
Does it work if you set unsetEnvVars = lib.mkForce [];
This flake.nix works for me:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
devenv.url = "github:cachix/devenv";
};
outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.devenv.flakeModule ];
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
{
devShells.default = pkgs.mkShell {
buildInputs =
(with pkgs; [
gcc
libiconv
])
++ (with pkgs.darwin.apple_sdk.frameworks; [ SystemConfiguration ]);
};
};
};
}
When I set:
# devenv.nix
{ pkgs, lib, ... }:
{
dotenv.disableHint = true;
packages =
(with pkgs; [
gcc
libiconv
])
++ (with pkgs.darwin.apple_sdk.frameworks; [ SystemConfiguration ]);
languages.rust.enable = true;
languages.rust.channel = "stable";
unsetEnvVars = lib.mkForce [ ];
}
Then it works
Could you add this as a test to tests
in a PR and we'll fix it?
For me removing unsetEnvVars = lib.mkForce [ ];
also works, can you confirm?
Oh, after updating with devenv update
. I was able to build without issue. Not sure what have been changed. THanks a lot.
Describe the bug I can not specify like I did with
pkgs.mkShell
. I use this package to avoid libstd.so.6 issueTo Reproduce Please provide an sscce by creating a gist using
devenv.nix
,devenv.yaml
and optionallydevenv.lock
.Version
Paste here the output of
$ devenv version
. main