https://github.com/owdevel/nix-shell-selenium-chrome
Example of how to use google-chrome with nix-shell and python selenium
https://github.com/owdevel/nix-shell-selenium-chrome
chromedriver google-chrome nix-shell nixos selenium-python
Last synced: 6 months ago
JSON representation
Example of how to use google-chrome with nix-shell and python selenium
- Host: GitHub
- URL: https://github.com/owdevel/nix-shell-selenium-chrome
- Owner: owdevel
- Created: 2022-11-29T06:34:02.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-29T06:51:03.000Z (over 3 years ago)
- Last Synced: 2025-01-23T03:29:01.345Z (over 1 year ago)
- Topics: chromedriver, google-chrome, nix-shell, nixos, selenium-python
- Language: Python
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nix-shell Selenium with Google Chrome Binary
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](https://github.com/NixOS/nixpkgs/blob/nixos-22.05/pkgs/applications/networking/browsers/google-chrome/default.nix#L163) 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](https://www.reddit.com/r/NixOS/comments/nur5zv/simple_way_to_rename_symlink_or_wrap_a_system/) for the idea.
Tested on nix-os 22.05.
## TLDR
Add this to your `shell.nix` packages.
```
(pkgs.writeShellScriptBin "google-chrome" "exec -a $0 ${pkgs.google-chrome}/bin/google-chrome-stable $@")
```
## Author's Note
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 :).