nix/config/Package.nix

93 lines
1.9 KiB
Nix
Raw Normal View History

{
2024-11-04 04:37:29 +03:00
__findFile,
config,
lib,
pkgs,
...
} @args: let
cfg = config.module.package;
package = import <package> args;
in {
config = lib.mkMerge [
# Core apps.
2024-11-16 06:38:48 +03:00
(lib.mkIf cfg.core {
2024-11-04 04:37:29 +03:00
environment.systemPackages = package.core;
2024-11-04 04:37:29 +03:00
programs = {
adb.enable = true;
git.enable = true;
java = {
enable = true;
package = pkgs.corretto21;
};
};
services = {
udisks2.enable = true;
};
})
2024-08-02 23:45:19 +03:00
2024-11-04 04:37:29 +03:00
# Common apps.
2024-11-16 06:38:48 +03:00
(lib.mkIf cfg.common {
2024-11-04 04:37:29 +03:00
environment.systemPackages = package.common;
2024-10-29 00:15:58 +03:00
2024-11-04 04:37:29 +03:00
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-08-02 23:45:19 +03:00
2024-11-04 04:37:29 +03:00
services.gvfs.enable = true;
2024-08-02 23:45:19 +03:00
2024-11-04 04:37:29 +03:00
# Chromium config.
environment.etc = let
2024-11-16 04:56:36 +03:00
chromium = import <home/file/chromium> args;
2024-11-04 04:37:29 +03:00
in {
"chromium/initial_preferences".source = lib.mkForce chromium.preferences;
"chromium/policies/managed/extra.json".source = lib.mkForce chromium.policy;
};
})
2024-08-02 23:45:19 +03:00
2024-11-04 04:37:29 +03:00
# Desktop apps.
2024-11-16 06:38:48 +03:00
(lib.mkIf cfg.desktop {
2024-11-04 04:37:29 +03:00
environment.systemPackages = package.desktop;
})
2024-08-02 23:45:19 +03:00
2024-11-04 04:37:29 +03:00
# Gaming.
2024-11-16 06:38:48 +03:00
(lib.mkIf cfg.gaming {
2024-11-04 04:37:29 +03:00
programs.steam.enable = true;
environment.systemPackages = package.gaming;
hardware.graphics = let
packages = with pkgs; [
dxvk
gamescope
pkgs.mangohud
vkd3d
];
in {
extraPackages = packages;
extraPackages32 = packages;
};
})
2024-08-02 23:45:19 +03:00
2024-11-16 06:38:48 +03:00
# Creativity.
(lib.mkIf cfg.creativity {
2024-11-04 04:37:29 +03:00
environment.systemPackages = package.creative;
})
2024-08-02 23:45:19 +03:00
2024-11-04 04:37:29 +03:00
# Development.
2024-11-16 06:38:48 +03:00
(lib.mkIf cfg.dev {
2024-11-04 04:37:29 +03:00
environment.systemPackages = package.dev;
})
2024-08-02 23:45:19 +03:00
2024-11-04 04:37:29 +03:00
# Extras.
2024-11-16 06:38:48 +03:00
(lib.mkIf cfg.extra {
2024-11-04 04:37:29 +03:00
environment.systemPackages = package.extra;
})
];
}