marleyos/modules/home/options/apps/default.nix

119 lines
3.2 KiB
Nix

{
lib,
config,
pkgs,
system,
...
}: let
inherit (lib.snowfall.system) is-linux;
cfg = config.marleyos.apps;
in {
options.marleyos.apps = {
pinentry = lib.mkOption {
type = lib.types.package;
default = pkgs.pinentry-gtk2;
description = "The pinentry package to use.";
};
clipboard = let
isXorg = config.marleyos.xorg.xsession.enable;
defaultXorg = {
package = pkgs.clipboard-jh;
copy-command = "${lib.getExe pkgs.clipboard-jh} copy";
paste-command = "${lib.getExe pkgs.clipboard-jh} paste";
};
defaultWayland = {
package = pkgs.wl-clipboard;
copy-command = lib.getExe' pkgs.wl-clipboard "wl-copy";
paste-command = lib.getExe' pkgs.wl-clipboard "wl-paste";
};
in
lib.mkOption {
type = lib.types.submodule {
options = {
package = lib.mkOption {
type = lib.types.package;
default =
if isXorg
then defaultXorg.package
else defaultWayland.package;
description = "The clipboard manager to use.";
};
copy-command = lib.mkOption {
type = lib.types.str;
default =
if isXorg
then defaultXorg.copy-command
else defaultWayland.copy-command;
description = "The command, including binary, to use for copying.";
};
paste-command = lib.mkOption {
type = lib.types.str;
default =
if isXorg
then defaultXorg.paste-command
else defaultWayland.paste-command;
description = "The command, including binary, to use for pasting.";
};
};
};
default =
if isXorg
then defaultXorg
else defaultWayland;
};
terminal = lib.mkOption {
type = lib.types.package;
default = config.programs.wezterm.package;
description = "The terminal emulator to use.";
};
browser = lib.mkOption {
type = lib.types.package;
default = config.programs.floorp.package;
description = "The browser to use.";
};
launcher = lib.mkOption {
type = lib.types.submodule {
options = {
package = lib.mkOption {
type = lib.types.package;
default =
if config.marleyos.wayland.hyprland.enable
then config.programs.wofi.package
else config.programs.rofi.package;
description = "The launcher to use.";
};
command = lib.mkOption {
type = lib.types.str;
default = "--show drun";
description = ''
The command appended after the launcher binary to run it.
'';
};
};
};
};
};
config = lib.mkIf (is-linux system) {
home.packages = [
cfg.pinentry
cfg.clipboard.package
];
programs.rbw = lib.mkDefault {
settings.pinentry = cfg.pinentry;
};
services.gpg-agent = lib.mkDefault {
pinentryPackage = cfg.pinentry;
};
};
}