refactor: massively overhaul home manager module system

This commit is contained in:
Youwen Wu 2024-12-25 19:47:59 -08:00
parent b2270408fc
commit a506d2aed4
Signed by: youwen
GPG key ID: 865658ED1FE61EC3
64 changed files with 5201 additions and 64 deletions

View file

@ -0,0 +1,212 @@
{
config,
lib,
inputs,
pkgs,
osConfig,
...
}:
let
cfg = config.liminalOS;
in
{
imports = [
inputs.nix-index-database.hmModules.nix-index
./fastfetch
];
options.liminalOS.shellEnv = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to set up a CLI development environment.
'';
};
};
config = lib.mkIf cfg.shellEnv.enable {
programs.bash.enable = true;
programs.nushell = {
enable = true;
configFile.text = ''
$env.config = {
edit_mode: vi,
show_banner: false
}
'';
};
programs.fzf = {
enable = true;
};
programs.git = {
enable = true;
userName = lib.mkDefault "liminalOS user";
userEmail = lib.mkDefault "liminalOS@localhost";
delta.enable = true;
maintenance.enable = true;
extraConfig = {
init.defaultBranch = "main";
safe.directory = [
osConfig.liminalOS.flakeLocation
];
};
};
home.packages = [ pkgs.git-absorb ];
programs.lazygit = {
enable = true;
settings = {
git.paging = {
colorArg = "always";
pager = "delta --dark --paging=never";
};
};
};
programs.bat.enable = true;
programs.ripgrep.enable = true;
programs.readline = {
enable = true;
extraConfig = "set editing-mode vi";
};
programs.zoxide = {
enable = true;
enableFishIntegration = true;
enableNushellIntegration = true;
enableBashIntegration = true;
};
programs.gh = {
enable = true;
};
programs.starship = {
enable = true;
enableFishIntegration = true;
enableBashIntegration = true;
enableNushellIntegration = true;
};
home.file.".config/starship.toml".text = builtins.readFile ./jetpack.toml;
programs.direnv = {
enable = true;
nix-direnv.enable = true;
config.global.hide_env_diff = true;
};
programs.fish = {
enable = true;
shellAliases = {
ls = "eza -l --icons=auto";
neofetch = "${pkgs.fastfetch}/bin/fastfetch";
};
interactiveShellInit = ''
fish_vi_key_bindings
set -g fish_greeting
'';
plugins = [
{
name = "autopair";
src = pkgs.fetchFromGitHub {
owner = "jorgebucaran";
repo = "autopair.fish";
rev = "4d1752ff5b39819ab58d7337c69220342e9de0e2";
hash = "sha256-qt3t1iKRRNuiLWiVoiAYOu+9E7jsyECyIqZJ/oRIT1A=";
};
}
{
name = "fzf";
src = pkgs.fetchFromGitHub {
owner = "PatrickF1";
repo = "fzf.fish";
rev = "8920367cf85eee5218cc25a11e209d46e2591e7a";
hash = "sha256-T8KYLA/r/gOKvAivKRoeqIwE2pINlxFQtZJHpOy9GMM=";
};
}
{
name = "sponge";
src = pkgs.fetchFromGitHub {
owner = "meaningful-ooo";
repo = "sponge";
rev = "384299545104d5256648cee9d8b117aaa9a6d7be";
hash = "sha256-MdcZUDRtNJdiyo2l9o5ma7nAX84xEJbGFhAVhK+Zm1w=";
};
}
{
name = "done";
src = pkgs.fetchFromGitHub {
owner = "franciscolourenco";
repo = "done";
rev = "eb32ade85c0f2c68cbfcff3036756bbf27a4f366";
hash = "sha256-DMIRKRAVOn7YEnuAtz4hIxrU93ULxNoQhW6juxCoh4o=";
};
}
];
};
programs.nix-index = {
enable = true;
enableBashIntegration = true;
enableFishIntegration = true;
};
programs.nix-index-database.comma.enable = true;
programs.fd.enable = true;
programs.btop = {
enable = true;
settings = {
vim_keys = true;
theme_background = false;
};
};
programs.eza = {
enable = true;
enableFishIntegration = true;
enableBashIntegration = true;
git = true;
};
programs.yazi = {
enable = true;
enableBashIntegration = true;
enableFishIntegration = true;
plugins = {
mediainfo = pkgs.fetchFromGitHub {
owner = "Ape";
repo = "mediainfo.yazi";
rev = "c69314e80f5b45fe87a0e06a10d064ed54110439";
hash = "sha256-8xdBPdKSiwB7iRU8DJdTHY+BjfR9D3FtyVtDL9tNiy4=";
};
};
settings = {
plugin = {
prepend_previewers = [
{
mime = "{image,audio,video}/*";
run = "mediainfo";
}
{
mime = "application/x-subrip";
run = "mediainfo";
}
];
};
};
};
programs.zathura.enable = true;
};
}

View file

