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; rose-pine.pointerCursor = mkIf colors.isRosePine enabled;
marleyos.theme = { marleyos = {
theme = {
colors = { colors = {
default = "dark"; default = "dark";
@ -45,12 +46,14 @@ in {
package = pkgs.kora-icon-theme; package = pkgs.kora-icon-theme;
name = "kora"; name = "kora";
}; };
};
apps = {
pinentry = pinentry =
if isDesktop if isDesktop
then pkgs.pinentry-gtk2 then pkgs.pinentry-gtk2
else pkgs.pinentry-curses; else pkgs.pinentry-curses;
}; };
};
fonts.fontconfig = mkIf (is-linux system) { fonts.fontconfig = mkIf (is-linux system) {
enable = true; 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, lib,
config, config,
pkgs,
system, system,
... ...
}: let }: let
inherit
(lib)
types
mkOption
literalMD
mkMerge
mkIf
mkDefault
;
inherit (lib.snowfall.system) is-linux; inherit (lib.snowfall.system) is-linux;
cfg = config.marleyos.theme; cfg = config.marleyos.theme;
@ -22,12 +12,12 @@
"rose-pine" "rose-pine"
]; ];
colorThemeType = types.submodule { colorThemeType = lib.types.submodule {
options = { options = {
base = mkOption { base = lib.mkOption {
type = colorThemes; type = colorThemes;
example = "rose-pine"; example = "rose-pine";
description = literalMD '' description = lib.literalMD ''
The color theme to use. This should match the base of the enable 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 options provided by the input's module. For instance, the rose-pine
home-manager module provides the {option}`rose-pine.enable` base home-manager module provides the {option}`rose-pine.enable` base
@ -35,15 +25,15 @@
''; '';
}; };
flavor = mkOption { flavor = lib.mkOption {
type = with types; nullOr str; type = with lib.types; nullOr str;
default = null; default = null;
example = "moon"; example = "moon";
description = "The theme flavor to use, if applicable."; description = "The theme flavor to use, if applicable.";
}; };
accent = mkOption { accent = lib.mkOption {
type = with types; nullOr str; type = with lib.types; nullOr str;
default = null; default = null;
example = "rose"; example = "rose";
description = "The theme accent to use, if applicable."; description = "The theme accent to use, if applicable.";
@ -51,8 +41,8 @@
}; };
}; };
mkColorThemeOpt = mode: flavor: (mkOption { mkColorThemeOpt = mode: flavor: (lib.mkOption {
type = with types; either str colorThemeType; type = with lib.types; either str colorThemeType;
default = { default = {
base = "rose-pine"; base = "rose-pine";
inherit flavor; inherit flavor;
@ -61,10 +51,10 @@
}); });
# https://github.com/nix-community/home-manager/blob/master/modules/misc/gtk.nix # https://github.com/nix-community/home-manager/blob/master/modules/misc/gtk.nix
iconThemeType = types.submodule { iconThemeType = lib.types.submodule {
options = { options = {
package = mkOption { package = lib.mkOption {
type = with types; nullOr package; type = with lib.types; nullOr package;
default = null; default = null;
example = "pkgs.gnome.adwaita-icon-theme"; example = "pkgs.gnome.adwaita-icon-theme";
description = '' description = ''
@ -74,8 +64,8 @@
''; '';
}; };
name = mkOption { name = lib.mkOption {
type = with types; str; type = with lib.types; str;
example = "Adwaita"; example = "Adwaita";
description = "The name of the icon theme within the package."; description = "The name of the icon theme within the package.";
}; };
@ -84,8 +74,8 @@
in { in {
options.marleyos.theme = { options.marleyos.theme = {
colors = { colors = {
default = mkOption { default = lib.mkOption {
type = with types; str; type = with lib.types; str;
default = "dark"; default = "dark";
description = "Whether to prefer the light or dark theme."; description = "Whether to prefer the light or dark theme.";
}; };
@ -93,44 +83,29 @@ in {
light = mkColorThemeOpt "light" "dawn"; light = mkColorThemeOpt "light" "dawn";
dark = mkColorThemeOpt "dark" "main"; dark = mkColorThemeOpt "dark" "main";
base = mkOption { base = lib.mkOption {
type = colorThemes; type = colorThemes;
}; };
flavor = mkOption { flavor = lib.mkOption {
type = with types; nullOr str; type = with lib.types; nullOr str;
}; };
accent = mkOption { accent = lib.mkOption {
type = with types; nullOr str; type = with lib.types; nullOr str;
}; };
isRosePine = mkOption { isRosePine = lib.mkOption {
type = with types; bool; type = with lib.types; bool;
}; };
}; };
icons = mkOption { icons = lib.mkOption {
type = with types; nullOr iconThemeType; type = with lib.types; nullOr iconThemeType;
default = null; default = null;
description = "The icon theme to use."; description = "The icon theme to use.";
}; };
pinentry = mkOption {
type = with types; package;
default = pkgs.pinentry-gtk2;
description = "The pinentry package to use.";
}; };
clipboard = mkOption { config = lib.mkMerge [
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 [
# colors # colors
{ {
marleyos.theme.colors = rec { marleyos.theme.colors = rec {
@ -144,36 +119,20 @@ in {
} }
# icons # icons
(mkIf ((cfg.icons != null) && (is-linux system)) { (lib.mkIf ((cfg.icons != null) && (is-linux system)) {
gtk = mkDefault { gtk = lib.mkDefault {
iconTheme = { iconTheme = {
inherit (cfg.icons) name; 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 = { iconTheme = {
inherit (cfg.icons) name; 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, lib,
config, config,
... ...
}: }: let
let
inherit (lib) mkIf; inherit (lib) mkIf;
cfg = config.marleyos.programs.git; cfg = config.marleyos.programs.git;
in in {
{
config = mkIf cfg.enable { config = mkIf cfg.enable {
# █████╗ ██╗ ██╗ █████╗ ███████╗███████╗███████╗ # █████╗ ██╗ ██╗ █████╗ ███████╗███████╗███████╗
# ██╔══██╗██║ ██║██╔══██╗██╔════╝██╔════╝██╔════╝ # ██╔══██╗██║ ██║██╔══██╗██╔════╝██╔════╝██╔════╝
# ███████║██║ ██║███████║███████╗█████╗ ███████╗ # ███████║██║ ██║███████║███████╗█████╗ ███████╗
@ -18,11 +15,9 @@ in
# ██║ ██║███████╗██║██║ ██║███████║███████╗███████║ # ██║ ██║███████╗██║██║ ██║███████║███████╗███████║
# ╚═╝ ╚═╝╚══════╝╚═╝╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝ # ╚═╝ ╚═╝╚══════╝╚═╝╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝
programs.git.aliases = programs.git.aliases = let
let
fish_fns = config.programs.fish.functions; fish_fns = config.programs.fish.functions;
in in {
{
### Staging ### ### Staging ###
a = "add"; a = "add";
@ -168,7 +163,7 @@ in
open = lib.mkIf (config.programs.fish.enable && (fish_fns ? git_open)) "!fish -c git_open"; 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 { config = mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
gum gum
config.marleyos.theme.clipboard config.marleyos.apps.clipboard
]; ];
# ██████╗ ██╗████████╗ # ██████╗ ██╗████████╗

View file

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

View file

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

View file

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

View file

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