Open PedroRegisPOAR opened 3 years ago
nix profile install nixpkgs#python3
nix profile install --no-write-lock-file github:nix-community/poetry2nix/869580c729e658ffe74d8d1d0c3cb132d33a6126#poetry
mkdir -p ~/troubleshoot-pandas-flake \
&& cd ~/troubleshoot-pandas-flake \
&& poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add pandas==1.5.0
mkdir -p "$HOME"/troubleshoot-pandas-flake \
&& cd "$HOME"/troubleshoot-pandas-flake
cat <<WRAP > "$HOME"/troubleshoot-pandas-flake/flake.nix
{
description = "A usefull description";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.poetry2nix-src.url = "github:nix-community/poetry2nix/869580c729e658ffe74d8d1d0c3cb132d33a6126";
outputs = { self, nixpkgs, flake-utils, poetry2nix-src }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgsAllowUnfree = import nixpkgs {
system = "x86_64-linux";
config = { allowUnfree = true; };
};
pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix-src.overlay ]; };
env = pkgsAllowUnfree.poetry2nix.mkPoetryEnv {
poetrylock = ./poetry.lock;
projectDir = ./.;
python = pkgsAllowUnfree.python3;
};
in
{
devShell = pkgsAllowUnfree.mkShell {
buildInputs = with pkgsAllowUnfree; [
poetry
env
];
shellHook = ''
unset SOURCE_DATE_EPOCH
'';
};
});
}
WRAP
command -v nix 1> /dev/null 2> /dev/null || echo 'The nix binary was not found'
test -x git || nix profile install nixpkgs#git
git init
git add .
# Lock it, time passes and things get out of synchronization
# nix flake update --override-input nixpkgs nixpkgs/dca55d9a451fba34c87e8adea7a3782d667149fa
nix flake lock
git add .
poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add pandas==1.5.0 \
&& poetry lock \
&& poetry show --tree
git add .
nix develop --command python -c 'import pandas'
nix profile install nixpkgs#poetry nixpkgs#python3 nixpkgs#gcc nixpkgs#stdenv.cc.cc.lib
mkdir -p ~/troubleshoot-pandas \
&& cd ~/troubleshoot-pandas \
&& poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add pandas==1.1.5
nix profile install nixpkgs#poetry nixpkgs#python3 nixpkgs#gcc
mkdir -p ~/troubleshoot-pandas \
&& cd ~/troubleshoot-pandas \
&& poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add pandas==1.1.5
nix profile install nixpkgs/7138a338b58713e0dea22ddab6a6785abec7376a#poetry nixpkgs#python3
mkdir -p ~/troubleshoot-pandas \
&& cd ~/troubleshoot-pandas \
&& poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add pandas==1.1.5
mkdir -p ~/troubleshoot-pandas \
&& cd ~/troubleshoot-pandas \
&& poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add pandas==1.1.5 \
&& poetry lock \
&& poetry show --tree \
&& poetry run python -c 'import pandas; print(pandas.__package__)'
python -c 'import pandas'
mkdir -p "$HOME"/troubleshoot-pandas-flake \
&& cd "$HOME"/troubleshoot-pandas-flake
curl http://ix.io/49FS > flake.nix
curl http://ix.io/49FQ > flake.lock
curl http://ix.io/49FR > pyproject.toml
curl http://ix.io/49FT > poetry.lock
git init
git add .
nix develop --command python -c 'import pandas'
mkdir -p "$HOME"/troubleshoot-pandas-flake \
&& cd "$HOME"/troubleshoot-pandas-flake
cat <<WRAP > "$HOME"/troubleshoot-pandas-flake/flake.nix
{
description = "A usefull description";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.poetry2nix-src.url = "github:nix-community/poetry2nix";
outputs = { self, nixpkgs, flake-utils, poetry2nix-src }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgsAllowUnfree = import nixpkgs {
system = "x86_64-linux";
config = { allowUnfree = true; };
};
pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix-src.overlay ]; };
env = pkgsAllowUnfree.poetry2nix.mkPoetryEnv {
poetrylock = ./poetry.lock;
projectDir = ./.;
python = pkgsAllowUnfree.python3;
};
in
{
devShell = pkgsAllowUnfree.mkShell {
buildInputs = with pkgsAllowUnfree; [
poetry
env
];
shellHook = ''
unset SOURCE_DATE_EPOCH
'';
};
});
}
WRAP
command -v nix 1> /dev/null 2> /dev/null || echo 'The nix binary was not found'
test -x git || nix profile install nixpkgs#git
test -x poetry || nix profile install nixpkgs#poetry
git init
git add .
# Lock it, time passes and things get out of synchronization
nix flake update --override-input nixpkgs nixpkgs/dca55d9a451fba34c87e8adea7a3782d667149fa
nix flake lock
git add .
poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add pandas==1.1.5 \
&& poetry lock \
&& poetry show --tree
git add .
nix develop --command python -c 'import pandas'
mkdir -p "$HOME"/troubleshoot-pandas-flake \
&& cd "$HOME"/troubleshoot-pandas-flake
cat <<WRAP > "$HOME"/troubleshoot-pandas-flake/flake.nix
{
description = "A usefull description";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.poetry2nix-src.url = "github:nix-community/poetry2nix";
outputs = { self, nixpkgs, flake-utils, poetry2nix-src }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgsAllowUnfree = import nixpkgs {
system = "x86_64-linux";
config = { allowUnfree = true; };
};
pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix-src.overlay ]; };
env = pkgsAllowUnfree.poetry2nix.mkPoetryEnv {
poetrylock = ./poetry.lock;
projectDir = ./.;
python = pkgsAllowUnfree.python3;
overrides = [
pkgsAllowUnfree.poetry2nix.defaultPoetryOverrides
(self: super: {
pandas = super.pandas.overridePythonAttrs (old: {
buildInputs = old.buildInputs ++ [
self.stdenv.cc.cc.lib
];
});
})
];
};
in
{
devShell = pkgsAllowUnfree.mkShell {
buildInputs = with pkgsAllowUnfree; [
poetry
env
];
shellHook = ''
unset SOURCE_DATE_EPOCH
'';
};
});
}
WRAP
command -v nix 1> /dev/null 2> /dev/null || echo 'The nix binary was not found'
test -x git || nix profile install nixpkgs#git
test -x poetry || nix profile install nixpkgs#poetry
git init
git add .
# Lock it, time passes and things get out of synchronization
nix flake update --override-input nixpkgs nixpkgs/dca55d9a451fba34c87e8adea7a3782d667149fa
nix flake lock
git add .
poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add pandas==1.1.5 \
&& poetry lock \
&& poetry show --tree
git add .
nix develop --command python -c 'import pandas'
mkdir -p "$HOME"/troubleshoot-pandas-flake \
&& cd "$HOME"/troubleshoot-pandas-flake
cat <<WRAP > "$HOME"/troubleshoot-pandas-flake/flake.nix
{
description = "A usefull description";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.poetry2nix-src.url = "github:nix-community/poetry2nix";
outputs = { self, nixpkgs, flake-utils, poetry2nix-src }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgsAllowUnfree = import nixpkgs {
system = "x86_64-linux";
config = { allowUnfree = true; };
};
pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix-src.overlay ]; };
env = pkgsAllowUnfree.poetry2nix.mkPoetryEnv {
poetrylock = ./poetry.lock;
projectDir = ./.;
python = pkgsAllowUnfree.python3;
overrides = [
pkgsAllowUnfree.poetry2nix.defaultPoetryOverrides
(self: super: {
pandas = super.pandas.overridePythonAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [
self.stdenv.cc.cc.lib
];
});
})
];
};
in
{
devShell = pkgsAllowUnfree.mkShell {
buildInputs = with pkgsAllowUnfree; [
poetry
env
];
shellHook = ''
unset SOURCE_DATE_EPOCH
'';
};
});
}
WRAP
command -v nix 1> /dev/null 2> /dev/null || echo 'The nix binary was not found'
test -x git || nix profile install nixpkgs#git
test -x poetry || nix profile install nixpkgs#poetry
git init
git add .
# Lock it, time passes and things get out of synchronization
nix flake update --override-input nixpkgs nixpkgs/dca55d9a451fba34c87e8adea7a3782d667149fa
nix flake lock
git add .
poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add pandas==1.1.5 \
&& poetry lock \
&& poetry show --tree
git add .
nix develop --command python -c 'import pandas'
nix develop --command poetry init --no-interaction \
&& poetry show --tree \
&& poetry add pandas==1.1.5 \
&& poetry lock \
&& poetry show --tree \
&& poetry run python -c 'import pandas; print(pandas.__package__)'
Maybe with: propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.stdenv.cc.cc.lib ];
mkdir -p "$HOME"/troubleshoot-pandas-flake \
&& cd "$HOME"/troubleshoot-pandas-flake
cat <<WRAP > "$HOME"/troubleshoot-pandas-flake/flake.nix
{
description = "A usefull description";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.poetry2nix-src.url = "github:nix-community/poetry2nix";
outputs = { self, nixpkgs, flake-utils, poetry2nix-src }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgsAllowUnfree = import nixpkgs {
system = "x86_64-linux";
config = { allowUnfree = true; };
};
pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix-src.overlay ]; };
env = pkgsAllowUnfree.poetry2nix.mkPoetryEnv {
poetrylock = ./poetry.lock;
projectDir = ./.;
python = pkgsAllowUnfree.python3;
overrides = [
pkgsAllowUnfree.poetry2nix.defaultPoetryOverrides
(self: super: {
pandas = super.pandas.defaultPythonOverrides (old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.stdenv.cc.cc.lib ];
});
})
];
};
in
{
devShell = pkgsAllowUnfree.mkShell {
buildInputs = with pkgsAllowUnfree; [
poetry
# env
];
shellHook = ''
unset SOURCE_DATE_EPOCH
'';
};
});
}
WRAP
command -v nix 1> /dev/null 2> /dev/null || echo 'The nix binary was not found'
test -x git || nix profile install nixpkgs#git
test -x poetry || nix profile install nixpkgs#poetry
git init
git add .
# Lock it, time passes and things get out of synchronization
nix flake update --override-input nixpkgs nixpkgs/dca55d9a451fba34c87e8adea7a3782d667149fa
# nix flake lock
command -v sed 1> /dev/null 2> /dev/null || echo 'The sed binary was not found'
sed -i 's/# env/env/' flake.nix
git add .
poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add pandas==1.1.5 \
&& poetry lock \
&& poetry show --tree
git add .
nix develop --command python -c 'import pandas as pd; pd.DataFrame(); print(pd.__version__)'
python -c 'import pandas as pd; pd.DataFrame()'
poetry cache list
Creating an environment to play inside:
cat > Containerfile << 'EOF'
FROM alpine:3.16.1
RUN apk add --no-cache \
ca-certificates \
curl \
shadow \
tar \
xz \
&& echo 'Creating user' \
&& groupadd abcgroup \
&& useradd -g abcgroup -s /bin/sh -m -c 'Eva User' abcuser \
&& echo 'abcuser:123' | chpasswd \
&& echo abcuser:10000:5000 > /etc/subuid \
&& echo abcuser:10000:5000 > /etc/subgid \
&& mkdir -m 0755 /nix && chown abcuser /nix
USER abcuser
WORKDIR /home/abcuser
ENV USER="abcuser"
ENV PATH=/home/abcuser/.nix-profile/bin:/home/abcuser/.local/bin:"$PATH"
EOF
podman \
build \
--file=Containerfile \
--tag=unprivileged-alpine3161 .
nix run nixpkgs#xorg.xhost -- +
podman \
run \
--device=/dev/fuse \
--device=/dev/kvm \
--env="DISPLAY=${DISPLAY:-:0.0}" \
--interactive=true \
--privileged=true \
--rm=true \
--tty=true \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:ro \
localhost/unprivileged-alpine3161:latest \
sh
nix run nixpkgs#xorg.xhost -- -
nix run nixpkgs#xorg.xhost -- +
podman \
run \
--detach=true \
--device=/dev/fuse:rw \
--device=/dev/kvm:rw \
--env="DISPLAY=${DISPLAY:-:0.0}" \
--interactive=false \
--name=conteiner-alpine \
--privileged=true \
--rm=false \
--tty=true \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:ro \
localhost/unprivileged-alpine3161:latest \
sh
nix run nixpkgs#xorg.xhost -- -
Getting an shell in the running container. It can be used in multiple terminals.
podman \
exec \
--interactive=true \
--tty=true \
conteiner-alpine \
sh
Removes the container:
podman rm -f conteiner-alpine
Note: works on my machine :upside_down:
mkdir -p "$HOME"/troubleshoot-mmh3-flake \
&& cd "$HOME"/troubleshoot-mmh3-flake
cat <<WRAP > "$HOME"/troubleshoot-mmh3-flake/flake.nix
{
description = "A usefull description";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.poetry2nix-src.url = "github:nix-community/poetry2nix/869580c729e658ffe74d8d1d0c3cb132d33a6126";
outputs = { self, nixpkgs, flake-utils, poetry2nix-src }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgsAllowUnfree = import nixpkgs {
system = "x86_64-linux";
config = { allowUnfree = true; };
};
pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix-src.overlay ]; };
env = pkgsAllowUnfree.poetry2nix.mkPoetryEnv {
poetrylock = ./poetry.lock;
projectDir = ./.;
python = pkgsAllowUnfree.python3;
};
in
{
devShell = pkgsAllowUnfree.mkShell {
buildInputs = with pkgsAllowUnfree; [
poetry
# env
];
shellHook = ''
'';
};
});
}
WRAP
test -x git || nix profile install nixpkgs#git
git init
git add .
# Lock it, time passes and things get out of synchronization
nix flake update --override-input nixpkgs nixpkgs/dca55d9a451fba34c87e8adea7a3782d667149fa
nix flake lock
git add .
nix develop --command sh<<COMMANDS
poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add mmh3==3.0.0 \
&& poetry lock \
&& poetry show --tree
COMMANDS
git add .
command -v sed 1> /dev/null 2> /dev/null || echo 'The sed binary was not found'
sed -i 's/# env/env/' flake.nix
git add .
nix develop --command python -c 'import mmh3; print(mmh3.hash128(bytes(123)))'
Note: IT IS BROKEN
mkdir -p "$HOME"/troubleshoot-numpy-flake \
&& cd "$HOME"/troubleshoot-numpy-flake
cat <<WRAP > "$HOME"/troubleshoot-numpy-flake/flake.nix
{
description = "A usefull description";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.poetry2nix-src.url = "github:nix-community/poetry2nix/869580c729e658ffe74d8d1d0c3cb132d33a6126";
outputs = { self, nixpkgs, flake-utils, poetry2nix-src }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgsAllowUnfree = import nixpkgs {
system = "x86_64-linux";
config = { allowUnfree = true; };
};
pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix-src.overlay ]; };
env = pkgsAllowUnfree.poetry2nix.mkPoetryEnv {
poetrylock = ./poetry.lock;
projectDir = ./.;
python = pkgsAllowUnfree.python3;
};
in
{
devShell = pkgsAllowUnfree.mkShell {
buildInputs = with pkgsAllowUnfree; [
poetry
# env
];
shellHook = ''
echo abc
'';
};
});
}
WRAP
test -x git || nix profile install nixpkgs#git
git init
git add .
# Lock it, time passes and things get out of synchronization
nix flake update --override-input nixpkgs nixpkgs/dca55d9a451fba34c87e8adea7a3782d667149fa
nix flake lock
git add .
nix develop --command sh<<COMMANDS
poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add numpy==1.20.1 \
&& poetry lock \
&& poetry show --tree
COMMANDS
git add .
command -v sed 1> /dev/null 2> /dev/null || echo 'The sed binary was not found'
sed -i 's/# env/env/' flake.nix
git add .
nix develop --command python -c 'import numpy as np; np.dot([2j, 3j], [2j, 3j])'
Note: IT IS BROKEN
mkdir -p "$HOME"/troubleshoot-pandas-flake \
&& cd "$HOME"/troubleshoot-pandas-flake
cat <<WRAP > "$HOME"/troubleshoot-pandas-flake/flake.nix
{
description = "A usefull description";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.poetry2nix-src.url = "github:nix-community/poetry2nix/869580c729e658ffe74d8d1d0c3cb132d33a6126";
outputs = { self, nixpkgs, flake-utils, poetry2nix-src }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgsAllowUnfree = import nixpkgs {
system = "x86_64-linux";
config = { allowUnfree = true; };
};
pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix-src.overlay ]; };
env = pkgsAllowUnfree.poetry2nix.mkPoetryEnv {
poetrylock = ./poetry.lock;
projectDir = ./.;
python = pkgsAllowUnfree.python3;
};
in
{
devShell = pkgsAllowUnfree.mkShell {
buildInputs = with pkgsAllowUnfree; [
poetry
# env
];
shellHook = ''
'';
};
});
}
WRAP
test -x git || nix profile install nixpkgs#git
git init
git add .
# Lock it, time passes and things get out of synchronization
nix flake update --override-input nixpkgs nixpkgs/dca55d9a451fba34c87e8adea7a3782d667149fa
nix flake lock
git add .
nix develop --command sh<<COMMANDS
poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add pandas==1.5.0 \
&& poetry lock \
&& poetry show --tree
COMMANDS
git add .
command -v sed 1> /dev/null 2> /dev/null || echo 'The sed binary was not found'
sed -i 's/# env/env/' flake.nix
git add .
nix develop --command python -c 'import pandas as pd; pd.DataFrame(); print(pd.__version__)'
Note: IT IS BROKEN
mkdir -p "$HOME"/troubleshoot-pandas-flake \
&& cd "$HOME"/troubleshoot-pandas-flake
curl http://ix.io/49FS > flake.nix
curl http://ix.io/49FQ > flake.lock
curl http://ix.io/49FR > pyproject.toml
curl http://ix.io/49FT > poetry.lock
git init
git add .
nix develop --command python -c 'import pandas as pd; pd.DataFrame(); print(pd.__version__)'
The output of the error:
error: builder for '/nix/store/cwsib0ap5y9miv40qdrk5d6r79pjq1a4-python3.8-numpy-1.23.2.drv' failed with exit code 1;
last 10 log lines:
> - `git clean -xdf` (cleans all files)
> - `git clean -Xdf` (cleans all versioned files, doesn't touch
> files that aren't checked into the git repo)
>
> Add `--force` to your command to use it anyway if you must (unsupported).
>
> ----------------------------------------
> ERROR: Failed cleaning build dir for numpy
> Failed to build numpy
> ERROR: Failed to build one or more wheels
For full logs, run 'nix log /nix/store/cwsib0ap5y9miv40qdrk5d6r79pjq1a4-python3.8-numpy-1.23.2.drv'.
error: 1 dependencies of derivation '/nix/store/mrz9xr0fkiplmmn47g6jbq9hizqgpgxk-python3-3.8.9-env.drv' failed to build
error: 1 dependencies of derivation '/nix/store/d16a2cwxx3qyyq0fg5mgd20rdkpb1jsc-nix-shell-env.drv' failed to build
It is not so good, IMO, to first have to install things in an nix profile.
mkdir -p "$HOME"/troubleshoot-mmh3-flake \
&& cd "$HOME"/troubleshoot-mmh3-flake
command -v nix 1> /dev/null 2> /dev/null || echo 'The nix binary was not found'
# nix profile install --no-write-lock-file github:nix-community/poetry2nix/869580c729e658ffe74d8d1d0c3cb132d33a6126#poetry
nix profile install --no-write-lock-file nixpkgs/nixos-22.05#poetry
nix profile install nixpkgs#python3
poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add mmh3==3.0.0 \
&& poetry lock \
&& poetry show --tree
# python -c 'import mmh3; print(mmh3.hash128(bytes(123)))'
poetry run python -c 'import mmh3; print(mmh3.hash128(bytes(123)))'
##
test -x git || nix profile install nixpkgs#git
git init
git add .
cat <<WRAP > "$HOME"/troubleshoot-mmh3-flake/flake.nix
{
description = "A usefull description";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.poetry2nix-src.url = "github:nix-community/poetry2nix/869580c729e658ffe74d8d1d0c3cb132d33a6126";
outputs = { self, nixpkgs, flake-utils, poetry2nix-src }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgsAllowUnfree = import nixpkgs {
system = "x86_64-linux";
config = { allowUnfree = true; };
};
pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix-src.overlay ]; };
env = pkgsAllowUnfree.poetry2nix.mkPoetryEnv {
poetrylock = ./poetry.lock;
projectDir = ./.;
python = pkgsAllowUnfree.python3;
};
in
{
devShell = pkgsAllowUnfree.mkShell {
buildInputs = with pkgsAllowUnfree; [
poetry
env
];
shellHook = ''
unset SOURCE_DATE_EPOCH
'';
};
});
}
WRAP
git add .
# Lock it, time passes and things get out of synchronization
nix flake update --override-input nixpkgs nixpkgs/dca55d9a451fba34c87e8adea7a3782d667149fa
nix flake lock
nix develop --command python -c 'import mmh3; print(mmh3.hash128(bytes(123)))'
ASR state-of-the-art: Wav2Vec, Whisper, DeepSpeech
nix \
shell \
--impure \
--expr \
'
(
let
pkgs = (builtins.getFlake "github:NixOS/nixpkgs/683f2f5ba2ea54abb633d0b17bc9f7f6dede5799").legacyPackages.${builtins.currentSystem};
in
[ (pkgs.python3.withPackages (p: with p; [ gtts ])) pkgs.vlc pkgs.ffmpeg ]
)
' \
--command \
sh \
<<'COMMANDS'
python3 \
-c \
'
# Import the required module for text
# to speech conversion
from gtts import gTTS
# This module is imported so that we can
# play the converted audio
import os
# The text that you want to convert to audio
mytext = """
I will speak this text
"""
# Language in which you want to convert
language = "en"
# Passing the text and language to the engine,
# here we have marked slow=False. Which tells
# the module that the converted audio should
# have a high speed
myobj = gTTS(text=mytext, lang=language, slow=False)
# Saving the converted audio in a mp3 file named
# welcome
myobj.save("example.mp3")
# Playing the converted file
os.system("cvlc --play-and-exit example.mp3")
'
COMMANDS
nix \
shell \
--impure \
--expr \
'
(
let
pkgs = (builtins.getFlake "github:NixOS/nixpkgs/683f2f5ba2ea54abb633d0b17bc9f7f6dede5799").legacyPackages.${builtins.currentSystem};
in
[ (pkgs.python3.withPackages (p: with p; [ gtts openai-whisper ])) pkgs.vlc pkgs.ffmpeg ]
)
' \
--command \
sh \
<<'COMMANDS'
python3 \
-c \
'
import whisper
model = whisper.load_model("base")
result = model.transcribe("example.mp3")
print(result["text"])
with open("example.txt", "w") as f:
f.write(result["text"])
'
COMMANDS
Refs.:
nix \
shell \
--impure \
--expr \
'
(
let
pkgs = (builtins.getFlake "github:NixOS/nixpkgs/683f2f5ba2ea54abb633d0b17bc9f7f6dede5799").legacyPackages.${builtins.currentSystem};
in
[ (pkgs.python3.withPackages (p: with p; [ gtts ])) pkgs.vlc pkgs.ffmpeg ]
)
' \
--command \
sh \
<<'COMMANDS'
python3 \
-c \
'
# Import the required module for text
# to speech conversion
from gtts import gTTS
# This module is imported so that we can
# play the converted audio
import os
# The text that you want to convert to audio
mytext = """
LEI Nº 14.026, DE 15 DE JULHO DE 2020
Art. 3º Para fins do disposto nesta Lei, considera-se:
I - saneamento básico: conjunto de serviços públicos, infraestruturas e instalações operacionais de:
a) abastecimento de água potável: constituído pelas atividades e pela disponibilização e
manutenção de infraestruturas e instalações operacionais necessárias ao abastecimento público de
água potável, desde a captação até as ligações prediais e seus instrumentos de medição;
b) esgotamento sanitário: constituído pelas atividades e pela disponibilização e manutenção de
infraestruturas e instalações operacionais necessárias à coleta, ao transporte, ao tratamento
e à disposição final adequados dos esgotos sanitários, desde as ligações prediais até sua
destinação final para produção de água de reúso ou seu lançamento de forma adequada no meio ambiente;
c) limpeza urbana e manejo de resíduos sólidos: constituídos pelas atividades e pela disponibilização
e manutenção de infraestruturas e instalações operacionais de coleta, varrição manual e mecanizada,
asseio e conservação urbana, transporte, transbordo, tratamento e destinação final ambientalmente
adequada dos resíduos sólidos domiciliares e dos resíduos de limpeza urbana; e
d) drenagem e manejo das águas pluviais urbanas: constituídos pelas atividades, pela infraestrutura
e pelas instalações operacionais de drenagem de águas pluviais, transporte, detenção ou retenção
para o amortecimento de vazões de cheias, tratamento e disposição final das águas pluviais drenadas,
contempladas a limpeza e a fiscalização preventiva das redes;
"""
# Language in which you want to convert
language = "pt"
# Passing the text and language to the engine,
# here we have marked slow=False. Which tells
# the module that the converted audio should
# have a high speed
myobj = gTTS(text=mytext, lang=language, slow=False)
# Saving the converted audio in a mp3 file named
# welcome
myobj.save("saneamento.mp3")
# Playing the converted file
os.system("cvlc --play-and-exit saneamento.mp3")
'
COMMANDS
Refs.:
mkdir -p "$HOME"/troubleshoot-pandas-flake \
&& cd "$HOME"/troubleshoot-pandas-flake
curl http://ix.io/4d52 > flake.nix
curl http://ix.io/4d66 > flake.lock
curl http://ix.io/4d69 > pyproject.toml
curl http://ix.io/4d68 > poetry.lock
command -v nix 1> /dev/null 2> /dev/null || echo 'The nix binary was not found'
test -x git || nix profile install nixpkgs#git
git init
git add .
nix develop --command python -c 'import pandas as pd; pd.DataFrame(); print(pd.__version__)'
nix flake update --override-input nixpkgs github:NixOS/nixpkgs/65fae659e31098ca4ac825a6fef26d890aaf3f4e
shellHook = ''
# TODO: note que se PYTHONPATH tiver algum valor está sendo ignorado
# export PYTHONPATH="${pkgsAllowUnfree.python3}/${pkgsAllowUnfree.python3.sitePackages}"
# https://nixos.wiki/wiki/Python
export PYTHONPATH="${env}/${pkgsAllowUnfree.python3.sitePackages}"
'';
python -c 'import pandas as pd; pd.DataFrame(); print(pd.__version__)'
poetry config virtualenvs.in-project true \
&& poetry config virtualenvs.path . \
&& poetry install \
&& . .venv/bin/activate
python -c 'import pandas as pd; pd.DataFrame(); print(pd.__version__)'
poetry run python -c 'import pandas as pd; pd.DataFrame(); print(pd.__version__)'
echo 'source ~/.bashrc' >> ~/.profile
https://stackoverflow.com/questions/20534436/how-to-use-alternate-glibc-with-existing-libstdc
mkdir -p "$HOME"/test-ok \
&& cd "$HOME"/test-ok
cat <<'EOF1' > flake.nix
{
description = "";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
inputs@{ self
, nixpkgs
, flake-utils
}:
let
name = "test-ok";
system = "x86_64-linux";
pkgsAllowUnfree = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
packages_ = (import ./default.nix { pkgs = pkgsAllowUnfree; });
in
{
packages."${system}" = packages_;
apps."${system}".ok = flake-utils.lib.mkApp {
name = "ok";
drv = self.packages."${system}".ok;
};
devShells."${system}".default = pkgsAllowUnfree.mkShell {
buildInputs = with pkgsAllowUnfree; [
hello
curl
gnumake
];
shellHook = ''
export TMPDIR=/tmp
'';
};
};
}
EOF1
cat <<'EOF2' > flake.lock
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1665732960,
"narHash": "sha256-WBZ+uSHKFyjvd0w4inbm0cNExYTn8lpYFcHEes8tmec=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4428e23312933a196724da2df7ab78eb5e67a88e",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
EOF2
cat <<'EOF3' > default.nix
{ pkgs ? import <nixpkgs> {} }: {
ok = pkgs.callPackage ./ok.nix { };
}
EOF3
cat <<'EOF4' > ok.cpp
#include <iostream>
int main()
{
std::cout << "ok\n";
return 0;
}
EOF4
cat <<'EOF5' > ok.cpp
#include <iostream>
int main()
{
std::cout << "ok\n";
return 0;
}
EOF5
cat <<'EOF6' > ok.nix
{ pkgs ? import <nixpkgs> { }}:
pkgs.stdenv.mkDerivation {
name = "ok";
src = builtins.path { path = ./.; name = "ok"; };
phases = [ "installPhase" "postInstallPhase" ];
buildInputs = [ pkgs.makeWrapper ];
unpackPhase = ":";
installPhase = ''
mkdir -p $out/bin
g++ -o $out/bin/ok $src/ok.cpp
'';
postInstallPhase = ''
wrapProgram $out/bin/ok --prefix LD_LIBRARY_PATH : ${pkgs.stdenv.cc.cc.lib}/lib
'';
}
EOF6
command -v nix 1> /dev/null 2> /dev/null || echo 'The nix binary was not found'
test -x git || nix profile install nixpkgs#git
git init
git add .
nix run .#ok
Main refs.:
mkdir -p "$HOME"/troubleshoting-pytest-runner \
&& cd "$HOME"/troubleshoting-pytest-runner
cat <<'EOF' > flake.nix
{
description = "";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
inputs@{ self
, nixpkgs
, flake-utils
}:
let
name = "troubleshoting-pytest-runner";
system = "x86_64-linux";
pkgsAllowUnfree = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
env = pkgsAllowUnfree.poetry2nix.mkPoetryEnv {
poetrylock = ./poetry.lock;
projectDir = ./.;
python = pkgsAllowUnfree.python3;
overrides = [
poetry2nix.defaultPoetryOverrides
(self: super: {
faker = super.faker.overridePythonAttrs(old: {
buildInputs = old.buildInputs ++ [
self.pytestrunner
];
});
})
];
};
in
{
devShells."${system}".default = pkgsAllowUnfree.mkShell {
buildInputs = with pkgsAllowUnfree; [
hello
curl
gnumake
env
];
shellHook = ''
echo "In nix shell"
'';
};
};
}
EOF
git init
git add .
nix develop .#
https://lazamar.co.uk/nix-versions/
export NIXPKGS_ALLOW_INSECURE=1 \
&& nix \
shell \
--ignore-environment \
--impure \
--override-flake \
nixpkgs \
github:NixOS/nixpkgs/ae2fc9e0e42caaf3f068c1bfdc11c71734125e06 \
nixpkgs#pkgsStatic.busybox-sandbox-shell \
nixpkgs#python \
github:NixOS/nixpkgs/fefb0df7d2ab2e1cabde7312238026dcdc972441#python36 \
github:NixOS/nixpkgs/fefb0df7d2ab2e1cabde7312238026dcdc972441#python37 \
github:NixOS/nixpkgs/fefb0df7d2ab2e1cabde7312238026dcdc972441#python38 \
nixpkgs#python39 \
nixpkgs#python310 \
nixpkgs#python311 \
nixpkgs#python312 \
nixpkgs#python313 \
--command \
sh \
-c \
'
python2 --version \
&& python3.6 --version \
&& python3.7 --version \
&& python3.8 --version \
&& python3.9 --version \
&& python3.10 --version \
&& python3.11 --version \
&& python3.12 --version \
&& python3.13 --version
'
nix \
shell \
--impure \
--expr \
'
(
let
nixpkgs = (builtins.getFlake "github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b");
pkgs = import nixpkgs { };
in
with pkgs; [
pkgsStatic.busybox-sandbox-shell
(python3.withPackages (pyPkgs: with pyPkgs; [
beautifulsoup4
jupyter
matplotlib
pandas
requests
lxml
]
)
)
]
)
' \
--command \
sh \
-c \
'jupyter-notebook'
https://mayeut.github.io/manylinux-timeline/ https://pythonwheels.com/
nix \
shell \
--ignore-environment \
--keep HOME \
--keep USER \
--impure \
--expr \
'
(
let
nixpkgs = (builtins.getFlake "github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b");
pkgs = import nixpkgs { };
in
with pkgs; [
bashInteractive
coreutils
# Solvers
ipopt
bonmin
z3
opensmt
nlopt
CoinMP
cbc
clp
glpk
picosat
csdp
ecos
julia-bin
# cplex # Not in nixpkgs cache due to license?
# gurobi # Not in nixpkgs cache due to license?
(python3.withPackages (pyPkgs: with pyPkgs; [
beautifulsoup4
jupyter
matplotlib
pandas
requests
lxml
rdkit # https://www.youtube.com/watch?v=9Z9XM9xamDU
nix-kernel
bash_kernel
pyomo
z3
pycosat
ecos
# daqp
# gurobipy # Not in nixpkgs cache due to license?
]
)
)
]
)
' \
--command \
bash \
-c \
'jupyter-notebook'
Refs.:
TL;DR
It is an really hard problem, an NP-hard problem...
Refs.:
TODOs
Re read it: https://stackoverflow.com/a/47149524
TODO: join all that is linked here, might be enough, to fix this painfull problem!!
https://github.com/ES-Nix/environments/issues/1
++
Document how to work around dynamic linking problems caused by glibc updates
++ TODO: help there https://ask.replit.com/t/cant-build-package-because-it-needs-glibc-2-34-older-than-what-is-installed/39215/4 ++
Refs.:
Some references
TODO:
TODO:
See how to check for wheels:
Refs.:
Inspecting binaries
Refs.:
https://functor.tokyo/blog/2021-10-20-nix-cross-static
What package provides libstdc++.so.6?
TODO:
1)
Refs.:
2)
3)
4)
5)
6)
7)
8) TODO: re-reead it and make more examples
Refs.:
TODO: https://stackoverflow.com/questions/4133674/glibcxx-versions?rq=3
TODO: https://stackoverflow.com/a/3436360
TODO
TODO:
Make something like this work:
https://github.com/NixOS/nixpkgs/blob/fe76645aaf2fac3baaa2813fd0089930689c53b5/pkgs/applications/editors/sublime/4/common.nix#L26
combined with
https://github.com/NixOS/nixpkgs/blob/fe76645aaf2fac3baaa2813fd0089930689c53b5/pkgs/applications/editors/sublime/4/common.nix#L63-L68
combined with
https://github.com/archaict/Project/blob/b117de8260eb00008d9a148d12b5edb9c75fac8d/NixOS/incantation/python/shell.nix#L11-L19
combined with
https://github.com/Mic92/nix-ld/tree/29f15b1f7e37810689974ef169496c51f6403a1b#my-pythonnodejsrubyinterpreter-libraries-do-not-find-the-libraries-configured-by-nix-ld
combined with
nix run github:nixified-ai/flake/0c58f8cba3fb42c54f2a7bf9bd45ee4cbc9f2477#koboldai-nvidia
LD_LIBRARY_PATH
List:
TODO: watch and make examples
NIX_LDFLAGS, NIX_CFLAGS_COMPILE, NIX_CFLAGS_LINK
https://stackoverflow.com/questions/77487821/nixos-newer-glibc-version-forced-by-environment-outside-nix-shell
Seriouslly?
LD_PRELOAD
List:
ldd
TODO: Linkers, Loaders and Shared Libraries in Windows, Linux, and C++ - Ofek Shilon - CppCon 2023 triage it!
https://reverseengineering.stackexchange.com/questions/6657/why-does-ldd-and-gdb-info-sharedlibrary-show-a-different-library-base-addr#comment19796_6665
https://i.stack.imgur.com/FF1Zv.png https://reverseengineering.stackexchange.com/a/14639
libgcc_s
https://github.com/NixOS/nixpkgs/blob/cf28ee258fd5f9a52de6b9865cdb93a1f96d09b7/pkgs/tools/networking/iftop/default.nix#L12-L14
strace
chroot
Refs.:
nm
Everything you need to build your own nm and otool
Refs.:
TODOs:
DT_RPATH vs DT_RUNPATH
List:
Refs.:
Refs.:
Refs.:
Refs.:
The C macros GLIBC and __GLIBC_MINOR__
TODO:
Refs.:
How to find dlopen calls?
Refs.:
For example:
Refs.:
C example: https://unix.stackexchange.com/a/462710
Refs.:
Refs.:
TODO: https://stackoverflow.com/questions/25785212/how-to-print-all-the-shared-objects-in-memory-at-a-particular-time
Refs.:
https://docs.rs/dlopen/latest/dlopen/
Python libs for tests
TODO: the polars lib https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=polars
python310Packages.pwntools
cryptography
nix build --print-out-paths --print-build-logs nixpkgs#python3Packages.localstack.dist
Mixed
List:
Maybe it is another way to have the same error?