@ -0,0 +1,81 @@
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"display": {
"separator": " "
},
"modules": [
"break",
"break",
"break",
"break",
"break",
{
"type": "title",
"keyWidth": 10
},
"break",
{
"type": "os",
"key": " ",
"keyColor": "34",
"format": "{3} on {12}"
},
{
"type": "kernel",
"key": " ",
"keyColor": "34"
},
{
"type": "packages",
"key": " ",
"keyColor": "34"
},
{
"type": "shell",
"key": " ",
"keyColor": "34"
},
{
"type": "terminal",
"key": " ",
"keyColor": "34"
},
{
"type": "wm",
"key": " ",
"keyColor": "34"
},
{
"type": "CPU",
"key": " ",
"keyColor": "34"
},
{
"type": "GPU",
"key": "󰍹 ",
"keyColor": "34"
},
{
"type": "uptime",
"key": " ",
"keyColor": "34"
},
{
"type": "media",
"key": "󰝚 ",
"keyColor": "34"
},
{
"type": "player",
"key": " ",
"keyColor": "34"
},
"break",
{
"type": "custom",
"format": "\u001b[90m \u001b[31m \u001b[32m \u001b[33m \u001b[34m \u001b[35m \u001b[36m \u001b[37m "
},
"break",
"break"
]
}

View file

@ -0,0 +1,39 @@
{ config, lib, ... }:
let
fastfetchConfig = builtins.fromJSON (builtins.readFile ./config.json);
cfg = config.liminalOS.shellEnv.fastfetch;
in
{
options.liminalOS.shellEnv.fastfetch = {
enable = lib.mkOption {
type = lib.types.bool;
default = config.liminalOS.shellEnv.enable;
description = ''
Whether to set up and configure fastfetch.
'';
};
useKittyImage = lib.mkOption {
type = lib.types.bool;
default = cfg.enable;
description = ''
Whether to use the kitty image protocol.
'';
};
};
config.programs.fastfetch = lib.mkIf cfg.enable {
enable = true;
settings = (
fastfetchConfig
// {
logo = {
height = 18;
padding = {
top = 2;
};
type = if cfg.useKittyImage then "kitty" else "auto";
source = lib.mkIf cfg.useKittyImage ./nixos-logo.png;
};
}
);
};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View file

