{ pkgs, ... }:
let
    pythonldlibpath = pkgs.lib.makeLibraryPath (with pkgs; [
        libGL
        glib
        zlib
        zstd
        stdenv.cc.cc
        curl
        openssl
        attr
        libssh
        bzip2
        libxml2
        acl
        libsodium
        util-linux
        xz
        systemd
    ]);
    # Darwin requires a different library path prefix
    wrapPrefix = if (!pkgs.stdenv.isDarwin) then "LD_LIBRARY_PATH" else "DYLD_LIBRARY_PATH";
    # pythonOverlay = (pkgs.python313.withPackages (ps: [
    #     (ps.torch.override { rocmSupport = true; })
    # ]));

    patchedpython = (pkgs.symlinkJoin {
        name = "python";
        paths = [ pkgs.python313 ];
        buildInputs = [ pkgs.makeWrapper ];
        postBuild = ''
      wrapProgram "$out/bin/python3.13" --prefix ${wrapPrefix} : "${pythonldlibpath}"
        '';
    });
in {
    home.packages = [
        patchedpython
    ];
}
