`hy.withPackages' with `hyrule' gives `error: unable to execute '/nix/store/[hash]-python3.10-hy-0.24.0/bin/hy': No such file or directory'

Hello!

When using the following overlays with pkgs.python310.pkgs.hy.withPackages, I am getting the error in the title when using nix run:

hy = final: prev: { python310 = prev.python310.override (super: {
    packageOverrides = composeExtensions (super.packageOverrides or (_: _: {})) (new: old: {
        hyrule = prev.python310.pkgs.hyrule.overridePythonAttrs (old: with final.Python3.pkgs; rec {
            version = "0.24.0";
            HY_VERSION = version;
            src = final.fetchFromGitHub {
                owner = "hylang";
                repo = old.pname;
                rev = version;
                sha256 = "1s458ymd9g3s8k2ccc300jr4w66c7q3vhmhs9z3d3a4qg0xdhs9y";
            };
            postPatch = ''substituteInPlace setup.py --replace "\"funcparserlib ~= 1.0\"," ""'' + (old.postPatch or "");
            disabledTestPaths = [ "tests/test_bin.py" ] ++ (old.disabledTestPaths or []);
            passthru = {
                tests.version = testers.testVersion {
                    package = hy;
                    command = "hy -v";
                };
                withPackages = python-packages: (toPythonApplication hy).overrideAttrs (old: {
                    propagatedBuildInputs = python-packages final.Python3.pkgs ++ (old.propagatedBuildInputs or []);
                });
            };
        });
    });
}); };
hyrule = final: prev: { python310 = prev.python310.override (super: {
    packageOverrides = composeExtensions (super.packageOverrides or (_: _: {})) (new: old: {
        hyrule = prev.python310.pkgs.hyrule.overridePythonAttrs (old: rec {
            version = "0.2";
            src = final.fetchFromGitHub {
                owner = "hylang";
                repo = old.pname;
                rev = version;
                sha256 = "08w4q8s1hrnjqsqvs70adx90nqfij6iyyb4fzfffrrw2mwkf10gx";
            };
            postPatch = ''substituteInPlace setup.py --replace "'hy == 0.24.0'," ""'' + (old.postPatch or "");
        });
    });
}); };

Interesting, this does not seem to happen with nix develop, or using any other python package with hy.withPackages and nix run; I have a feeling happens only with packages that depend on hy as a package itself, and not as an interpreter.

Thank you kindly for the help!

1 Like