Compare commits

...

9 commits

Author SHA1 Message Date
2fe36645b8
feat(home): Cava 2024-11-16 12:34:21 -08:00
fe5e979903
feat(home): Btop 2024-11-16 12:23:16 -08:00
d44822d587
feat(home): Bat 2024-11-16 12:21:24 -08:00
ce01e0ea57
fix(home): Don't include position = "anywhere" abbrs 2024-11-16 12:20:21 -08:00
e763212b39
feat(home): Set isDesktop 2024-11-16 12:09:40 -08:00
c8fc33fcba
feat(home): Amfora 2024-11-16 12:09:29 -08:00
6a2b253f83
fix(home): Fix module enable option def
Modules were being placed at <group>.<namespace>.<module> instead of
<namespace>.<group>.<module>
2024-11-16 11:39:47 -08:00
1c6d295db6
fix(home): Enable journalctl & systemctl 2024-11-16 11:34:05 -08:00
6f456ceef8
feat(home): Fish shell & neo 2024-11-16 11:27:44 -08:00
19 changed files with 422 additions and 305 deletions

View file

@ -6,11 +6,23 @@ in
home.keyboard.options = [ "apple:alupckeys" ];
${namespace} = {
isDesktop = true;
appearance = {
base = enabled;
gtk = enabled;
qt = enabled;
};
programs = {
amfora = enabled;
bat = enabled;
btop = enabled;
cava = enabled;
fish = enabled;
journalctl = enabled;
neo = enabled;
systemctl = enabled;
};
xorg = {
xsession = enabled;
};

View file

@ -13,7 +13,7 @@ let
inherit (config.${namespace}) theme;
in
{
options.appearance = mkEnableModule "base";
options = mkEnableModule "appearance.base";
config = mkIf cfg.enable {
home.packages = with pkgs; [

View file

@ -12,7 +12,7 @@ let
inherit (config.${namespace}) theme;
in
{
options.appearance = mkEnableModule "gtk";
options = mkEnableModule "appearance.gtk";
config = mkIf cfg.enable {
gtk = {

View file

@ -13,7 +13,7 @@ let
inherit (config.${namespace}) theme;
in
{
options.appearance = mkEnableModule "qt";
options = mkEnableModule "appearance.qt";
config = mkIf cfg.enable {
xdg.configFile = mkIf (theme.colors.base == "rose-pine") {

View file

@ -55,7 +55,13 @@ let
};
removeFishOnly = attrsets.filterAttrs (
_: v: if (builtins.isAttrs v) then !((v ? regex) || (v ? setCursor) || (v ? function)) else true
_: v:
if (builtins.isAttrs v) then
!(
(v ? regex) || (v ? setCursor) || (v ? function) || ((v ? position) && (v.position == "anywhere"))
)
else
true
);
abbrToAlias = attrsets.mapAttrs (

View file

@ -0,0 +1,92 @@
{
lib,
config,
namespace,
pkgs,
inputs,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkEnableModule;
cfg = config.${namespace}.programs.amfora;
inherit (config.${namespace}) theme;
themeFiles = {
rose-pine = "${inputs.rose-pine-amfora}/themes/rose-pine.toml";
};
themeFile = themeFiles.${theme.colors.base};
in
{
options = mkEnableModule "programs.amfora";
config = mkIf cfg.enable {
home.packages = with pkgs; [
amfora
];
xdg.configFile."amfora/theme.toml".source = "${themeFile}";
# https://github.com/makeworld-the-better-one/amfora/blob/master/default-config.toml
# Amfora requires a number of options to run - omitting everything I didn't
# care to customize resulted in go panic errors.
xdg.configFile."amfora/config.toml".text = # toml
''
include = "./theme.toml"
[a-general]
# Defaults {{{
home = "gemini://geminiprotocol.net"
auto_redirect = false
http = 'default'
search = "gemini://geminispace.info/search"
color = true
ansi = true
highlight_code = true
bullets = true
show_link = false
max_width = 80
downloads = '''
page_max_size = 2097152 # 2 MiB
page_max_time = 10
scrollbar = "auto"
underline = true
# }}}
highlight_style = "${theme.colors.base}"
# Defaults {{{
[auth]
[auth.certs]
[auth.keys]
[keybindings]
[url-handlers]
other = 'default'
[url-prompts]
[cache]
max_size = 0
max_pages = 30
timeout = 1800
[proxies]
[subscriptions]
popup = true
update_interval = 1800
workers = 3
entries_per_page = 20
header = true
[theme]
# }}}
'';
};
}

View file

@ -0,0 +1,81 @@
{
lib,
config,
namespace,
pkgs,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkEnableModule enabled;
cfg = config.${namespace}.programs.bat;
inherit (config.${namespace}) theme;
in
{
options = mkEnableModule "programs.bat";
config = mkIf cfg.enable {
programs.bat = {
enable = true;
extraPackages = with pkgs.bat-extras; [
batdiff
batman
];
"${theme.colors.base}" = enabled;
config = {
style = "auto";
};
};
home.sessionVariables = lib.mkIf config.programs.git.delta.enable {
BATDIFF_USE_DELTA = "true";
};
programs.fish = lib.mkIf config.programs.fish.enable {
functions = {
cat = {
wraps = "bat";
body = # fish
"bat $argv";
};
cath = {
wraps = "bat";
body = # fish
"bat --plain --language=help $argv";
};
};
};
home.shellAbbrs = {
B = {
position = "anywhere";
setCursor = true;
expansion = # fish
"% | bat";
};
"-h" = {
position = "anywhere";
expansion = # fish
"-h | cath";
};
"--help" = {
position = "anywhere";
expansion = # fish
"--help | cath";
};
help = {
position = "anywhere";
expansion = # fish
"help | cath";
};
};
};
}

View file

@ -0,0 +1,30 @@
{
lib,
config,
namespace,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkEnableModule enabled;
cfg = config.${namespace}.programs.btop;
inherit (config.${namespace}) theme;
in
{
options = mkEnableModule "programs.btop";
config = mkIf cfg.enable {
programs.btop = {
enable = true;
"${theme.colors.base}" = enabled;
settings = {
theme_background = false;
truecolor = true;
vim_keys = true;
};
};
};
}

View file

@ -0,0 +1,31 @@
{
lib,
config,
namespace,
...
}:
let
inherit (lib) mkIf enabled;
inherit (lib.${namespace}) mkEnableModule;
cfg = config.${namespace}.programs.cava;
inherit (config.${namespace}) theme;
in
{
options = mkEnableModule "programs.cava";
config = mkIf cfg.enable {
enable = true;
"${theme.colors.base}" = enabled;
# TODO: disable this when mpd is not enabled? Can that be detected on non
# NixOS systems?
settings = {
input = {
method = "fifo";
source = "/tmp/mpd.fifo";
};
};
};
}

View file

@ -0,0 +1,131 @@
{
lib,
config,
namespace,
pkgs,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkEnableModule enabled;
cfg = config.${namespace}.programs.fish;
inherit (config.${namespace}) theme;
in
{
options = mkEnableModule "programs.fish";
config = mkIf cfg.enable {
home.packages = with pkgs; [
# general
babelfish
# for extract()
gnutar
bzip2
bzip3
gzip
unzip
pax
unrar-free
];
programs.fish = {
enable = true;
${theme.colors.name} = enabled;
preferAbbrs = true;
plugins = with pkgs.fishPlugins; [
{
name = "z";
src = z;
}
{
name = "Puffer Fish";
src = puffer;
}
{
name = "Sponge";
src = sponge;
}
{
name = "autopair.fish";
src = autopair;
}
];
shellInit = # fish
''
set -g fish_key_bindings fish_vi_key_bindings
'';
shellAbbrs = {
cp = "cp -iv";
mkdir = "mkdir -pv";
mv = "mv -iv";
rm = "rm -r";
grep = "grep --color=auto";
};
functions = {
extract = {
argumentNames = "file";
body = # fish
''
set --erase argv[1]
if test -f "$file"
switch "$file"
case "*.tar.bz2"
tar -jxvf $argv $file
case "*.tar.gz"
tar -zxvf $argv $file
case "*.bz2"
bunzip2 $argv $file
case "*.bz3"
bunzip3 $argv $file
case "*.gz"
gunzip $argv $file
case "*.tar"
tar -xvf $argv $file
case "*.tbz2"
tar -jxvf $argv $file
case "*.tgz"
tar -zxvf $argv $file
case "*.zip" "*.ZIP"
unzip $argv $file
case "*pax"
cat $file | pax -r $argv
case "*.pax.Z"
uncompress $file --stdout | pax -r $argv
case "*.rar"
unrar-free $file
case "*.Z"
uncompress $argv $file
case "*"
echo "'$file' cannot be extracted via extract()."
end
else
echo "'$file' is not a valid file."
end
'';
};
};
};
};
}

View file

@ -11,7 +11,7 @@ let
cfg = config.${namespace}.programs.journalctl;
in
{
options.programs = mkEnableModule "journalctl";
options = mkEnableModule "programs.journalctl";
config = mkIf cfg.enable {
home.shellAbbrs = {

View file

@ -0,0 +1,32 @@
{
lib,
config,
namespace,
pkgs,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkEnableModule;
cfg = config.${namespace}.programs.neo;
in
{
options = mkEnableModule "programs.neo";
config = mkIf cfg.enable {
home.packages = with pkgs; [
neo
];
programs.fish.functions = mkIf config.programs.fish.enable {
neo = {
wraps = "neo";
body = # fish
''
command neo --charset=ascii $argv
'';
};
};
};
}

View file

@ -11,7 +11,7 @@ let
cfg = config.${namespace}.programs.systemctl;
in
{
options.programs = mkEnableModule "systemctl";
options = mkEnableModule "programs.systemctl";
config = mkIf cfg.enable {
home.shellAbbrs = {

View file

@ -11,7 +11,7 @@ let
cfg = config.${namespace}.xorg.xsession;
in
{
options.xorg = mkEnableModule "xsession";
options = mkEnableModule "xorg.xsession";
config = mkIf cfg.enable {
xsession = {

View file

@ -1,73 +0,0 @@
{ pkgs, flake, ... }:
{
home.packages = with pkgs; [
amfora
];
# TODO: Change this based on current theme.
# Possibly set this in rose-pine-nix as well?
# There is no programs.amfora so it would require adding attl opts to base
# rose-pine.
xdg.configFile."amfora/theme.toml".source = "${flake.inputs.rose-pine-amfora}/themes/rose-pine.toml";
# https://github.com/makeworld-the-better-one/amfora/blob/master/default-config.toml
# Amfora requires a number of options to run - omitting everything didn't care
# to customize resulted in go panic errors.
xdg.configFile."amfora/config.toml".text = # toml
''
include = "./theme.toml"
[a-general]
# Defaults {{{
home = "gemini://geminiprotocol.net"
auto_redirect = false
http = 'default'
search = "gemini://geminispace.info/search"
color = true
ansi = true
highlight_code = true
bullets = true
show_link = false
max_width = 80
downloads = '''
page_max_size = 2097152 # 2 MiB
page_max_time = 10
scrollbar = "auto"
underline = true
# }}}
# TODO: Change based on current theme.
highlight_style = "rose-pine"
# Defaults {{{
[auth]
[auth.certs]
[auth.keys]
[keybindings]
[url-handlers]
other = 'default'
[url-prompts]
[cache]
max_size = 0
max_pages = 30
timeout = 1800
[proxies]
[subscriptions]
popup = true
update_interval = 1800
workers = 3
entries_per_page = 20
header = true
[theme]
# }}}
'';
}

View file

@ -1,69 +0,0 @@
{
pkgs,
config,
lib,
...
}:
{
programs.bat = {
enable = true;
extraPackages = with pkgs.bat-extras; [
batdiff
batman
];
rose-pine.enable = true;
config = {
style = "auto";
};
};
home.sessionVariables = lib.mkIf config.home.preferXdgDirectories {
BATDIFF_USE_DELTA = "true";
};
programs.fish = lib.mkIf config.programs.fish.enable {
functions = {
cat = {
wraps = "bat";
body = # fish
"bat $argv";
};
cath = {
wraps = "bat";
body = # fish
"bat --plain --language=help $argv";
};
};
shellAbbrs = {
B = {
position = "anywhere";
setCursor = true;
expansion = # fish
"% | bat";
};
"-h" = {
position = "anywhere";
expansion = # fish
"-h | cath";
};
"--help" = {
position = "anywhere";
expansion = # fish
"--help | cath";
};
help = {
position = "anywhere";
expansion = # fish
"help | cath";
};
};
};
}

View file

@ -1,14 +0,0 @@
{ ... }:
{
programs.btop = {
enable = true;
rose-pine.enable = true;
settings = {
theme_background = false;
truecolor = true;
vim_keys = true;
};
};
}

View file

@ -1,17 +0,0 @@
{ ... }:
{
programs.cava = {
enable = true;
rose-pine.enable = true;
# TODO: disable this when mpd is not enabled? Can that be detected on non
# NixOS systems?
settings = {
input = {
method = "fifo";
source = "/tmp/mpd.fifo";
};
};
};
}

View file

@ -1,125 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
# general
babelfish
# for extract()
gnutar
bzip2
bzip3
gzip
unzip
pax
unrar-free
# shell goodies
neo
];
programs.fish = {
enable = true;
rose-pine.enable = true;
preferAbbrs = true;
plugins = with pkgs.fishPlugins; [
{
name = "z";
src = z;
}
{
name = "Puffer Fish";
src = puffer;
}
{
name = "Sponge";
src = sponge;
}
{
name = "autopair.fish";
src = autopair;
}
];
shellInit = # fish
''
set -g fish_key_bindings fish_vi_key_bindings
'';
shellAbbrs = {
cp = "cp -iv";
mkdir = "mkdir -pv";
mv = "mv -iv";
rm = "rm -r";
grep = "grep --color=auto";
};
functions = {
extract = {
argumentNames = "file";
body = # fish
''
set --erase argv[1]
if test -f "$file"
switch "$file"
case "*.tar.bz2"
tar -jxvf $argv $file
case "*.tar.gz"
tar -zxvf $argv $file
case "*.bz2"
bunzip2 $argv $file
case "*.bz3"
bunzip3 $argv $file
case "*.gz"
gunzip $argv $file
case "*.tar"
tar -xvf $argv $file
case "*.tbz2"
tar -jxvf $argv $file
case "*.tgz"
tar -zxvf $argv $file
case "*.zip" "*.ZIP"
unzip $argv $file
case "*pax"
cat $file | pax -r $argv
case "*.pax.Z"
uncompress $file --stdout | pax -r $argv
case "*.rar"
unrar-free $file
case "*.Z"
uncompress $argv $file
case "*"
echo "'$file' cannot be extracted via extract()."
end
else
echo "'$file' is not a valid file."
end
'';
};
neo = {
wraps = "neo";
body = # fish
''
command neo --charset=ascii $argv
'';
};
};
};
}