Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set chrome for default browser in NixOS since GH-715 #953

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@
{ targets.genericLinux.enable = false; }
./home-manager/lima-host.nix
./home-manager/systemd.nix
./home-manager/gnome.nix
./home-manager/desktop.nix
./home-manager/firefox.nix
];
};
Expand Down
29 changes: 29 additions & 0 deletions home-manager/desktop.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ lib, pkgs, ... }:

{
imports = [ ./gnome.nix ];

# https://github.com/nix-community/home-manager/blob/release-24.11/modules/home-environment.nix#
# https://github.com/nix-community/home-manager/blob/release-24.11/modules/lib/dag.nix
home = {
activation = {
# defaultApplications in xdg=* modules do not support except mime types. So required this for hotkey use
setDefaultBrowser = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
run '${pkgs.xdg-utils}/bin/xdg-settings' set 'default-web-browser' 'google-chrome.desktop'
'';
};
};

xdg = {
# https://github.com/nix-community/home-manager/blob/release-24.11/modules/misc/xdg-mime-apps.nix - different of https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/modules/config/xdg/mime.nix
mimeApps = {
enable = false; # Avoiding error: bin/xdg-mime: line 1002: hm_mimeapps.list.new: Read-only file system
defaultApplications = {
"application/pdf" = [
"google-chrome.desktop"
"firefox.desktop"
];
};
};
};
}
1 change: 0 additions & 1 deletion home-manager/gnome.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ in
favorite-apps = [
"kitty.desktop"
"dev.zed.Zed.desktop"
"firefox.desktop"
"google-chrome.desktop"
"podman-desktop.desktop"
"io.gitlab.news_flash.NewsFlash.desktop"
Expand Down
6 changes: 6 additions & 0 deletions nixos/desktop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@
];
}))

# NOTE: Google might extract chrome from themself with `Antitrust` penalties
# https://edition.cnn.com/2024/11/20/business/google-sell-chrome-justice-department/
#
# Don't use chromium, it does not provide built-in cloud translations
#
# Don't use unstable channel. It frequently backported to stable channel
# - https://github.com/NixOS/nixpkgs/commits/nixos-24.11/pkgs/by-name/go/google-chrome/package.nix
# - Actually unstable is/was broken. See GH-776
Expand Down Expand Up @@ -279,6 +284,7 @@
VIDEOS=Videos
'';

# Require add-on for built-in Japanese translations and multiple containers. It is a disadvantage than Chrome
# https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/modules/programs/firefox.nix
programs.firefox = {
enable = true;
Expand Down