feat(home): Add default apps module

This commit is contained in:
punkfairie 2025-01-12 09:44:58 -08:00
parent 79e69ee899
commit ff2e9b74d2
No known key found for this signature in database
GPG key ID: B3C5488E9A1A7CA6
9 changed files with 236 additions and 243 deletions

View file

@ -26,7 +26,8 @@ in {
rose-pine.pointerCursor = mkIf colors.isRosePine enabled;
marleyos.theme = {
marleyos = {
theme = {
colors = {
default = "dark";
@ -45,12 +46,14 @@ in {
package = pkgs.kora-icon-theme;
name = "kora";
};
};
apps = {
pinentry =
if isDesktop
then pkgs.pinentry-gtk2
else pkgs.pinentry-curses;
};
};
fonts.fontconfig = mkIf (is-linux system) {
enable = true;

View file

@ -0,0 +1,55 @@
{
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 = lib.mkOption {
type = lib.types.package;
default =
if config.marleyos.wayland.hyprland.enable
then pkgs.wl-clipboard
else pkgs.clipboard-jh;
description = "The clipboard manager to use.";
};
terminal = lib.mkOption {
type = lib.types.package;
default = pkgs.wezterm;
description = "Ther terminal emulator to use.";
};
browser = lib.mkOption {
type = lib.types.package;
default = pkgs.floorp;
description = "The browser to use.";
};
};
config = lib.mkIf (is-linux system) {
home.packages = [
cfg.pinentry
cfg.clipboard
];
programs.rbw = lib.mkDefault {
settings.pinentry = cfg.pinentry;
};
services.gpg-agent = lib.mkDefault {
pinentryPackage = cfg.pinentry;
};
};
}

View file

@ -1,19 +1,9 @@
{
lib,
config,
pkgs,
system,
...
}: let
inherit
(lib)
types
mkOption
literalMD
mkMerge
mkIf
mkDefault
;
inherit (lib.snowfall.system) is-linux;
cfg = config.marleyos.theme;
@ -22,12 +12,12 @@
"rose-pine"
];
colorThemeType = types.submodule {
colorThemeType = lib.types.submodule {
options = {
base = mkOption {
base = lib.mkOption {
type = colorThemes;
example = "rose-pine";
description = literalMD ''
description = lib.literalMD ''
The color theme to use. This should match the base of the enable
options provided by the input's module. For instance, the rose-pine
home-manager module provides the {option}`rose-pine.enable` base
@ -35,15 +25,15 @@
'';
};
flavor = mkOption {
type = with types; nullOr str;
flavor = lib.mkOption {
type = with lib.types; nullOr str;
default = null;
example = "moon";
description = "The theme flavor to use, if applicable.";
};
accent = mkOption {
type = with types; nullOr str;
accent = lib.mkOption {
type = with lib.types; nullOr str;
default = null;
example = "rose";
description = "The theme accent to use, if applicable.";
@ -51,8 +41,8 @@
};
};
mkColorThemeOpt = mode: flavor: (mkOption {
type = with types; either str colorThemeType;
mkColorThemeOpt = mode: flavor: (lib.mkOption {
type = with lib.types; either str colorThemeType;
default = {
base = "rose-pine";
inherit flavor;
@ -61,10 +51,10 @@
});
# https://github.com/nix-community/home-manager/blob/master/modules/misc/gtk.nix
iconThemeType = types.submodule {
iconThemeType = lib.types.submodule {
options = {
package = mkOption {
type = with types; nullOr package;
package = lib.mkOption {
type = with lib.types; nullOr package;
default = null;
example = "pkgs.gnome.adwaita-icon-theme";
description = ''
@ -74,8 +64,8 @@
'';
};
name = mkOption {
type = with types; str;
name = lib.mkOption {
type = with lib.types; str;
example = "Adwaita";
description = "The name of the icon theme within the package.";
};
@ -84,8 +74,8 @@
in {
options.marleyos.theme = {
colors = {
default = mkOption {
type = with types; str;
default = lib.mkOption {
type = with lib.types; str;
default = "dark";
description = "Whether to prefer the light or dark theme.";
};
@ -93,44 +83,29 @@ in {
light = mkColorThemeOpt "light" "dawn";
dark = mkColorThemeOpt "dark" "main";
base = mkOption {
base = lib.mkOption {
type = colorThemes;
};
flavor = mkOption {
type = with types; nullOr str;
flavor = lib.mkOption {
type = with lib.types; nullOr str;
};
accent = mkOption {
type = with types; nullOr str;
accent = lib.mkOption {
type = with lib.types; nullOr str;
};
isRosePine = mkOption {
type = with types; bool;
isRosePine = lib.mkOption {
type = with lib.types; bool;
};
};
icons = mkOption {
type = with types; nullOr iconThemeType;
icons = lib.mkOption {
type = with lib.types; nullOr iconThemeType;
default = null;
description = "The icon theme to use.";
};
pinentry = mkOption {
type = with types; package;
default = pkgs.pinentry-gtk2;
description = "The pinentry package to use.";
};
clipboard = mkOption {
type = with types; package;
default =
if config.marleyos.wayland.hyprland.enable
then pkgs.wl-clipboard
else pkgs.clipboard-jh;
description = "The clipboard manager to use.";
};
};
config = mkMerge [
config = lib.mkMerge [
# colors
{
marleyos.theme.colors = rec {
@ -144,36 +119,20 @@ in {
}
# icons
(mkIf ((cfg.icons != null) && (is-linux system)) {
gtk = mkDefault {
(lib.mkIf ((cfg.icons != null) && (is-linux system)) {
gtk = lib.mkDefault {
iconTheme = {
inherit (cfg.icons) name;
package = mkIf (cfg.icons.package != null) cfg.icons.package;
package = lib.mkIf (cfg.icons.package != null) cfg.icons.package;
};
};
services.dunst = mkDefault {
services.dunst = lib.mkDefault {
iconTheme = {
inherit (cfg.icons) name;
package = mkIf (cfg.icons.package != null) cfg.icons.package;
package = lib.mkIf (cfg.icons.package != null) cfg.icons.package;
};
};
})
# pinentry
(mkIf (is-linux system) {
home.packages = [
cfg.pinentry
cfg.clipboard
];
programs.rbw = mkDefault {
settings.pinentry = cfg.pinentry;
};
services.gpg-agent = mkDefault {
pinentryPackage = cfg.pinentry;
};
})
];
}

View file

@ -2,15 +2,12 @@
lib,
config,
...
}:
let
}: let
inherit (lib) mkIf;
cfg = config.marleyos.programs.git;
in
{
in {
config = mkIf cfg.enable {
# █████╗ ██╗ ██╗ █████╗ ███████╗███████╗███████╗
# ██╔══██╗██║ ██║██╔══██╗██╔════╝██╔════╝██╔════╝
# ███████║██║ ██║███████║███████╗█████╗ ███████╗
@ -18,11 +15,9 @@ in
# ██║ ██║███████╗██║██║ ██║███████║███████╗███████║
# ╚═╝ ╚═╝╚══════╝╚═╝╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝
programs.git.aliases =
let
programs.git.aliases = let
fish_fns = config.programs.fish.functions;
in
{
in {
### Staging ###
a = "add";
@ -168,7 +163,7 @@ in
open = lib.mkIf (config.programs.fish.enable && (fish_fns ? git_open)) "!fish -c git_open";
chash = "!git log --oneline | gum filter --height 10 | cut -d' ' -f1 | cb &>/dev/null";
chash = "!git log --oneline | gum filter --height 10 | cut -d' ' -f1 | ${config.marleyos.apps.clipboard} &>/dev/null";
};
};
}

View file

@ -17,7 +17,7 @@ in {
config = mkIf cfg.enable {
home.packages = with pkgs; [
gum
config.marleyos.theme.clipboard
config.marleyos.apps.clipboard
];
# ██████╗ ██╗████████╗

View file

@ -66,7 +66,7 @@ in {
blur-kern = "3x3box";
blur-background-exclude = [
"window_type = 'desktop'",
"name = 'firefox'",
"name = '${lib.getName config.marleyos.apps.browser}'",
"class_g = 'slop'"
];

View file

@ -98,11 +98,9 @@ in {
in {
monitor = lib.attrValues cfg.monitors;
# TODO: Set this in a default apps module.
"$terminal" = lib.getExe pkgs.wezterm;
"$terminal" = lib.getExe config.marleyos.apps.terminal;
"$launcher" = "${lib.getExe pkgs.wofi} --show drun";
# TODO: Set this in a default apps module.
"$browser" = "${lib.getExe pkgs.floorp}";
"$browser" = lib.getExe config.marleyos.apps.browser;
exec-once = let
browserWs =

View file

@ -4,24 +4,14 @@
pkgs,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
concatMapAttrs
map
range
listToAttrs
getExe
;
inherit (lib.marleyos) enabled disabled;
cfg = config.marleyos.xorg.i3;
isGenericLinux = config.targets.genericLinux.enable;
in {
options.marleyos.xorg.i3.enable = mkEnableOption "i3";
options.marleyos.xorg.i3.enable = lib.mkEnableOption "i3";
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
marleyos = {
programs.rofi = enabled;
services = {
@ -43,7 +33,7 @@ in {
xsession.windowManager.i3 = {
enable = true;
package = mkIf config.marleyos.nixGL.enable (config.lib.nixGL.wrap pkgs.i3);
package = lib.mkIf config.marleyos.nixGL.enable (config.lib.nixGL.wrap pkgs.i3);
extraConfig = "tiling_drag modifier titlebar";
@ -83,13 +73,12 @@ in {
keybindings = let
mod = config.xsession.windowManager.i3.config.modifier;
workspaces = range 1 10;
workspaces = lib.range 1 10;
getI = i:
if i == 10
then "0"
else toString i;
inherit (config.xdg) configHome;
isGenericLinux = config.targets.genericLinux.enable;
in
{
"${mod}+Shift+c" = "reload";
@ -109,15 +98,11 @@ in {
"${mod}+q" = "kill";
"${mod}+r" = "exec ${configHome}/rofi/launchers/type-1/launcher.sh";
"${mod}+Return" = "exec ${
if isGenericLinux
then "wezterm"
else "${pkgs.wezterm}/bin/wezterm"
}";
"${mod}+Return" = "exec ${lib.getExe config.marleyos.apps.terminal}";
}
# PulseAudio Volume - - - - - - - - - - - - - - - - - - - - - - - -
// (
concatMapAttrs
lib.concatMapAttrs
(key: cmd: {
"${key}" = "exec --no-startup-id pactl ${cmd} && killall -SIGUSR1 i3status";
})
@ -129,13 +114,13 @@ in {
}
)
# Focus & Movement - - - - - - - - - - - - - - - - - - - - - - - - -
// (concatMapAttrs (direction: key: {
// (lib.concatMapAttrs (direction: key: {
"${mod}+${key}" = "focus ${direction}";
"${mod}+Shift+${key}" = "move ${direction}";
})
directions)
# Switch Workspaces - - - - - - - - - - - - - - - - - - - - - - - - -
// (listToAttrs (
// (lib.listToAttrs (
(map (i: {
name = "${mod}+${getI i}";
value = "workspace number ${toString i}";
@ -143,7 +128,7 @@ in {
workspaces
))
# Move Windows Between Workspaces - - - - - - - - - - - - - - - - - -
// (listToAttrs (
// (lib.listToAttrs (
(map (i: {
name = "${mod}+Shift+${getI i}";
value = "move container to workspace number ${toString i}";
@ -161,7 +146,7 @@ in {
"${mod}+Control+r" = "mode default";
}
// (
concatMapAttrs
lib.concatMapAttrs
(key: action: {
"${key}" = "resize ${action} 10 px or 10 ppt";
})

View file

@ -8,8 +8,6 @@ in {
networking.hostName = "nyx";
programs.firefox.enable = true;
marleyos = {
hasNvidia = true;