NixOS protobuf-maven-plugin error

This is poom.xml of grpc_lib submodule

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>haita.chat</artifactId>
        <groupId>com.haita</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>grpc_lib</artifactId>

    <dependencies>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-stub</artifactId>
            <version>${grpc.version}</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-protobuf</artifactId>
            <version>${grpc.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>${protoc.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.2</version>
        </dependency>



    </dependencies>

    <build>
        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
            </extension>
        </extensions>

        <plugins>
            <plugin>
                <groupId>org.xolstice.maven.plugins</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
                <configuration>
                    <protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}
                    </protocArtifact>
                    <pluginId>grpc-java</pluginId>
                    <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
                    </pluginArtifact>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>compile-custom</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


</project>

and when I run mvn clean install -DskipTests get these errors. It works well in other system.

[ERROR] Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile (default) on project grpc_lib: An error occurred while invoking protoc: Error while executing process.: Cannot run program "/home/yswtrue/Code/chat_java_lib/haita-chat/grpc_lib/target/protoc-plugins/protoc-3.17.3-linux-x86_64.exe": error=2, No such file or directory -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :grpc_lib

these is ldd /home/yswtrue/Code/chat_java_lib/haita-chat/grpc_lib/target/protoc-plugins/protoc-3.17.3-linux-x86_64.exe

ldd /home/yswtrue/Code/chat_java_lib/haita-chat/grpc_lib/target/protoc-plugins/protoc-3.17.3-linux-x86_64.exe
        linux-vdso.so.1 (0x00007ffc0baf2000)
        libpthread.so.0 => /nix/store/6f66prpgx1qx4n6k450sxs3d157ia1ps-glibc-2.35-163/lib/libpthread.so.0 (0x00007ff530fd8000)
        libm.so.6 => /nix/store/6f66prpgx1qx4n6k450sxs3d157ia1ps-glibc-2.35-163/lib/libm.so.6 (0x00007ff530ef8000)
        libstdc++.so.6 => /nix/store/cs16l9whsq2mgydlg0j4x517z4qr861k-gcc-11.3.0-lib/lib/libstdc++.so.6 (0x00007ff530ce1000)
        libgcc_s.so.1 => /nix/store/cs16l9whsq2mgydlg0j4x517z4qr861k-gcc-11.3.0-lib/lib/libgcc_s.so.1 (0x00007ff530cc6000)
        libc.so.6 => /nix/store/6f66prpgx1qx4n6k450sxs3d157ia1ps-glibc-2.35-163/lib/libc.so.6 (0x00007ff530aba000)
        /lib64/ld-linux-x86-64.so.2 => /nix/store/6f66prpgx1qx4n6k450sxs3d157ia1ps-glibc-2.35-163/lib64/ld-linux-x86-64.so.2 (0x00007ff530fdf000)


patchelf --print-interpreter /home/yswtrue/Code/chat_java_lib/haita-chat/grpc_lib/target/protoc-plugins/protoc-3.21.1-linux-x86_64.exe

/lib64/ld-linux-x86-64.so.2
    theLd=$(patchelf --print-interpreter $(which mkdir))
    patchelf  --set-interpreter $theLd $(pwd)/haita-chat/grpc_lib/target/protoc-plugins/protoc-3.17.3-linux-x86_64.exe
    patchelf  --set-interpreter $theLd $(pwd)/haita-chat/grpc_lib/target/protoc-plugins/protoc-gen-grpc-java-1.41.0-linux-x86_64.exe

this works for me

filed an issue upstream to see if they’d be OK with a change that would make this work out-of-the-box in a nix-shell:

https://github.com/xolstice/protobuf-maven-plugin/issues/108