mach-nix
mach-nix copied to clipboard
Pinned awscli breaks environment
Given this shell.nix:
let
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
ref = "refs/tags/3.5.0";
}) {};
pythonEnv = mach-nix.mkPython {
requirements = ''
datadog==0.10.0
setuptools # otherwise we get ModuleNotFoundError: No module named 'pkg_resources'
'';
};
in
mach-nix.nixpkgs.mkShell {
buildInputs = [
# This works:
# mach-nix.nixpkgs.awscli
# This returns "ModuleNotFoundError: No module named 'datadog'"
(import (fetchTarball https://github.com/NixOS/nixpkgs/archive/b09c989b82f7a4f7319802a1dcf8bfe859d65362.tar.gz) {}).awscli
pythonEnv
];
}
Running the following:
nix-shell --run "python -c 'import datadog'"
breaks with the pinned awscli but works when using awscli from the nixpkgs in mach-nix.
your older awscli is injecting a python 3.8 into the environment, and 'python' then refers to that. If you run 'python3.9' in the 'pinned' variant, you can import datadog.
I suppose it's an issue of shadowing.
Hmm I thought nix took care of wrapping whatever Python interpreter was necessary for each application?
Ran into this as well. Is there a way to override which python is the default for the command?
@mausch I tried mach-nix.nixpkgs.awscli2 but that errored for me. (error: attribute 'nixpkgs' missing)