Skip to content

Instantly share code, notes, and snippets.

@bobvanderlinden
Last active April 7, 2024 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobvanderlinden/f31299079b67ddcc1b2c6029cf6569f6 to your computer and use it in GitHub Desktop.
Save bobvanderlinden/f31299079b67ddcc1b2c6029cf6569f6 to your computer and use it in GitHub Desktop.
devenv+python+git regression

devenv git+python regression

This is an example where devenv+python will fail when the git binary from the system is based on an older libc than the libc that is used in devenv. The system git is provided here by nix develop . to simulate an older system.

$ nix develop .
# This loads an older version of git (based on an older libc).
$ devenv shell
# This uses python to run `pip install -r requirements.txt` and will try to clone a git repository from there.
# Python uses a newer libc, which is passed through to subprocesses using `LD_LIBRARY_PATH` to `git`. `git` cannot run because of an incompatible libc.
Collecting git+https://github.com/pypa/sampleproject.git (from -r /nix/store/g41hqm03k2179v5pkyv889gyrgb370g0-requirements.txt (line 1))
  Cloning https://github.com/pypa/sampleproject.git to /tmp/nix-shell.07Ag0j/nix-shell.tKP4lT/pip-req-build-jidkerj5
  error: subprocess-exited-with-error
  
  × git version did not run successfully.
  │ exit code: 127
  ╰─> [2 lines of output]
      git: error while loading shared libraries: __vdso_gettimeofday: invalid mode for dlopen(): Invalid argument
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1712300418,
"owner": "cachix",
"repo": "devenv",
"rev": "8827aa19daf1fc3f53e7adcc7201933ef28f8652",
"treeHash": "178f1241b3bfb93735f76537fa286cdf214318b0",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"treeHash": "2addb7b71a20a25ea74feeaf5c2f6a6b30898ecb",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"treeHash": "bd263f021e345cb4a39d80c126ab650bebc3c10c",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"treeHash": "ca14199cabdfe1a06a7b1654c76ed49100a689f9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1710796454,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "06fb0f1c643aee3ae6838dda3b37ef0abc3c763b",
"treeHash": "9bb13f7f39e825a5d91bbe4139fbc129243b907d",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1712310679,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "72da83d9515b43550436891f538ff41d68eecc7f",
"treeHash": "c7c30bac3b59774c0f9df84f5dfe9bd4f981869a",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1712055707,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "e35aed5fda3cc79f88ed7f1795021e559582093a",
"treeHash": "41bee5f5bd9314a987ef3d7cba730fb6aa264a4e",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"treeHash": "cce81f2a0f0743b2eb61bc2eb6c7adbe2f2c6beb",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
{ pkgs, lib, config, inputs, ... }:
{
languages.python = {
enable = true;
venv = {
enable = true;
requirements = ''
git+https://github.com/pypa/sampleproject.git
'';
};
};
}
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
# If you're using non-OSS software, you can set allowUnfree to true.
# allowUnfree: true
# If you're willing to use a package that's vulnerable
# permittedInsecurePackages:
# - "openssl-1.1.1w"
# If you have more than one devenv you can merge them
#imports:
# - ./backend
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1704290814,
"narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
};
outputs = { self, nixpkgs }: let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in {
devShell.x86_64-linux = pkgs.mkShell {
buildInputs = [ pkgs.git ];
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment