diff --git a/homeManagerModules/defaultApps.nix b/homeManagerModules/defaultApps.nix index d7d82322..6bba8b55 100644 --- a/homeManagerModules/defaultApps.nix +++ b/homeManagerModules/defaultApps.nix @@ -42,7 +42,7 @@ in { WebBrowser=${builtins.baseNameOf (lib.getExe cfg.webBrowser)} ''; - mimeApps = { + mimeApps = lib.mkIf cfg.forceMimeAssociations { enable = true; defaultApplications = let @@ -93,15 +93,16 @@ in { NoDisplay = "true"; }; }; - in { - defaultAudioPlayer = mkDefaultEntry "Audio Player" cfg.audioPlayer; - defaultEditor = mkDefaultEntry "Editor" cfg.editor; - defaultFileManager = mkDefaultEntry "File Manager" cfg.fileManager; - defaultImageViewer = mkDefaultEntry "Image Viewer" cfg.imageViewer; - defaultPdfViewer = mkDefaultEntry "PDF Viewer" cfg.pdfViewer; - defaultVideoPlayer = mkDefaultEntry "Video Player" cfg.videoPlayer; - defaultWebBrowser = mkDefaultEntry "Web Browser" cfg.webBrowser; - }; + in + lib.mkIf cfg.forceMimeAssociations { + defaultAudioPlayer = mkDefaultEntry "Audio Player" cfg.audioPlayer; + defaultEditor = mkDefaultEntry "Editor" cfg.editor; + defaultFileManager = mkDefaultEntry "File Manager" cfg.fileManager; + defaultImageViewer = mkDefaultEntry "Image Viewer" cfg.imageViewer; + defaultPdfViewer = mkDefaultEntry "PDF Viewer" cfg.pdfViewer; + defaultVideoPlayer = mkDefaultEntry "Video Player" cfg.videoPlayer; + defaultWebBrowser = mkDefaultEntry "Web Browser" cfg.webBrowser; + }; }; }; } diff --git a/homeManagerModules/options.nix b/homeManagerModules/options.nix index 2cd04f9e..34ad57c9 100644 --- a/homeManagerModules/options.nix +++ b/homeManagerModules/options.nix @@ -77,6 +77,8 @@ in { defaultApps = { enable = lib.mkEnableOption "Declaratively set default apps and file associations."; + forceMimeAssociations = lib.mkEnableOption "Force mime associations for defaultApps."; + audioPlayer = lib.mkPackageOption pkgs "audio player" {default = ["celluloid"];}; editor = lib.mkPackageOption pkgs "text editor" {default = ["vscodium"];}; fileManager = lib.mkPackageOption pkgs "file manager" {default = ["nemo"];};