mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-21 13:53:56 -05:00
Aly Raffauf
6935add0c7
Some checks are pending
git-mirror / gitlab-sync (push) Waiting to run
nix-build / adjustor-build (push) Waiting to run
nix-build / clean-install-build (push) Waiting to run
nix-build / hhd-ui-build (push) Waiting to run
nix-build / rofi-bluetooth-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / pacifidlog-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-build / slateport-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run
108 lines
3.1 KiB
Nix
108 lines
3.1 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}: let
|
|
cfg = config.ar.home.defaultApps;
|
|
mimeTypes = import ./mimeTypes.nix;
|
|
in {
|
|
config = lib.mkIf cfg.enable {
|
|
dconf = {
|
|
enable = true;
|
|
settings = {
|
|
"org/cinnamon/desktop/applications/terminal".exec = "${lib.getExe cfg.terminal}";
|
|
"org/cinnamon/desktop/default-applications/terminal".exec = "${lib.getExe cfg.terminal}";
|
|
};
|
|
};
|
|
|
|
home = {
|
|
packages = with cfg; [
|
|
audioPlayer
|
|
editor
|
|
fileManager
|
|
imageViewer
|
|
pdfViewer
|
|
terminal
|
|
terminalEditor
|
|
videoPlayer
|
|
webBrowser
|
|
];
|
|
|
|
sessionVariables = {
|
|
BROWSER = "${builtins.baseNameOf (lib.getExe cfg.webBrowser)}";
|
|
EDITOR = "${builtins.baseNameOf (lib.getExe cfg.terminalEditor)}";
|
|
TERMINAL = "${builtins.baseNameOf (lib.getExe cfg.terminal)}";
|
|
};
|
|
};
|
|
|
|
xdg = {
|
|
configFile."xfce4/helpers.rc".text = ''
|
|
FileManager=${builtins.baseNameOf (lib.getExe cfg.fileManager)}
|
|
TerminalEmulator=${builtins.baseNameOf (lib.getExe cfg.terminal)}
|
|
WebBrowser=${builtins.baseNameOf (lib.getExe cfg.webBrowser)}
|
|
'';
|
|
|
|
mimeApps = {
|
|
enable = true;
|
|
|
|
defaultApplications = let
|
|
mkDefaults = files: desktopFile: lib.genAttrs files (_: [desktopFile]);
|
|
audioTypes =
|
|
mkDefaults mimeTypes.audioFiles
|
|
"defaultAudioPlayer.desktop";
|
|
|
|
browserTypes =
|
|
mkDefaults mimeTypes.browserFiles
|
|
"defaultWebBrowser.desktop";
|
|
|
|
documentTypes =
|
|
mkDefaults mimeTypes.documentFiles
|
|
"defaultPdfViewer.desktop";
|
|
|
|
editorTypes =
|
|
mkDefaults mimeTypes.editorFiles
|
|
"defaultEditor.desktop";
|
|
|
|
folderTypes = {"inode/directory" = "defaultFileManager.desktop";};
|
|
|
|
imageTypes =
|
|
mkDefaults mimeTypes.imageFiles
|
|
"defaultImageViewer.desktop";
|
|
|
|
videoTypes =
|
|
mkDefaults mimeTypes.videoFiles
|
|
"defaultVideoPlayer.desktop";
|
|
in
|
|
audioTypes
|
|
// browserTypes
|
|
// documentTypes
|
|
// editorTypes
|
|
// folderTypes
|
|
// imageTypes
|
|
// videoTypes;
|
|
};
|
|
|
|
desktopEntries = let
|
|
mkDefaultEntry = name: package: {
|
|
exec = "${lib.getExe package} %U";
|
|
icon = "${builtins.baseNameOf (lib.getExe package)}";
|
|
name = "Default ${name}";
|
|
terminal = false;
|
|
|
|
settings = {
|
|
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;
|
|
};
|
|
};
|
|
};
|
|
}
|