fully refactored stolen config :D

This commit is contained in:
vali 2024-04-10 17:39:26 +02:00
commit 0dd4f09001
39 changed files with 1603 additions and 206 deletions

View file

@ -0,0 +1,7 @@
_: {
imports = [
./git.nix
./starship.nix
./zsh.nix
];
}

63
modules/vali/cli/git.nix Normal file
View file

@ -0,0 +1,63 @@
{
config,
lib,
pkgs,
...
}: with lib; let
cfg = config.myOptions.programs.git;
username = config.myOptions.other.system.username;
in {
options.myOptions.programs.git = {
enable = mkEnableOption "git";
userName = mkOption {
type = types.str;
description = "git username";
};
userEmail = mkOption {
type = types.str;
description = "git email";
};
# signingKey = mkOption {
# type = types.str;
# description = "git commit signing key";
# };
editor = mkOption {
type = types.str;
default = "$EDITOR";
description = "commit message editor";
};
defaultBranch = mkOption {
type = types.str;
default = "master";
description = "default git branch";
};
};
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.git = {
inherit (cfg) enable userName userEmail;
extraConfig = {
core = {
editor = cfg.editor;
pager = "${pkgs.delta}/bin/delta";
};
init.defaultBranch = cfg.defaultBranch;
push.autoSetupRemote = true;
commit = {
verbose = true;
gpgsign = true;
};
gpg.format = "ssh";
# user.signingkey = "key::${cfg.signingKey}";
merge.conflictstyle = "zdiff3";
interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only";
diff.algorithm = "histogram";
transfer.fsckobjects = true;
fetch.fsckobjects = true;
receive.fsckobjects = true;
};
};
};
};
}

View file

@ -0,0 +1,42 @@
{
config,
lib,
...
}: with lib; let
cfg = config.myOptions.programs.starship;
username = config.myOptions.other.system.username;
in {
options.myOptions.programs.starship.enable = mkEnableOption "starship";
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.starship = {
enable = true;
enableZshIntegration = config.myOptions.programs.zsh.enable;
settings = {
add_newline = false;
command_timeout = 1000;
line_break = {
disabled = true;
};
directory = {
truncation_length = 3;
truncate_to_repo = false;
truncation_symbol = "/";
};
c.symbol = " ";
directory.read_only = " 󰌾";
git_branch.symbol = " ";
haskell.symbol = " ";
hostname.ssh_symbol = " ";
java.symbol = " ";
kotlin.symbol = " ";
meson.symbol = "󰔷 ";
nix_shell.symbol = " ";
package.symbol = "󰏗 ";
rust.symbol = " ";
};
};
};
};
}

67
modules/vali/cli/zsh.nix Normal file
View file

@ -0,0 +1,67 @@
{ config, lib, pkgs, ... }:
with lib; let
cfg = config.myOptions.programs.zsh;
username = config.myOptions.other.system.username;
in {
options.myOptions.programs.zsh = {
enable = mkEnableOption "zsh";
extraAliases = mkOption {
type = types.attrs;
description = "extra shell aliases";
default = {};
};
profiling = mkOption {
type = types.bool;
description = "enable zsh profiling";
default = false;
};
};
config = mkIf cfg.enable {
programs.zsh.enable = true;
user.users.${username}.shell = pkgs.zsh;
environment = {
shells = [ pkgs.zsh ];
pathsToLink = [ "/share/zsh" ];
};
home-manager.users.${username} = {
programs.zsh = {
enable = true;
shellAliases = {
c = "clear";
cc = "cd && clear";
mv = "mv -iv";
rm = "trash -v";
l = "eza -a --icons";
la = "eza -lha --icons --git";
cd = "zoxide"
} // cfg.extraAliases;
initExtraFirst = mkIf cfg.profiling "zmodload zsh/zprof";
initExtra = mkIf cfg.profiling "zprof";
history {
path = "${config.home-manager.users.${username}.xdg.dataHome}/zsh/zsh_history";
size = 99999;
save = 99999;
extended = true;
ignoreSpace = true;
};
autosuggestion.enable = true;
enableCompletion = true;
autocd = false;
dotDir = ".config/zsh";
plugins = [
{
name = "fast-syntax-highlighting";
file = "fast-syntax-highlighting.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "zdharma-continuum";
repo = "fast-syntax-highlighting";
rev = "cf318e06a9b7c9f2219d78f41b46fa6e06011fd9";
sha256 = "sha256-RVX9ZSzjBW3LpFs2W86lKI6vtcvDWP6EPxzeTcRZua4=";
};
}
];
};
};
};
}