Skip to content

Devshell module

Devshell module for developing polytropos-based Odoo addons.

Usage

Add this module to your flake to enable a development shell with all necessary dependencies for building Odoo addons:

{
    inputs = {
        devshell.url = "github:numtide/devshell";
        nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*";
        polytropos.url = "gitlab:moduon/polytropos";
    };

    outputs = inputs: {
        devShells.x86_64-linux.default = inputs.devshell.legacyPackages.x86_64-linux.mkShell {
            imports = [
                inputs.polytropos.modules.devshell.default
            ];
        };
    };
}

Entering the Devshell

nix develop --impure

Or with direnv:

direnv allow

What's Included

  • Python 3
  • UV
  • Build dependencies for Odoo addon development

About LD_LIBRARY_PATH

This module curates LD_LIBRARY_PATH to expose only the runtime shared libraries that impure virtual environments (e.g. the ones uv sync creates) need to resolve, and never libpython*.

glibc resolves LD_LIBRARY_PATH before DT_RUNPATH, so if libpython3.*.so leaked into the shell's library path, any foreign Python interpreter entering the shell (e.g. copier installed in a user profile built from another nixpkgs revision) would load the devshell's older libpython3.*.so.1.0 instead of its own, breaking it with errors like:

ImportError: .../lib-dynload/array.cpython-313-x86_64-linux-gnu.so: undefined symbol: _PyType_AllocNoTrack

This is tracked upstream in the numtide/devshell issue that originated this pattern (https://github.com/numtide/devshell/issues/172#issuecomment-1094675420), and the polytropos regression is tracked as MT-15975.

Python extension modules never link libpython; the interpreter itself provides those symbols. So only the libraries the venvs truly need at runtime belong here: currently zlib, openldap, stdenv.cc.cc.lib (libstdc++), libffi, postgresql.lib, and the openldap-lib-fix fixture.