@ -0,0 +1,315 @@
# version: 1.0.0
add_newline = false
continuation_prompt = "[▸▹ ](dimmed white)"
format = """( $nix_shell$container$fill$git_metrics\n)$cmd_duration\
$hostname\
$localip\
$shlvl\
$shell\
$env_var\
$jobs\
$sudo\
$username\
$character"""
right_format = """
$singularity\
$kubernetes\
$directory\
$vcsh\
$fossil_branch\
$git_branch\
$git_commit\
$git_state\
$git_status\
$hg_branch\
$pijul_channel\
$docker_context\
$package\
$c\
$cmake\
$cobol\
$daml\
$dart\
$deno\
$dotnet\
$elixir\
$elm\
$erlang\
$fennel\
$golang\
$guix_shell\
$haskell\
$haxe\
$helm\
$java\
$julia\
$kotlin\
$gradle\
$lua\
$nim\
$nodejs\
$ocaml\
$opa\
$perl\
$php\
$pulumi\
$purescript\
$python\
$raku\
$rlang\
$red\
$ruby\
$rust\
$scala\
$solidity\
$swift\
$terraform\
$vlang\
$vagrant\
$zig\
$buf\
$conda\
$meson\
$spack\
$memory_usage\
$aws\
$gcloud\
$openstack\
$azure\
$crystal\
$custom\
$status\
$os\
$battery\
$time"""
[fill]
symbol = ' '
[character]
format = "$symbol "
success_symbol = "[◎](bold italic bright-yellow)"
error_symbol = "[○](italic purple)"
vimcmd_symbol = "[■](italic dimmed green)"
# not supported in zsh
vimcmd_replace_one_symbol = "◌"
vimcmd_replace_symbol = "□"
vimcmd_visual_symbol = "▼"
[env_var.VIMSHELL]
format = "[$env_value]($style)"
style = 'green italic'
[sudo]
format = "[$symbol]($style)"
style = "bold italic bright-purple"
symbol = "⋈┈"
disabled = false
[username]
style_user = "bright-yellow bold italic"
style_root = "purple bold italic"
format = "[⭘ $user]($style) "
disabled = false
show_always = false
[directory]
home_symbol = "⌂"
truncation_length = 2
truncation_symbol = "□ "
read_only = " ◈"
use_os_path_sep = true
style = "italic blue"
format = '[$path]($style)[$read_only]($read_only_style)'
repo_root_style = 'bold blue'
repo_root_format = '[$before_root_path]($before_repo_root_style)[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) [△](bold bright-blue)'
[cmd_duration]
format = "[◄ $duration ](italic white)"
[jobs]
format = "[$symbol$number]($style) "
style = "white"
symbol = "[▶](blue italic)"
[localip]
ssh_only = true
format = " ◯[$localipv4](bold magenta)"
disabled = false
[time]
disabled = false
format = "[ $time]($style)"
time_format = "%R"
utc_time_offset = "local"
style = "italic dimmed white"
[battery]
format = "[ $percentage $symbol]($style)"
full_symbol = "█"
charging_symbol = "[↑](italic bold green)"
discharging_symbol = "↓"
unknown_symbol = "░"
empty_symbol = "▃"
[[battery.display]]
threshold = 20
style = "italic bold red"
[[battery.display]]
threshold = 60
style = "italic dimmed bright-purple"
[[battery.display]]
threshold = 70
style = "italic dimmed yellow"
[git_branch]
format = " [$branch(:$remote_branch)]($style)"
symbol = "[△](bold italic bright-blue)"
style = "italic bright-blue"
truncation_symbol = "⋯"
truncation_length = 11
ignore_branches = ["main", "master"]
only_attached = true
[git_metrics]
format = '([▴$added]($added_style))([▿$deleted]($deleted_style))'
added_style = 'italic dimmed green'
deleted_style = 'italic dimmed red'
ignore_submodules = true
disabled = false
[git_status]
style = "bold italic bright-blue"
format = "([⎪$ahead_behind$staged$modified$untracked$renamed$deleted$conflicted$stashed⎥]($style))"
conflicted = "[◪◦](italic bright-magenta)"
ahead = "[▴│[${count}](bold white)│](italic green)"
behind = "[▿│[${count}](bold white)│](italic red)"
diverged = "[◇ ▴┤[${ahead_count}](regular white)│▿┤[${behind_count}](regular white)│](italic bright-magenta)"
untracked = "[◌◦](italic bright-yellow)"
stashed = "[◃◈](italic white)"
modified = "[●◦](italic yellow)"
staged = "[▪┤[$count](bold white)│](italic bright-cyan)"
renamed = "[◎◦](italic bright-blue)"
deleted = "[✕](italic red)"
[deno]
format = " [deno](italic) [∫ $version](green bold)"
version_format = "${raw}"
[lua]
format = " [lua](italic) [${symbol}${version}]($style)"
version_format = "${raw}"
symbol = "⨀ "
style = "bold bright-yellow"
[nodejs]
format = " [node](italic) [◫ ($version)](bold bright-green)"
version_format = "${raw}"
detect_files = ["package-lock.json", "yarn.lock"]
detect_folders = ["node_modules"]
detect_extensions = []
[python]
format = " [py](italic) [${symbol}${version}]($style)"
symbol = "[⌉](bold bright-blue)⌊ "
version_format = "${raw}"
style = "bold bright-yellow"
[ruby]
format = " [rb](italic) [${symbol}${version}]($style)"
symbol = "◆ "
version_format = "${raw}"
style = "bold red"
[rust]
format = " [rs](italic) [$symbol$version]($style)"
symbol = "⊃ "
version_format = "${raw}"
style = "bold red"
[package]
format = " [pkg](italic dimmed) [$symbol$version]($style)"
version_format = "${raw}"
symbol = "◨ "
style = "dimmed yellow italic bold"
[swift]
format = " [sw](italic) [${symbol}${version}]($style)"
symbol = "◁ "
style = "bold bright-red"
version_format = "${raw}"
[aws]
disabled = true
format = " [aws](italic) [$symbol $profile $region]($style)"
style = "bold blue"
symbol = "▲ "
[buf]
symbol = "■ "
format = " [buf](italic) [$symbol $version $buf_version]($style)"
[c]
symbol = " "
format = " [$symbol($version(-$name))]($style)"
[conda]
symbol = "◯ "
format = " conda [$symbol$environment]($style)"
[dart]
symbol = "◁◅ "
format = " dart [$symbol($version )]($style)"
[docker_context]
symbol = "◧ "
format = " docker [$symbol$context]($style)"
[elixir]
symbol = "△ "
format = " exs [$symbol $version OTP $otp_version ]($style)"
[elm]
symbol = "◩ "
format = " elm [$symbol($version )]($style)"
[golang]
symbol = "∩ "
format = " go [$symbol($version )]($style)"
[haskell]
symbol = "❯λ "
format = " hs [$symbol($version )]($style)"
[java]
symbol = " "
format = " java [${symbol}(${version} )]($style)"
[julia]
symbol = "◎ "
format = " jl [$symbol($version )]($style)"
[memory_usage]
symbol = "▪▫▪ "
format = " mem [${ram}( ${swap})]($style)"
[nim]
symbol = "▴▲▴ "
format = " nim [$symbol($version )]($style)"
[nix_shell]
style = 'bold italic dimmed blue'
symbol = '󱄅'
format = '[$symbol nix⎪$state⎪]($style) [$name](italic dimmed white)'
impure_msg = '[⌽](bold dimmed red)'
pure_msg = '[⌾](bold dimmed green)'
unknown_msg = '[◌](bold dimmed ellow)'
[spack]
symbol = "◇ "
format = " spack [$symbol$environment]($style)"