nix/module/desktop/App.nix

185 lines
6.4 KiB
Nix
Raw Normal View History

2024-06-25 04:04:39 +03:00
{ pkgs, pkgsStable, pkgsMaster, config, lib, ... } @args: with lib; let
cfg = config.module.desktop.app;
2024-04-30 20:36:22 +03:00
mangohud = import ./mangohud args;
2024-06-25 04:04:39 +03:00
firefox = import ./firefox args;
2024-04-30 20:36:22 +03:00
in {
2024-06-25 04:04:39 +03:00
options = {
module.desktop.app = {
common.enable = mkEnableOption "Common Apps.";
gaming.enable = mkEnableOption "Gaming Apps.";
creative.enable = mkEnableOption "Creative Apps.";
dev.enable = mkEnableOption "Dev Apps.";
extra.enable = mkEnableOption "Extra Apps.";
};
2024-03-29 08:22:03 +03:00
};
config = mkMerge [
# Common apps.
(mkIf cfg.common.enable { xdg.mime.defaultApplications = {
# Use `file -i file.txt` to find file mime type.
# Use `xdg-mime query default "text/plain"` to find default app.
"application/pdf" = "org.gnome.Evince.desktop";
"application/vnd.openxmlformats-officedocument.*" = "onlyoffice-desktopeditors.desktop";
"audio/*" = "mpv.desktop";
"image/*" = "org.gnome.Loupe.desktop";
"text/*" = "nvim.desktop";
"video/*" = "mpv.desktop";
};
2024-06-25 04:04:39 +03:00
environment = {
systemPackages = with pkgs; [
appimage-run # Tool to run .AppImage files in NixOS.
evince # Document viewer.
foot # Terminal emulator.
gimp # Image manipulation program.
gnome.adwaita-icon-theme # GTK icons.
gnome.gnome-calculator # Calculator.
gnome.nautilus # File manager.
jellyfin-media-player # Jellyfin client (self-hosted Netflix).
loupe # Image viewer.
obs-studio # Streaming/recording app.
onlyoffice-bin # Office documents app suite.
(mpv.override {scripts = [mpvScripts.mpris];}) # Media player.
];
variables = {
# GTK apps compat.
GTK_CSD = 0;
# Terminal settings.
TERM = "xterm-256color";
TERMINAL = config.setting.terminal.bin;
# Disable Firefox profile switching on rebuild.
MOZ_LEGACY_PROFILES = "1";
};
};
2024-06-24 03:32:33 +03:00
programs.firefox = let
mkExtension = install_url: {
inherit install_url;
installation_mode = "force_installed";
};
2024-06-25 04:04:39 +03:00
mkBookmark = name: url: { inherit name url; };
in {
enable = true;
package = pkgs.firefox-esr;
languagePacks = [ "en-US" "ru" ];
autoConfig = firefox.config;
policies = {
ManagedBookmarks = [
{ toplevel_name = "Pin"; }
(mkBookmark "Dashboard" "https://home.voronind.com")
(mkBookmark "Music" "https://music.yandex.ru")
(mkBookmark "Telegram" "https://web.telegram.org/a")
(mkBookmark "Discord" "https://discord.com")
(mkBookmark "WorkMail" "https://mail.fsight.ru")
(mkBookmark "Git" "https://git.voronind.com")
(mkBookmark "WorkGit" "https://git.fmp.fsight.world")
(mkBookmark "WorkBoard" "https://support.fsight.ru")
(mkBookmark "Hass" "https://iot.voronind.com")
(mkBookmark "Cloud" "https://cloud.voronind.com")
];
ExtensionUpdate = true;
ExtensionSettings = {
# Block extension installation outside of this config.
"*" = {
install_sources = [ "*" ];
installation_mode = "blocked";
};
"addon@darkreader.org" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi";
"cliget@zaidabdulla.com" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/cliget/latest.xpi";
"uBlock0@raymondhill.net" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi";
"{d7742d87-e61d-4b78-b8a1-b469842139fa}" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/vimium-ff/latest.xpi";
"{e7625f06-e252-479d-ac7a-db68aeaff2cb}" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/togglefonts/latest.xpi";
"{a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7}" = mkExtension "https://addons.mozilla.org/firefox/downloads/latest/user-agent-string-switcher/latest.xpi";
# NOTE: This extension is helpful to find the required parameters for this config.
# Or find them yourself inside the `about:support`.
# "queryamoid@kaply.com" = mkExtension "https://github.com/mkaply/queryamoid/releases/download/v0.1/query_amo_addon_id-0.1-fx.xpi";
};
# NOTE: `firefox-esr` edition is required to change default search engine.
SearchEngines = {
Default = "Searx";
Add = [
{
Alias = "s";
Description = "Searx Search";
IconURL = "https://search.voronind.com/favicon.ico";
Method = "POST";
Name = "Searx";
PostData = "q={searchTerms}";
# SuggestURLTemplate = "https://search.voronind.com/autocomplete?q={searchTerms}";
URLTemplate = "https://search.voronind.com/search?q=%{searchTerms}";
}
];
};
};
2024-06-25 04:04:39 +03:00
};
})
# Gaming.
(mkIf cfg.gaming.enable {
hardware.graphics = let
packages = with pkgs; [
dxvk
gamescope
pkgs.mangohud
vkd3d
];
in {
extraPackages = packages;
extraPackages32 = packages;
};
2024-06-25 04:04:39 +03:00
programs.steam.enable = true;
environment = {
systemPackages = with pkgs; [
steam-run
bottles dxvk gamescope pkgs.mangohud vkd3d wine64 # Gaming!
];
variables = {
MANGOHUD = "1";
MANGOHUD_CONFIGFILE = pkgs.writeText "MangoHudConfig" mangohud.config;
MANGOHUD_PRESETSFILE = pkgs.writeText "MangoHudPreset" mangohud.presets;
2024-06-25 04:04:39 +03:00
WINEFSYNC = "1";
2024-06-25 04:04:39 +03:00
};
};
})
# Creative.
(mkIf cfg.creative.enable {
environment.systemPackages = with pkgs; [
aseprite # Pixel Art draw app. WARNING: Always builds from source.
blender-hip # Blender with HiP support.
krita # Draw!
];
})
# Development.
(mkIf cfg.dev.enable {
environment.systemPackages = with pkgs; [
android-studio
jetbrains.idea-community
];
})
# Extras.
(mkIf cfg.extra.enable {
environment.systemPackages = with pkgs; [
anilibria-winmaclinux # Anime!
blanket # Sounds generator.
calibre # Book library manager.
gnome.gnome-font-viewer # Font viewer.
tor-browser # Privacy browser.
];
})
];
}