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,30 +26,33 @@ in {
rose-pine.pointerCursor = mkIf colors.isRosePine enabled;
marleyos.theme = {
colors = {
default = "dark";
marleyos = {
theme = {
colors = {
default = "dark";
dark = {
base = "rose-pine";
flavor = "main";
dark = {
base = "rose-pine";
flavor = "main";
};
light = {
base = "rose-pine";
flavor = "dawn";
};
};
light = {
base = "rose-pine";
flavor = "dawn";
icons = {
package = pkgs.kora-icon-theme;
name = "kora";
};
};
icons = {
package = pkgs.kora-icon-theme;
name = "kora";
apps = {
pinentry =
if isDesktop
then pkgs.pinentry-gtk2
else pkgs.pinentry-curses;
};
pinentry =
if isDesktop
then pkgs.pinentry-gtk2
else pkgs.pinentry-curses;
};
fonts.fontconfig = mkIf (is-linux system) {

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,157 +15,155 @@ in
# ██║ ██║███████╗██║██║ ██║███████║███████╗███████║
# ╚═╝ ╚═╝╚══════╝╚═╝╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝
programs.git.aliases =
let
fish_fns = config.programs.fish.functions;
in
{
### Staging ###
programs.git.aliases = let
fish_fns = config.programs.fish.functions;
in {
### Staging ###
a = "add";
aa = "add --all";
a = "add";
aa = "add --all";
# Interactively stage parts of a file.
apa = "add --patch";
# Interactively stage parts of a file.
apa = "add --patch";
da = "diff";
das = "diff --staged";
daw = "diff --word-diff"; # Show diff by word.
dasw = "diff --staged --word-diff";
da = "diff";
das = "diff --staged";
daw = "diff --word-diff"; # Show diff by word.
dasw = "diff --staged --word-diff";
d = "!f() { git diff \"$@\" ':(exclude)package-lock.json' ':(exclude)*.lock'; }; f";
ds = "!f() { git diff --staged \"$@\" ':(exclude)package-lock.json' ':(exclude)*.lock'; }; f";
dw = "!f() { git diff --word-diff \"$@\" ':(exclude)package-lock.json' ':(exclude)*.lock'; }; f";
dsw = "!f() { git diff --staged --word-diff \"$@\" ':(exclude)package-lock.json' ':(exclude)*.lock'; }; f";
d = "!f() { git diff \"$@\" ':(exclude)package-lock.json' ':(exclude)*.lock'; }; f";
ds = "!f() { git diff --staged \"$@\" ':(exclude)package-lock.json' ':(exclude)*.lock'; }; f";
dw = "!f() { git diff --word-diff \"$@\" ':(exclude)package-lock.json' ':(exclude)*.lock'; }; f";
dsw = "!f() { git diff --staged --word-diff \"$@\" ':(exclude)package-lock.json' ':(exclude)*.lock'; }; f";
st = "status --short --branch";
stu = "status --short --branch --untracked-files";
stl = "status";
st = "status --short --branch";
stu = "status --short --branch --untracked-files";
stl = "status";
### Committing ###
### Committing ###
c = "commit";
ce = "commit --amend";
cen = "commit --amend --no-edit --no-verify";
ca = "!git add --alll && git commit";
cae = "!git add --all && git commit --amend";
caen = "!git add --all && git commit --amend --no-edit --no-verify";
cfu = "commit --fixup";
c = "commit";
ce = "commit --amend";
cen = "commit --amend --no-edit --no-verify";
ca = "!git add --alll && git commit";
cae = "!git add --all && git commit --amend";
caen = "!git add --all && git commit --amend --no-edit --no-verify";
cfu = "commit --fixup";
rev = "revert";
rev = "revert";
### Working Dir & Index Manipulation ###
### Working Dir & Index Manipulation ###
co = "checkout";
co = "checkout";
rt = "reset";
rt = "reset";
rts = "reset --soft"; # undo commits & stage their changes
rts = "reset --soft"; # undo commits & stage their changes
rs = "restore --worktree"; # revert local changes
rst = "restore --staged"; # unstage things
rsa = "restore --worktree --staged";
rs = "restore --worktree"; # revert local changes
rst = "restore --staged"; # unstage things
rsa = "restore --worktree --staged";
rss = "restore --worktree --source"; # specify a commit to revert to
rsts = "restore --staged --source";
rsas = "restore --worktree --staged --source";
rss = "restore --worktree --source"; # specify a commit to revert to
rsts = "restore --staged --source";
rsas = "restore --worktree --staged --source";
rmc = "rm --cached"; # leave worktree copy alone
rmc = "rm --cached"; # leave worktree copy alone
sta = "stash push";
stam = "stash push --message";
staa = "stash push --include-untracted";
staam = "stash push --include-untracted --message";
sta = "stash push";
stam = "stash push --message";
staa = "stash push --include-untracted";
staam = "stash push --include-untracted --message";
stap = "stash pop";
stal = "stash list";
stas = "stash show --text";
stap = "stash pop";
stal = "stash list";
stas = "stash show --text";
cl = "clean -force"; # remove untracked & unignored files
cldr = "clean --dry-run";
cl = "clean -force"; # remove untracked & unignored files
cldr = "clean --dry-run";
### Branches ###
### Branches ###
b = "branch";
cb = "checkout -b";
cm = lib.mkIf (fish_fns ? git_main_branch) "!git checkout $(git_main_branch)";
cd = lib.mkIf (fish_fns ? git_develop_branch) "!git checkout $(git_develop_branch)";
b = "branch";
cb = "checkout -b";
cm = lib.mkIf (fish_fns ? git_main_branch) "!git checkout $(git_main_branch)";
cd = lib.mkIf (fish_fns ? git_develop_branch) "!git checkout $(git_develop_branch)";
m = "merge";
mtl = "mergetool --no-prompt";
ma = "merge --abort";
m = "merge";
mtl = "mergetool --no-prompt";
ma = "merge --abort";
cp = "cherry-pick";
cpa = "cherry-pick --abort";
cpc = "cherry-pick --continue";
cpq = "cherry-pick --quit";
cp = "cherry-pick";
cpa = "cherry-pick --abort";
cpc = "cherry-pick --continue";
cpq = "cherry-pick --quit";
### Remotes ###
### Remotes ###
p = "push";
pv = "push --verbose";
pdr = "push --dry-run";
pf = "push --force-with-lease --force-if-includes";
pfv = "push --verbose --force-with-lease --force-if-includes";
pff = "push --force";
pffv = "push --verbose --force";
p = "push";
pv = "push --verbose";
pdr = "push --dry-run";
pf = "push --force-with-lease --force-if-includes";
pfv = "push --verbose --force-with-lease --force-if-includes";
pff = "push --force";
pffv = "push --verbose --force";
f = "fetch";
fa = "fetch --all --prune";
f = "fetch";
fa = "fetch --all --prune";
pl = "pull";
plr = "pull --rebase";
pl = "pull";
plr = "pull --rebase";
sub = "submodule";
subu = "submodule update --init --recursive";
sub = "submodule";
subu = "submodule update --init --recursive";
r = "remote";
rv = "remote --verbose";
ra = "remote add";
rrm = "remote remove";
rmv = "remote rename";
rset = "remote set-url";
rup = "remote update";
r = "remote";
rv = "remote --verbose";
ra = "remote add";
rrm = "remote remove";
rmv = "remote rename";
rset = "remote set-url";
rup = "remote update";
### Logs ###
### Logs ###
# Current branch.
l = "log --pretty=lc --graph";
lo = "log --pretty=lo --graph --date=human";
ls = "log --pretty=lo --graph --date=human --simplify-by-decoration";
lf = "log --pretty=lf --graph";
ld = "log --pretty=lf --graph --cc --stat";
lp = "log --pretty=lf --graph --cc --patch";
# Current branch.
l = "log --pretty=lc --graph";
lo = "log --pretty=lo --graph --date=human";
ls = "log --pretty=lo --graph --date=human --simplify-by-decoration";
lf = "log --pretty=lf --graph";
ld = "log --pretty=lf --graph --cc --stat";
lp = "log --pretty=lf --graph --cc --patch";
lr = "log -5 --pretty=lc --graph";
lro = "log -5 --pretty=lo --graph --date=human";
lrs = "log -5 --pretty=lo --graph --date=human --simplify-by-decoration";
lrf = "log -5 --pretty=lf --graph";
lrd = "log -5 --pretty=lf --graph --cc --stat";
lrp = "log -5 --pretty=lf --graph --cc --patch";
lr = "log -5 --pretty=lc --graph";
lro = "log -5 --pretty=lo --graph --date=human";
lrs = "log -5 --pretty=lo --graph --date=human --simplify-by-decoration";
lrf = "log -5 --pretty=lf --graph";
lrd = "log -5 --pretty=lf --graph --cc --stat";
lrp = "log -5 --pretty=lf --graph --cc --patch";
# All branches on all remotes.
la = "log --pretty=lc --graph --all";
lao = "log --pretty=lo --graph --all --date=human";
las = "log --pretty=lo --graph --all --date=human --simplify-by-decoration";
laf = "log --pretty=lf --graph --all";
lad = "log --pretty=lf --graph --all --cc --stat";
lap = "log --pretty=lf --graph --all --cc --patch";
# All branches on all remotes.
la = "log --pretty=lc --graph --all";
lao = "log --pretty=lo --graph --all --date=human";
las = "log --pretty=lo --graph --all --date=human --simplify-by-decoration";
laf = "log --pretty=lf --graph --all";
lad = "log --pretty=lf --graph --all --cc --stat";
lap = "log --pretty=lf --graph --all --cc --patch";
lar = "log -5 --pretty=lc --graph --all";
laro = "log -5 --pretty=lo --graph --all --date=human";
lars = "log -5 --pretty=lo --graph --all --date=human --simplify-by-decoration";
larf = "log -5 --pretty=lf --graph --all";
lard = "log -5 --pretty=lf --graph --all --cc --stat";
larp = "log -5 --pretty=lf --graph --all --cc --patch";
lar = "log -5 --pretty=lc --graph --all";
laro = "log -5 --pretty=lo --graph --all --date=human";
lars = "log -5 --pretty=lo --graph --all --date=human --simplify-by-decoration";
larf = "log -5 --pretty=lf --graph --all";
lard = "log -5 --pretty=lf --graph --all --cc --stat";
larp = "log -5 --pretty=lf --graph --all --cc --patch";
### Shortcuts ###
### Shortcuts ###
nevermind = "!git reset --hard head && git clean -df";
nevermind = "!git reset --hard head && git clean -df";
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 {
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;