Done!

how to install chrome on nixos? provide detailed steps

Technology
Computer Science
Operating Systems

Progress

6 steps completed!21.88 sec

Answer

To install Google Chrome on NixOS, you need to follow specific steps since NixOS uses a different configuration management approach. Chrome isn't included in the Nixpkgs default packages, so you'll typically use the nixpkgs repository to handle it. Here’s how to do it:

Step 1: Set Up Your Nix Configuration

  1. Edit the NixOS Configuration File: Open your NixOS configuration file, usually located at /etc/nixos/configuration.nix. You can use a text editor like nano or vim:

    sudo nano /etc/nixos/configuration.nix
  2. Add Chrome to Your Environment: Look for the environment.systemPackages line. You’ll want to add google-chrome to this list. If it does not exist, you can create it.

    Example:

    environment.systemPackages = with pkgs; [ google-chrome ];

Step 2: Update Configuration

  1. Rebuild Your NixOS: After saving changes to your configuration file, apply them by running the following command:

    sudo nixos-rebuild switch

Step 3: Launch Google Chrome

Once the rebuild is complete, you should be able to start Google Chrome. You can do this by searching for it in your application menu or running it from the terminal:

google-chrome

Step 4: Create a Desktop Entry (Optional)

If you want a desktop entry for Google Chrome to appear in your applications menu, you may need to create one manually. You can do this by creating a file at ~/.local/share/applications/google-chrome.desktop:

  1. Create or Edit the Desktop Entry:

    nano ~/.local/share/applications/google-chrome.desktop
  2. Add the Following Content:

    [Desktop Entry] Version=1.0 Name=Google Chrome Exec=google-chrome Icon=/usr/share/icons/hicolor/48x48/apps/google-chrome.png Type=Application Categories=Network;WebBrowser; StartupNotify=true

Additional Note: Running without configuration

If you're not comfortable modifying your configuration file or want to try Google Chrome without adding it permanently, you can also use nix-env to install it temporarily:

nix-env -iA nixpkgs.google-chrome

This command installs Google Chrome for your user profile and does not require rebuilding the entire system configuration.

Conclusion

That's it! You should now have Google Chrome installed and ready to use on your NixOS system. If you encounter any issues, check the logs and ensure that your Nix expression is correctly set up.