feat(home): move cli config to homes and use home-manager modules
This commit is contained in:
parent
1a3ff4b92a
commit
00e3ea65c8
17 changed files with 198 additions and 271 deletions
26
homes/x86_64-linux/rafiq/cli/fetch.nix
Normal file
26
homes/x86_64-linux/rafiq/cli/fetch.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib) singleton;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
home = {
|
||||||
|
packages = singleton pkgs.fastfetch;
|
||||||
|
sessionVariables.FETCH = "hyfetch";
|
||||||
|
shellAliases.fetch = "hyfetch";
|
||||||
|
};
|
||||||
|
programs.hyfetch = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
preset = "bisexual";
|
||||||
|
mode = "rgb";
|
||||||
|
light_dark = "dark";
|
||||||
|
lightness = 0.5;
|
||||||
|
color_align = {
|
||||||
|
mode = "horizontal";
|
||||||
|
custom_colors = [ ];
|
||||||
|
fore_back = null;
|
||||||
|
};
|
||||||
|
backend = "fastfetch";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
20
homes/x86_64-linux/rafiq/cli/file-browser.nix
Normal file
20
homes/x86_64-linux/rafiq/cli/file-browser.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
home.sessionVariables.FILE_BROWSER = "yazi";
|
||||||
|
programs.yazi = {
|
||||||
|
enable = true;
|
||||||
|
shellWrapperName = "t";
|
||||||
|
settings = {
|
||||||
|
mgr = {
|
||||||
|
sort_by = "natural";
|
||||||
|
};
|
||||||
|
opener = {
|
||||||
|
play = [
|
||||||
|
{
|
||||||
|
run = "vlc \"$@\"";
|
||||||
|
desc = "Open";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
6
homes/x86_64-linux/rafiq/cli/finder.nix
Normal file
6
homes/x86_64-linux/rafiq/cli/finder.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
programs.fzf = {
|
||||||
|
enable = true;
|
||||||
|
enableZshIntegration = true;
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,11 +1,7 @@
|
||||||
{
|
{ pkgs, osConfig, ... }:
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
osConfig,
|
|
||||||
}:
|
|
||||||
{
|
{
|
||||||
home.sessionVariables.MULTIPLEXER = "zellij";
|
home.sessionVariables.MULTIPLEXER = "zellij";
|
||||||
home.persistence."/persist/home/${config.snowfallorg.user.name}".directories = [ "/.cache/zellij" ];
|
persistDirs = [ "/.cache/zellij" ];
|
||||||
programs.zellij = {
|
programs.zellij = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
42
homes/x86_64-linux/rafiq/cli/shell.nix
Normal file
42
homes/x86_64-linux/rafiq/cli/shell.nix
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
inherit (builtins) toString;
|
||||||
|
inherit (lib) mkOrder;
|
||||||
|
screensaverTimeout = toString 100;
|
||||||
|
screensaverCommand = "${pkgs.cbonsai}/bin/cbonsai -S -w 0.1 -L 40 -M 2 -b 2";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
home.shell.enableShellIntegration = true;
|
||||||
|
home.sessionVariables.SHELL = "zsh";
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
enableVteIntegration = true;
|
||||||
|
syntaxHighlighting.enable = true;
|
||||||
|
historySubstringSearch.enable = true;
|
||||||
|
history = {
|
||||||
|
append = true;
|
||||||
|
extended = true;
|
||||||
|
ignoreDups = true;
|
||||||
|
ignoreSpace = true;
|
||||||
|
save = 10000;
|
||||||
|
share = true;
|
||||||
|
size = 10000;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
programs.zsh.initContent =
|
||||||
|
mkOrder 1200
|
||||||
|
# zsh
|
||||||
|
''
|
||||||
|
precmd() {
|
||||||
|
TMOUT=${screensaverTimeout}
|
||||||
|
}
|
||||||
|
|
||||||
|
TRAPALRM() {
|
||||||
|
TMOUT=1
|
||||||
|
${screensaverCommand}
|
||||||
|
# If we exit, assume the previous command was exited out of
|
||||||
|
TMOUT=${screensaverTimeout}
|
||||||
|
zle reset-prompt
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
}
|
24
homes/x86_64-linux/rafiq/cli/utilities/git.nix
Normal file
24
homes/x86_64-linux/rafiq/cli/utilities/git.nix
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
home.sessionVariables.GIT_CONFIG_GLOBAL = "$HOME/.config/git/config";
|
||||||
|
home.shellAliases = {
|
||||||
|
gs = "git status";
|
||||||
|
gc = "git commit";
|
||||||
|
gcam = "git commit -am";
|
||||||
|
gu = "git push";
|
||||||
|
gy = "git pull";
|
||||||
|
};
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
userName = "Mohammad Rafiq";
|
||||||
|
userEmail = "rafiq@rrv.sh";
|
||||||
|
signing.key = "~/.ssh/id_ed25519.pub";
|
||||||
|
signing.signByDefault = true;
|
||||||
|
extraConfig = {
|
||||||
|
init.defaultBranch = "prime";
|
||||||
|
push.autoSetupRemote = true;
|
||||||
|
pull.rebase = false;
|
||||||
|
core.editor = "$EDITOR";
|
||||||
|
gpg.format = "ssh";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
53
homes/x86_64-linux/rafiq/cli/utilities/misc.nix
Normal file
53
homes/x86_64-linux/rafiq/cli/utilities/misc.nix
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
{ inputs, pkgs, ... }:
|
||||||
|
{
|
||||||
|
programs = {
|
||||||
|
nh.enable = true;
|
||||||
|
tealdeer.enable = true;
|
||||||
|
tealdeer.settings.updates.auto_update = true;
|
||||||
|
pay-respects.enable = true;
|
||||||
|
direnv = {
|
||||||
|
enable = true;
|
||||||
|
nix-direnv.enable = true;
|
||||||
|
};
|
||||||
|
starship = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
add_newline = false;
|
||||||
|
format = ''
|
||||||
|
$directory$character
|
||||||
|
'';
|
||||||
|
right_format = ''
|
||||||
|
$all
|
||||||
|
'';
|
||||||
|
git_branch.format = "[$symbol$branch(:$remote_branch)]($style) ";
|
||||||
|
shlvl.disabled = false;
|
||||||
|
hostname.disabled = true;
|
||||||
|
username.disabled = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
home = {
|
||||||
|
shellAliases = {
|
||||||
|
v = "nvim";
|
||||||
|
e = "edit";
|
||||||
|
cd = "z";
|
||||||
|
ai = "aichat -r %shell% -e";
|
||||||
|
};
|
||||||
|
packages = with pkgs; [
|
||||||
|
aichat
|
||||||
|
devenv
|
||||||
|
pantheon.rebuild
|
||||||
|
pantheon.deploy
|
||||||
|
pantheon.edit
|
||||||
|
pantheon.commit
|
||||||
|
pantheon.check
|
||||||
|
inputs.nixspect.packages."x86_64-linux".nixspect
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
xdg.configFile."aichat/config.yaml".text = ''
|
||||||
|
model: gemini:gemini-2.0-flash
|
||||||
|
clients:
|
||||||
|
- type: gemini
|
||||||
|
'';
|
||||||
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
|
||||||
inputs,
|
inputs,
|
||||||
osConfig,
|
osConfig,
|
||||||
lib,
|
lib,
|
||||||
|
@ -26,7 +25,9 @@ let
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = (optional osConfig.desktop.enable (import-tree ./desktop)) ++ singleton (import-tree ./cli);
|
imports =
|
||||||
|
(optional osConfig.desktop.enable (import-tree ./desktop))
|
||||||
|
++ singleton (import-tree ./cli);
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
accounts = {
|
accounts = {
|
||||||
|
@ -40,46 +41,5 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
cli = {
|
|
||||||
shell = "zsh";
|
|
||||||
finder = "fzf";
|
|
||||||
screensaver.enable = true;
|
|
||||||
screensaver.timeout = "100";
|
|
||||||
screensaver.command = "cbonsai -S -w 0.1 -L 40 -M 2 -b 2";
|
|
||||||
file-browser = "yazi";
|
|
||||||
multiplexer = "zellij";
|
|
||||||
fetch = "hyfetch";
|
|
||||||
git.name = "Mohammad Rafiq";
|
|
||||||
git.email = "rafiq@rrv.sh";
|
|
||||||
git.defaultBranch = "prime";
|
|
||||||
};
|
|
||||||
home = {
|
|
||||||
shellAliases = {
|
|
||||||
v = "nvim";
|
|
||||||
e = "edit";
|
|
||||||
};
|
|
||||||
|
|
||||||
packages = with pkgs; [
|
|
||||||
cbonsai
|
|
||||||
ripgrep
|
|
||||||
devenv
|
|
||||||
pantheon.rebuild
|
|
||||||
pantheon.deploy
|
|
||||||
pantheon.edit
|
|
||||||
pantheon.commit
|
|
||||||
pantheon.check
|
|
||||||
inputs.nixspect.packages."x86_64-linux".nixspect
|
|
||||||
];
|
|
||||||
};
|
|
||||||
programs = {
|
|
||||||
nh.enable = true;
|
|
||||||
tealdeer.enable = true;
|
|
||||||
tealdeer.settings.updates.auto_update = true;
|
|
||||||
pay-respects.enable = true;
|
|
||||||
direnv = {
|
|
||||||
enable = true;
|
|
||||||
nix-direnv.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
options.cli = {
|
|
||||||
shell = lib.pantheon.mkStrOption;
|
|
||||||
finder = lib.pantheon.mkStrOption;
|
|
||||||
screensaver.enable = lib.mkEnableOption "";
|
|
||||||
screensaver.timeout = lib.pantheon.mkStrOption;
|
|
||||||
screensaver.command = lib.pantheon.mkStrOption;
|
|
||||||
file-browser = lib.pantheon.mkStrOption;
|
|
||||||
multiplexer = lib.pantheon.mkStrOption;
|
|
||||||
fetch = lib.pantheon.mkStrOption;
|
|
||||||
git = {
|
|
||||||
name = lib.pantheon.mkStrOption;
|
|
||||||
email = lib.pantheon.mkStrOption;
|
|
||||||
defaultBranch = lib.pantheon.mkStrOption;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkMerge [
|
|
||||||
{
|
|
||||||
home.shell.enableShellIntegration = true;
|
|
||||||
programs.ssh = {
|
|
||||||
enable = true;
|
|
||||||
extraConfig = ''
|
|
||||||
Host *
|
|
||||||
SetEnv TERM=xterm-256color
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
programs.zoxide.enable = true;
|
|
||||||
home.shellAliases.cd = "z";
|
|
||||||
home.persistence."/persist/home/${config.snowfallorg.user.name}".directories = [
|
|
||||||
".local/share/zoxide"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
programs.nix-index.enable = true;
|
|
||||||
programs.nix-index-database.comma.enable = true;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
home.shellAliases.ai = "aichat -r %shell% -e";
|
|
||||||
|
|
||||||
home.packages = with pkgs; [ aichat ];
|
|
||||||
|
|
||||||
xdg.configFile."aichat/config.yaml".text = ''
|
|
||||||
model: gemini:gemini-2.0-flash
|
|
||||||
clients:
|
|
||||||
- type: gemini
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
programs.starship = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
add_newline = false;
|
|
||||||
format = ''
|
|
||||||
$directory$character
|
|
||||||
'';
|
|
||||||
right_format = ''
|
|
||||||
$all
|
|
||||||
'';
|
|
||||||
git_branch.format = "[$symbol$branch(:$remote_branch)]($style) ";
|
|
||||||
shlvl.disabled = false;
|
|
||||||
hostname.disabled = true;
|
|
||||||
username.disabled = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
config = lib.mkMerge [
|
|
||||||
(lib.mkIf (config.cli.fetch == "hyfetch") {
|
|
||||||
home.packages = [ pkgs.fastfetch ];
|
|
||||||
home.sessionVariables.FETCH = "hyfetch";
|
|
||||||
home.shellAliases.fetch = "hyfetch";
|
|
||||||
programs.hyfetch = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
preset = "bisexual";
|
|
||||||
mode = "rgb";
|
|
||||||
light_dark = "dark";
|
|
||||||
lightness = 0.5;
|
|
||||||
color_align = {
|
|
||||||
mode = "horizontal";
|
|
||||||
custom_colors = [ ];
|
|
||||||
fore_back = null;
|
|
||||||
};
|
|
||||||
backend = "fastfetch";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
{ config, lib, ... }:
|
|
||||||
{
|
|
||||||
config = lib.mkIf (config.cli.file-browser == "yazi") {
|
|
||||||
home.sessionVariables.FILE_BROWSER = "yazi";
|
|
||||||
programs.yazi = {
|
|
||||||
enable = true;
|
|
||||||
shellWrapperName = "t";
|
|
||||||
settings = {
|
|
||||||
mgr = {
|
|
||||||
sort_by = "natural";
|
|
||||||
};
|
|
||||||
opener = {
|
|
||||||
play = [
|
|
||||||
{
|
|
||||||
run = "vlc \"$@\"";
|
|
||||||
desc = "Open";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
{ config, lib, ... }:
|
|
||||||
{
|
|
||||||
config = lib.mkMerge [
|
|
||||||
(lib.mkIf (config.cli.finder == "fzf") {
|
|
||||||
programs.fzf = {
|
|
||||||
enable = true;
|
|
||||||
enableZshIntegration = lib.mkIf (config.cli.shell == "zsh") true;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
osConfig,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
config = lib.mkMerge [
|
|
||||||
(lib.mkIf (config.cli.multiplexer == "zellij") (
|
|
||||||
import ./zellij.nix { inherit config pkgs osConfig; }
|
|
||||||
))
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
{ config, lib, ... }:
|
|
||||||
{
|
|
||||||
config = lib.mkIf (config.cli.shell == "zsh") {
|
|
||||||
home.sessionVariables.SHELL = "zsh";
|
|
||||||
programs.zsh = {
|
|
||||||
enable = true;
|
|
||||||
enableVteIntegration = true;
|
|
||||||
syntaxHighlighting.enable = true;
|
|
||||||
historySubstringSearch.enable = true;
|
|
||||||
history = {
|
|
||||||
append = true;
|
|
||||||
extended = true;
|
|
||||||
ignoreDups = true;
|
|
||||||
ignoreSpace = true;
|
|
||||||
save = 10000;
|
|
||||||
share = true;
|
|
||||||
size = 10000;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
programs.zsh.initContent = lib.mkIf config.cli.screensaver.enable (
|
|
||||||
lib.mkOrder 1200
|
|
||||||
# zsh
|
|
||||||
''
|
|
||||||
precmd() {
|
|
||||||
TMOUT=${config.cli.screensaver.timeout}
|
|
||||||
}
|
|
||||||
|
|
||||||
TRAPALRM() {
|
|
||||||
TMOUT=1
|
|
||||||
${config.cli.screensaver.command}
|
|
||||||
# If we exit, assume the previous command was exited out of
|
|
||||||
TMOUT=${config.cli.screensaver.timeout}
|
|
||||||
zle reset-prompt
|
|
||||||
}
|
|
||||||
''
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
imports = [ ./git.nix ];
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
{ config, ... }:
|
|
||||||
{
|
|
||||||
config = {
|
|
||||||
home.sessionVariables.GIT_CONFIG_GLOBAL = "$HOME/.config/git/config";
|
|
||||||
home.shellAliases = {
|
|
||||||
gs = "git status";
|
|
||||||
gc = "git commit";
|
|
||||||
gcam = "git commit -am";
|
|
||||||
gu = "git push";
|
|
||||||
gy = "git pull";
|
|
||||||
};
|
|
||||||
programs.git = {
|
|
||||||
enable = true;
|
|
||||||
userName = config.cli.git.name;
|
|
||||||
userEmail = config.cli.git.email;
|
|
||||||
signing.key = "~/.ssh/id_ed25519.pub";
|
|
||||||
signing.signByDefault = true;
|
|
||||||
extraConfig = {
|
|
||||||
init.defaultBranch = config.cli.git.defaultBranch;
|
|
||||||
push.autoSetupRemote = true;
|
|
||||||
pull.rebase = false;
|
|
||||||
core.editor = "$EDITOR";
|
|
||||||
gpg.format = "ssh";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,4 +1,9 @@
|
||||||
{ config, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) mkOption;
|
inherit (lib) mkOption;
|
||||||
inherit (lib.types) listOf str;
|
inherit (lib.types) listOf str;
|
||||||
|
@ -12,15 +17,31 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
# Helper options
|
||||||
home.persistence."/persist/home/${config.snowfallorg.user.name}" = {
|
home.persistence."/persist/home/${config.snowfallorg.user.name}" = {
|
||||||
directories = config.persistDirs;
|
directories = config.persistDirs;
|
||||||
allowOther = true;
|
allowOther = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Global options
|
||||||
persistDirs = [
|
persistDirs = [
|
||||||
".ssh"
|
".ssh"
|
||||||
".config/sops/age"
|
".config/sops/age"
|
||||||
|
".local/share/zoxide"
|
||||||
];
|
];
|
||||||
|
home.packages = with pkgs; [ ripgrep ];
|
||||||
|
programs = {
|
||||||
|
zoxide.enable = true;
|
||||||
|
nix-index.enable = true;
|
||||||
|
nix-index-database.comma.enable = true;
|
||||||
|
ssh = {
|
||||||
|
enable = true;
|
||||||
|
extraConfig = ''
|
||||||
|
Host *
|
||||||
|
SetEnv TERM=xterm-256color
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
home.stateVersion = "24.11";
|
home.stateVersion = "24.11";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue