Every command is done under a nix-shell opened with the following command.
$ nix-shell -p gcc SDL2 steam-run
First thing compile the executable to debug controller hot plugging.
$ gcc ./main.c -o ./main -lSDL2
Now there are three ways to test.
./main
steam-run ./main
sudo steam-run ./main
The result for the first method and the third are the same.
The second only sees the controller if it was plugged before running the program, but trying to re-plug it will not show any message.