From 14fc51fe18f0d45aade3b076a5e0a9eab91435d0 Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Fri, 14 Mar 2025 11:50:06 +0100 Subject: [PATCH] Make discord parts of default associations --- home/common-linux.nix | 1 - home/modules/linux/graphical/default.nix | 31 ++++++++++++++++++------ home/modules/programs/discord.nix | 27 --------------------- home/nki-x1c1.nix | 4 +-- 4 files changed, 25 insertions(+), 38 deletions(-) delete mode 100644 home/modules/programs/discord.nix diff --git a/home/common-linux.nix b/home/common-linux.nix index 89d6699..885243f 100644 --- a/home/common-linux.nix +++ b/home/common-linux.nix @@ -25,7 +25,6 @@ in ./modules/monitors.nix ./modules/linux/graphical ./modules/X11/xfce4-notifyd.nix - ./modules/programs/discord.nix kwallet ]; config = (mkIf pkgs.stdenv.isLinux { diff --git a/home/modules/linux/graphical/default.nix b/home/modules/linux/graphical/default.nix index 0e702c2..1d0f143 100644 --- a/home/modules/linux/graphical/default.nix +++ b/home/modules/linux/graphical/default.nix @@ -3,7 +3,6 @@ with lib; let cfg = config.linux.graphical; - thunderbird = pkgs.thunderbird-128; vscode = with pkgs; if stdenv.isAarch64 then unstable.vscode else unstable.vscode-fhs; wifi-indicator = pkgs.writeScriptBin "wifi-indicator" '' @@ -52,15 +51,16 @@ in startup = mkOption { type = types.listOf types.package; description = "List of packages to include in ~/.config/autostart"; - default = with pkgs; [ + default = [ cfg.defaults.webBrowser.package - thunderbird - vesktop + pkgs.thunderbird + cfg.defaults.discord.package ]; }; defaults = { webBrowser = mkPackageWithDesktopOption { description = "default web browser"; }; terminal = mkPackageWithDesktopOption { description = "default terminal"; default.package = pkgs.kitty; }; + discord = mkPackageWithDesktopOption { description = "Discord client"; default.package = pkgs.vesktop; }; }; }; config = mkIf (cfg.type != null) { @@ -106,9 +106,6 @@ in wifi-indicator ] ++ cfg.startup); - nki.programs.discord.enable = pkgs.stdenv.isx86_64; - nki.programs.discord.package = pkgs.vesktop; - # OBS programs.obs-studio = { enable = true; @@ -146,6 +143,14 @@ in "application/x-extension-rss" = [ "thunderbird.desktop" ]; "x-scheme-handler/tg2" = [ "org.telegram.desktop.desktop" ]; "x-scheme-handler/tonsite2" = [ "org.telegram.desktop.desktop" ]; + + # Other browser stuff + "application/x-extension-htm" = [ (desktopFileOf cfg.defaults.webBrowser) ]; + "application/x-extension-html" = [ (desktopFileOf cfg.defaults.webBrowser) ]; + "application/x-extension-shtml" = [ (desktopFileOf cfg.defaults.webBrowser) ]; + "application/xhtml+xml" = [ (desktopFileOf cfg.defaults.webBrowser) ]; + "application/x-extension-xhtml" = [ (desktopFileOf cfg.defaults.webBrowser) ]; + "application/x-extension-xht" = [ (desktopFileOf cfg.defaults.webBrowser) ]; }; xdg.mimeApps.defaultApplications = { # Email @@ -164,6 +169,7 @@ in # Default web browser stuff "text/html" = [ (desktopFileOf cfg.defaults.webBrowser) ]; + "x-scheme-handler/chrome" = [ (desktopFileOf cfg.defaults.webBrowser) ]; "x-scheme-handler/about" = [ (desktopFileOf cfg.defaults.webBrowser) ]; "x-scheme-handler/unknown" = [ (desktopFileOf cfg.defaults.webBrowser) ]; "x-scheme-handler/http" = [ (desktopFileOf cfg.defaults.webBrowser) ]; @@ -171,6 +177,12 @@ in "x-scheme-handler/ftp" = [ (desktopFileOf cfg.defaults.webBrowser) ]; "x-scheme-handler/ftps" = [ (desktopFileOf cfg.defaults.webBrowser) ]; "x-scheme-handler/file" = [ (desktopFileOf cfg.defaults.webBrowser) ]; + "application/x-extension-htm" = [ (desktopFileOf cfg.defaults.webBrowser) ]; + "application/x-extension-html" = [ (desktopFileOf cfg.defaults.webBrowser) ]; + "application/x-extension-shtml" = [ (desktopFileOf cfg.defaults.webBrowser) ]; + "application/xhtml+xml" = [ (desktopFileOf cfg.defaults.webBrowser) ]; + "application/x-extension-xhtml" = [ (desktopFileOf cfg.defaults.webBrowser) ]; + "application/x-extension-xht" = [ (desktopFileOf cfg.defaults.webBrowser) ]; # Torrent "application/x-bittorrent" = [ "deluge.desktop" ]; @@ -186,13 +198,16 @@ in # Telegram "x-scheme-handler/tg2" = "org.telegram.desktop.desktop"; "x-scheme-handler/tonsite2" = "org.telegram.desktop.desktop"; + + # Discord + "x-scheme-handler/discord" = [ (desktopFileOf cfg.defaults.discord) ]; }; # Add one for kakoune xdg.desktopEntries."kakoune" = { name = "Kakoune"; genericName = "Text Editor"; - exec = ''kitty --class kitty-float -o initial_window_width=150c -o initial_window_height=40c ${pkgs.writeShellScript "editor.sh" '' + exec = ''${lib.getExe pkgs.kitty} --class kitty-float -o initial_window_width=150c -o initial_window_height=40c ${pkgs.writeShellScript "editor.sh" '' $EDITOR "$@" ''} %U''; # exec = "kakoune %U"; diff --git a/home/modules/programs/discord.nix b/home/modules/programs/discord.nix deleted file mode 100644 index 0b2eb52..0000000 --- a/home/modules/programs/discord.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ config, pkgs, lib, ... }: - -with lib; -let - cfg = config.nki.programs.discord; -in -{ - options.nki.programs.discord = { - enable = mkEnableOption "Enable discord"; - - basePackage = mkOption { - type = types.package; - default = pkgs.discord; - description = "The base Discord package that will get patched"; - }; - - package = mkOption { - type = types.package; - default = cfg.basePackage.override { nss = pkgs.nss_latest; }; - description = "The actual package to use"; - }; - }; - - config = mkIf cfg.enable { - home.packages = [ cfg.package ]; - }; -} diff --git a/home/nki-x1c1.nix b/home/nki-x1c1.nix index 35b9db5..9f762bd 100644 --- a/home/nki-x1c1.nix +++ b/home/nki-x1c1.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ pkgs, options, config, lib, ... }: let iio-sway = pkgs.stdenv.mkDerivation { @@ -44,7 +44,7 @@ in # Graphical set up linux.graphical.type = "wayland"; linux.graphical.wallpaper = ./images/wallpaper_0.png; - linux.graphical.startup = with pkgs; [ zen-browser-bin thunderbird vesktop slack ]; + linux.graphical.startup = options.linux.graphical.startup.default ++ [ pkgs.slack ]; linux.graphical.defaults.webBrowser.package = pkgs.zen-browser-bin; linux.graphical.defaults.webBrowser.desktopFile = "zen.desktop"; # Enable sway