modules: move tui, gui, cli to programs

This commit is contained in:
Charlie Root 2024-08-16 13:44:44 +02:00
commit 47a79eea64
106 changed files with 3 additions and 47 deletions

View file

@ -0,0 +1,74 @@
{
config,
lib,
...
}: let
cfg = config.modules.usrEnv.programs.media.beets;
inherit (config.modules.other.system) username;
inherit (config.modules.usrEnv.services.media.mpd) musicDirectory;
inherit (lib) mkIf;
in {
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.beets = {
enable = true;
settings = {
ui.color = true;
directory = musicDirectory;
library = "${musicDirectory}/musiclibrary.db";
clutter = [
"Thumbs.DB"
".DS_Store"
".directory"
];
plugins = [
"mpdupdate"
"lyrics"
"thumbnails"
"fetchart"
"embedart"
"chroma"
"fromfilename"
"lastgenre"
"duplicates"
"edit"
"replaygain"
"scrub"
];
import = {
move = true;
timid = true;
detail = true;
bell = true;
write = true;
};
mpd = {
host = "localhost";
port = 6600;
};
lyrics = {
auto = true;
};
thumbnails.auto = true;
fetchart.auto = true;
embedart = {
auto = true;
remove_art_file = true;
};
acousticbrainz.auto = true;
chroma.auto = true;
replaygain.backend = "gstreamer";
};
};
};
};
}

View file

@ -0,0 +1,9 @@
_: {
imports = [
./fish.nix
./nh.nix
./starship.nix
./beets.nix
./zellij
];
}

View file

@ -0,0 +1,70 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.modules.programs.fish;
inherit (config.modules.other.system) username;
in {
options.modules.programs.fish = {
enable = mkEnableOption "fish";
extraAliases = mkOption {
type = types.attrs;
description = "extra shell aliases";
default = {};
};
};
config = mkIf cfg.enable {
programs.fish.enable = true;
users.users.${username}.shell = pkgs.fish;
environment = {
shells = [pkgs.fish];
pathsToLink = ["/share/fish"];
};
home-manager.users.${username} = {
programs = {
zoxide.enable = true;
zoxide.enableFishIntegration = true;
fish = {
enable = true;
interactiveShellInit = "set fish_greeting";
plugins = [
{
name = "sponge";
inherit (pkgs.fishPlugins.sponge) src;
}
{
name = "done";
inherit (pkgs.fishPlugins.done) src;
}
{
name = "puffer";
inherit (pkgs.fishPlugins.puffer) src;
}
];
shellAbbrs = {
c = "clear";
cc = "cd ~ && clear";
mv = "mv -iv";
rm = "trash -v";
ls = "eza ";
l = "eza -a ";
la = "eza -lha --git";
lg = "lazygit";
cd = "z";
v = "nvim";
h = "hx";
k = "kak";
e = "emacs";
};
};
};
};
};
}

View file

@ -0,0 +1,20 @@
{
lib,
config,
...
}:
with lib; let
cfg = config.modules.programs.nh;
inherit (config.modules.other.system) username;
in {
options.modules.programs.nh.enable = mkEnableOption "nh";
config = mkIf cfg.enable {
programs.nh = {
enable = true;
clean.enable = true;
clean.extraArgs = "--keep-since 4d --keep 3";
flake = "/home/${username}/projects/nichts";
};
};
}

View file

@ -0,0 +1,107 @@
# Credits to raf, his flake is in the README.md
{
config,
lib,
...
}: let
inherit (builtins) map;
inherit (config.modules.other.system) username;
hmCfg = config.home-manager.users.${username};
inherit (lib.strings) concatStrings;
in {
home-manager.users.${username} = let
elemsConcatted = concatStrings (
map (s: "\$${s}") [
"hostname"
"username"
"directory"
"shell"
"nix_shell"
"git_branch"
"git_commit"
"git_state"
"git_status"
"jobs"
"cmd_duration"
]
);
in {
home.sessionVariables = {
STARSHIP_CACHE = "${hmCfg.home.homeDirectory}/.cache/starship";
};
programs.starship = {
enable = true;
enableFishIntegration = true;
enableTransience = true;
settings = {
scan_timeout = 2;
command_timeout = 2000; # nixpkgs makes starship implode with lower values
add_newline = false;
line_break.disabled = false;
format = "${elemsConcatted}\n$character";
hostname = {
ssh_only = true;
disabled = false;
format = "@[$hostname](bold blue) "; # the whitespace at the end is actually important
};
# configure specific elements
character = {
error_symbol = "[](bold red)";
success_symbol = "[](bold green)";
vicmd_symbol = "[](bold yellow)";
format = "$symbol [|](bold bright-black) ";
};
username = {
format = "[$user]($style) in ";
};
directory = {
truncation_length = 2;
# removes the read_only symbol from the format, it doesn't play nicely with my folder icon
format = "[ ](bold green) [$path]($style) ";
# the following removes tildes from the path, and substitutes some folders with shorter names
substitutions = {
"~/Dev" = "Dev";
"~/Documents" = "Docs";
};
};
# git
git_commit.commit_hash_length = 7;
git_branch.style = "bold purple";
git_status = {
style = "red";
ahead = " ";
behind = " ";
conflicted = " ";
renamed = "»";
deleted = " ";
diverged = " ";
modified = "!";
stashed = "";
staged = "+";
untracked = "?";
};
# language configurations
# the whitespaces at the end *are* necessary for proper formatting
lua.symbol = "[ ](blue) ";
python.symbol = "[ ](blue) ";
rust.symbol = "[ ](red) ";
nix_shell.symbol = "[󱄅 ](blue) ";
golang.symbol = "[󰟓 ](blue)";
c.symbol = "[ ](black)";
nodejs.symbol = "[󰎙 ](yellow)";
package.symbol = "📦 ";
};
};
};
}

View file

@ -0,0 +1,46 @@
{
config,
lib,
...
}: let
inherit (config.modules.other.system) username;
cfg = config.modules.system.programs.zellij;
inherit (lib) mkIf;
in {
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.zellij = {
enable = true;
enableFishIntegration = true;
settings = {
on_force_close = "quit";
pane_frames = false;
default_layout = "compact";
ui = {
pane_frames = {
hide_session_name = true;
rounded_corners = true;
};
};
plugins = {
tab-bar.path = "tab-bar";
status-bar.path = "status-bar";
strider.path = "strider";
compact-bar.path = "compact-bar";
};
keybinds = {
unbind = "Ctrl n";
# resize = {
# bind = "Ctrl n";
# };
};
};
};
};
};
}