home/defaultApps: add forceMimeAssociations option

This commit is contained in:
Aly Raffauf 2024-12-19 11:11:07 -05:00
parent 628b6d3a98
commit 5f4fdf1c09
2 changed files with 13 additions and 10 deletions

View file

@ -42,7 +42,7 @@ in {
WebBrowser=${builtins.baseNameOf (lib.getExe cfg.webBrowser)} WebBrowser=${builtins.baseNameOf (lib.getExe cfg.webBrowser)}
''; '';
mimeApps = { mimeApps = lib.mkIf cfg.forceMimeAssociations {
enable = true; enable = true;
defaultApplications = let defaultApplications = let
@ -93,7 +93,8 @@ in {
NoDisplay = "true"; NoDisplay = "true";
}; };
}; };
in { in
lib.mkIf cfg.forceMimeAssociations {
defaultAudioPlayer = mkDefaultEntry "Audio Player" cfg.audioPlayer; defaultAudioPlayer = mkDefaultEntry "Audio Player" cfg.audioPlayer;
defaultEditor = mkDefaultEntry "Editor" cfg.editor; defaultEditor = mkDefaultEntry "Editor" cfg.editor;
defaultFileManager = mkDefaultEntry "File Manager" cfg.fileManager; defaultFileManager = mkDefaultEntry "File Manager" cfg.fileManager;

View file

@ -77,6 +77,8 @@ in {
defaultApps = { defaultApps = {
enable = lib.mkEnableOption "Declaratively set default apps and file associations."; 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"];}; audioPlayer = lib.mkPackageOption pkgs "audio player" {default = ["celluloid"];};
editor = lib.mkPackageOption pkgs "text editor" {default = ["vscodium"];}; editor = lib.mkPackageOption pkgs "text editor" {default = ["vscodium"];};
fileManager = lib.mkPackageOption pkgs "file manager" {default = ["nemo"];}; fileManager = lib.mkPackageOption pkgs "file manager" {default = ["nemo"];};