mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-06 17:51:40 -05:00

From the build: > Package ‘python-2.7.18.6’ in > /nix/store/n5hj62lgkwvz3gqnp4l4nxzjnadh7y54-source/pkgs/development/interpreters/python/cpython/2.7/default.nix:330 > is marked as insecure, refusing to evaluate. and > Python 2.7 has reached its end of life after 2020-01-01. See > https://www.python.org/doc/sunset-python-2/. Necessary to bump nixpkgs <https://github.com/nix-community/poetry2nix/pull/996>.
43 lines
1.1 KiB
Nix
43 lines
1.1 KiB
Nix
{ pkgs ? import <nixpkgs> {
|
|
overlays = [
|
|
(import ../overlay.nix)
|
|
];
|
|
}
|
|
}:
|
|
let
|
|
inherit (pkgs) lib;
|
|
|
|
srcPath = builtins.toString ../.;
|
|
in
|
|
{
|
|
|
|
flamegraph =
|
|
let
|
|
runtimeDeps = lib.makeBinPath [
|
|
pkgs.flamegraph
|
|
pkgs.python3
|
|
pkgs.nix
|
|
];
|
|
in
|
|
pkgs.writeScriptBin "poetry2nix-flamegraph" ''
|
|
#!${pkgs.runtimeShell}
|
|
export PATH=${runtimeDeps}:$PATH
|
|
|
|
workdir=$(mktemp -d)
|
|
function cleanup {
|
|
rm -rf "$workdir"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
# Run once to warm up
|
|
nix-instantiate --expr '(import <nixpkgs> { overlays = [ (import ${srcPath + "/overlay.nix"}) ]; })' -A poetry
|
|
nix-instantiate --trace-function-calls --expr '(import <nixpkgs> { overlays = [ (import ${srcPath + "/overlay.nix"}) ]; })' -A poetry 2> $workdir/traceFile
|
|
python3 ${pkgs.nix.src}/contrib/stack-collapse.py $workdir/traceFile > $workdir/traceFile.folded
|
|
flamegraph.pl $workdir/traceFile.folded > poetry2nix-flamegraph.svg
|
|
'';
|
|
|
|
env = pkgs.poetry2nix.mkPoetryEnv {
|
|
projectDir = ./.;
|
|
};
|
|
|
|
}
|