devenv
devenv copied to clipboard
[Python] Using the output of a derivation as a requirements.txt?
To circumvent https://github.com/cachix/devenv/issues/889, I'm pre-processing some requirements.txt files with runCommand.
I've managed to do it with:
{ pkgs, ... }:
let reqs = pkgs.runCommand "genReqs" {} ''
mkdir $out
# Inline the imported file:
cat ${./shared/requirements.txt} >> $out/requirements.txt
# Remove the import:
sed '/^-r .*/d' < ${./requirements.txt} >> $out/requirements.txt
'';
in
{
packages = [ pkgs.stdenv pkgs.git ];
languages.python = {
enable = true;
package = pkgs.python39;
venv = {
enable = true;
requirements = builtins.readFile "${reqs}/requirements.txt";
};
};
}
but that's sort of a hack, what I'd like to do is to use the output of the derivation as the requirements. Is there a way to do this? More generally, is it possible to parameterize devenv params from nix derivations?
This issue is fixed and yes, you can reference other derivations just like in Nix.