Simple example of using nix-shell
to create a development environment for selenium
in python using chromedriver
and the google-chrome
binary.
The nixpkgs version of google-chrome appends the channel (stable/beta/dev) to the binary name which causes selenium to not be able to find the correct binary as it is looking for the binary name google-chrome
not google-chrome-stable
.
This repo uses writeShellScriptBin
to create a google-chrome
script which exectues the correct binary.
Credit goes to this reddit post for the idea.
Tested on nix-os 22.05.
Add this to your shell.nix
packages.
(pkgs.writeShellScriptBin "google-chrome" "exec -a $0 ${pkgs.google-chrome}/bin/google-chrome-stable $@")
As of writing this I'm still new to Nix-OS and the related ecosystem. If there is a better way of doing this please let me know :).