mirror of
https://github.com/semere-meb/dotfiles-nix.git
synced 2026-08-03 10:24:36 +00:00
reorganization into flat profile-based modules
This commit is contained in:
parent
1bc8c22feb
commit
127227205d
15 changed files with 660 additions and 696 deletions
|
|
@ -35,7 +35,7 @@
|
|||
in
|
||||
lib.nixosSystem {
|
||||
system = hostConfig.system;
|
||||
specialArgs = { inherit userVars; };
|
||||
specialArgs = { inherit userVars self; };
|
||||
modules = [
|
||||
hostConfig.configModule
|
||||
]
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = { inherit userVars; };
|
||||
extraSpecialArgs = { inherit userVars self; };
|
||||
backupFileExtension = "backup";
|
||||
};
|
||||
}
|
||||
|
|
@ -55,5 +55,6 @@
|
|||
in
|
||||
{
|
||||
inherit nixosConfigurations;
|
||||
nixosModules = import ./modules { inherit lib self; };
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,24 +5,15 @@
|
|||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../../modules
|
||||
self.nixosModules.desktop-suite
|
||||
];
|
||||
|
||||
networking.hostName = "nabro";
|
||||
|
||||
dotfiles = {
|
||||
core.enable = true;
|
||||
user.enable = true;
|
||||
desktop.enable = true;
|
||||
dev.enable = true;
|
||||
shell.enable = true;
|
||||
zsh.enable = true;
|
||||
helix.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
18
modules/cli-tools.nix
Normal file
18
modules/cli-tools.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
wget
|
||||
tealdeer
|
||||
p7zip
|
||||
btop
|
||||
opencode
|
||||
fd
|
||||
ripgrep
|
||||
];
|
||||
}
|
||||
|
|
@ -5,15 +5,7 @@
|
|||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.dotfiles.core;
|
||||
in
|
||||
{
|
||||
options.dotfiles.core = {
|
||||
enable = lib.mkEnableOption "Core system configuration";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
|
@ -60,5 +52,4 @@ in
|
|||
};
|
||||
|
||||
system.stateVersion = "26.05";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,41 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{ lib, self, ... }:
|
||||
let
|
||||
moduleDirectoryList = builtins.filter (
|
||||
name: name != "default.nix" && lib.strings.hasSuffix ".nix" name
|
||||
) (builtins.attrNames (builtins.readDir ./.));
|
||||
|
||||
{
|
||||
allModules = builtins.listToAttrs (
|
||||
builtins.map (entry: {
|
||||
name = lib.strings.removeSuffix ".nix" entry;
|
||||
value = ./. + "/${entry}";
|
||||
}) moduleDirectoryList
|
||||
);
|
||||
in
|
||||
allModules
|
||||
// {
|
||||
desktop-suite = {
|
||||
imports = [
|
||||
./core.nix
|
||||
./user.nix
|
||||
./desktop.nix
|
||||
./dev.nix
|
||||
./shell
|
||||
self.nixosModules.core
|
||||
self.nixosModules.user
|
||||
self.nixosModules.desktop
|
||||
self.nixosModules.dev
|
||||
self.nixosModules.cli-tools
|
||||
self.nixosModules.git
|
||||
self.nixosModules.gpg
|
||||
self.nixosModules.zsh
|
||||
self.nixosModules.helix
|
||||
];
|
||||
};
|
||||
|
||||
core-suite = {
|
||||
imports = [
|
||||
self.nixosModules.core
|
||||
self.nixosModules.user
|
||||
self.nixosModules.cli-tools
|
||||
self.nixosModules.git
|
||||
self.nixosModules.gpg
|
||||
self.nixosModules.zsh
|
||||
self.nixosModules.helix
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,15 +6,7 @@
|
|||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.dotfiles.desktop;
|
||||
in
|
||||
{
|
||||
options.dotfiles.desktop = {
|
||||
enable = lib.mkEnableOption "Graphical desktop environment (DWL)";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.dwl.enable = true;
|
||||
programs.dwl.package = pkgs.dwl.override {
|
||||
configH = ../hosts/nabro/dwl-config.h;
|
||||
|
|
@ -138,5 +130,4 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,15 +5,7 @@
|
|||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.dotfiles.dev;
|
||||
in
|
||||
{
|
||||
options.dotfiles.dev = {
|
||||
enable = lib.mkEnableOption "Development tools and language servers";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
gcc
|
||||
gnumake
|
||||
|
|
@ -27,5 +19,4 @@ in
|
|||
nixd
|
||||
nixfmt
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
27
modules/git.nix
Normal file
27
modules/git.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
userVars,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
home-manager.users."${userVars.username}" = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
settings = {
|
||||
user = {
|
||||
name = userVars.fullName;
|
||||
email = userVars.email;
|
||||
};
|
||||
commit.gpgsign = true;
|
||||
gpg.program = "gpg";
|
||||
};
|
||||
signing = {
|
||||
key = userVars.gpgKey;
|
||||
signByDefault = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
24
modules/gpg.nix
Normal file
24
modules/gpg.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
userVars,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
gnupg
|
||||
pass
|
||||
pinentry-qt
|
||||
];
|
||||
|
||||
home-manager.users."${userVars.username}" = {
|
||||
services.gpg-agent = {
|
||||
enable = true;
|
||||
defaultCacheTtl = 1800;
|
||||
enableSshSupport = true;
|
||||
pinentry.package = pkgs.pinentry-qt;
|
||||
};
|
||||
};
|
||||
}
|
||||
146
modules/helix.nix
Normal file
146
modules/helix.nix
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
userVars,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
home-manager.users."${userVars.username}" = {
|
||||
programs.helix = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
|
||||
settings = {
|
||||
theme = "ayu_dark";
|
||||
editor = {
|
||||
line-number = "relative";
|
||||
mouse = false;
|
||||
color-modes = true;
|
||||
auto-format = true;
|
||||
completion-timeout = 5;
|
||||
completion-replace = true;
|
||||
preview-completion-insert = true;
|
||||
scrolloff = 8;
|
||||
cursorline = true;
|
||||
auto-info = true;
|
||||
rulers = [ 80 ];
|
||||
bufferline = "multiple";
|
||||
shell = [
|
||||
"zsh"
|
||||
"-c"
|
||||
];
|
||||
jump-label-alphabet = "asdfghjklqwertyuiopzxcvbnm";
|
||||
|
||||
cursor-shape = {
|
||||
insert = "bar";
|
||||
normal = "block";
|
||||
select = "underline";
|
||||
};
|
||||
|
||||
inline-diagnostics = {
|
||||
cursor-line = "warning";
|
||||
other-lines = "disable";
|
||||
};
|
||||
|
||||
file-picker = {
|
||||
hidden = false;
|
||||
git-ignore = true;
|
||||
git-global = true;
|
||||
};
|
||||
|
||||
statusline = {
|
||||
left = [
|
||||
"mode"
|
||||
"file-base-name"
|
||||
"version-control"
|
||||
];
|
||||
center = [ ];
|
||||
right = [
|
||||
"diagnostics"
|
||||
"selections"
|
||||
"position"
|
||||
"file-encoding"
|
||||
"file-type"
|
||||
];
|
||||
separator = "│";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
display-messages = true;
|
||||
display-inlay-hints = true;
|
||||
};
|
||||
|
||||
indent-guides = {
|
||||
render = true;
|
||||
character = "╎";
|
||||
skip-levels = 1;
|
||||
};
|
||||
|
||||
soft-wrap = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
smart-tab = {
|
||||
enable = true;
|
||||
supersede-menu = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
languages = {
|
||||
language = [
|
||||
{
|
||||
name = "python";
|
||||
language-servers = [
|
||||
"ty"
|
||||
"ruff"
|
||||
];
|
||||
formatter = {
|
||||
command = "ruff";
|
||||
args = [
|
||||
"format"
|
||||
"-"
|
||||
];
|
||||
};
|
||||
auto-format = true;
|
||||
}
|
||||
{
|
||||
name = "c";
|
||||
language-servers = [ "clangd" ];
|
||||
formatter = {
|
||||
command = "clang-format";
|
||||
args = [ "--style=file" ];
|
||||
};
|
||||
auto-format = true;
|
||||
}
|
||||
{
|
||||
name = "nix";
|
||||
language-servers = [ "nixd" ];
|
||||
formatter = {
|
||||
command = "nixfmt";
|
||||
};
|
||||
auto-format = true;
|
||||
}
|
||||
];
|
||||
|
||||
language-server = {
|
||||
nixd = {
|
||||
command = "nixd";
|
||||
};
|
||||
ruff = {
|
||||
command = "ruff";
|
||||
};
|
||||
ty = {
|
||||
command = "ty";
|
||||
args = [ "server" ];
|
||||
};
|
||||
clangd = {
|
||||
command = "clangd";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
userVars,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.dotfiles.shell;
|
||||
|
||||
shellDir = ./.;
|
||||
otherShellFiles = builtins.filter (
|
||||
name: name != "default.nix" && lib.strings.hasSuffix ".nix" name
|
||||
) (builtins.attrNames (builtins.readDir shellDir));
|
||||
importedModules = map (file: shellDir + "/${file}") otherShellFiles;
|
||||
in
|
||||
{
|
||||
imports = importedModules;
|
||||
|
||||
options.dotfiles.shell = {
|
||||
enable = lib.mkEnableOption "Shell, Git, GPG, and CLI environment";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
wget
|
||||
tealdeer
|
||||
gnupg
|
||||
pass
|
||||
p7zip
|
||||
btop
|
||||
helix
|
||||
opencode
|
||||
fd
|
||||
ripgrep
|
||||
];
|
||||
|
||||
home-manager.users."${userVars.username}" = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
settings = {
|
||||
user = {
|
||||
name = userVars.fullName;
|
||||
email = userVars.email;
|
||||
};
|
||||
commit.gpgsign = true;
|
||||
gpg.program = "gpg";
|
||||
};
|
||||
signing = {
|
||||
key = userVars.gpgKey;
|
||||
signByDefault = true;
|
||||
};
|
||||
};
|
||||
|
||||
services.gpg-agent = {
|
||||
enable = true;
|
||||
defaultCacheTtl = 1800;
|
||||
enableSshSupport = true;
|
||||
pinentry.package = pkgs.pinentry-qt;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,155 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
userVars,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.dotfiles.helix;
|
||||
in
|
||||
{
|
||||
options.dotfiles.helix = {
|
||||
enable = lib.mkEnableOption "Fully configured Helix editor";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home-manager.users."${userVars.username}" = {
|
||||
programs.helix = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
|
||||
settings = {
|
||||
theme = "ayu_dark";
|
||||
editor = {
|
||||
line-number = "relative";
|
||||
mouse = false;
|
||||
color-modes = true;
|
||||
auto-format = true;
|
||||
completion-timeout = 5;
|
||||
completion-replace = true;
|
||||
preview-completion-insert = true;
|
||||
scrolloff = 8;
|
||||
cursorline = true;
|
||||
auto-info = true;
|
||||
rulers = [ 80 ];
|
||||
bufferline = "multiple";
|
||||
shell = [
|
||||
"zsh"
|
||||
"-c"
|
||||
];
|
||||
jump-label-alphabet = "asdfghjklqwertyuiopzxcvbnm";
|
||||
|
||||
cursor-shape = {
|
||||
insert = "bar";
|
||||
normal = "block";
|
||||
select = "underline";
|
||||
};
|
||||
|
||||
inline-diagnostics = {
|
||||
cursor-line = "warning";
|
||||
other-lines = "disable";
|
||||
};
|
||||
|
||||
file-picker = {
|
||||
hidden = false;
|
||||
git-ignore = true;
|
||||
git-global = true;
|
||||
};
|
||||
|
||||
statusline = {
|
||||
left = [
|
||||
"mode"
|
||||
"file-base-name"
|
||||
"version-control"
|
||||
];
|
||||
center = [ ];
|
||||
right = [
|
||||
"diagnostics"
|
||||
"selections"
|
||||
"position"
|
||||
"file-encoding"
|
||||
"file-type"
|
||||
];
|
||||
separator = "│";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
display-messages = true;
|
||||
display-inlay-hints = true;
|
||||
};
|
||||
|
||||
indent-guides = {
|
||||
render = true;
|
||||
character = "╎";
|
||||
skip-levels = 1;
|
||||
};
|
||||
|
||||
soft-wrap = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
smart-tab = {
|
||||
enable = true;
|
||||
supersede-menu = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
languages = {
|
||||
language = [
|
||||
{
|
||||
name = "python";
|
||||
language-servers = [
|
||||
"ty"
|
||||
"ruff"
|
||||
];
|
||||
formatter = {
|
||||
command = "ruff";
|
||||
args = [
|
||||
"format"
|
||||
"-"
|
||||
];
|
||||
};
|
||||
auto-format = true;
|
||||
}
|
||||
{
|
||||
name = "c";
|
||||
language-servers = [ "clangd" ];
|
||||
formatter = {
|
||||
command = "clang-format";
|
||||
args = [ "--style=file" ];
|
||||
};
|
||||
auto-format = true;
|
||||
}
|
||||
{
|
||||
name = "nix";
|
||||
language-servers = [ "nixd" ];
|
||||
formatter = {
|
||||
command = "nixfmt";
|
||||
};
|
||||
auto-format = true;
|
||||
}
|
||||
];
|
||||
|
||||
language-server = {
|
||||
nixd = {
|
||||
command = "nixd";
|
||||
};
|
||||
ruff = {
|
||||
command = "ruff";
|
||||
};
|
||||
ty = {
|
||||
command = "ty";
|
||||
args = [ "server" ];
|
||||
};
|
||||
clangd = {
|
||||
command = "clangd";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,243 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
userVars,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.dotfiles.zsh;
|
||||
in
|
||||
{
|
||||
options.dotfiles.zsh = {
|
||||
enable = lib.mkEnableOption "Fully configured Zsh terminal environment";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.zsh.enable = true;
|
||||
|
||||
users.users."${userVars.username}".shell = pkgs.zsh;
|
||||
|
||||
home-manager.users."${userVars.username}" = {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = false;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
dotDir = "/home/${userVars.username}/.config/zsh";
|
||||
|
||||
initContent = ''
|
||||
# -- GPG / SSH Configuration --
|
||||
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
||||
|
||||
# Import Wayland environment to systemd for GUI tools (like pinentry-gnome3)
|
||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
systemctl --user import-environment WAYLAND_DISPLAY DISPLAY DBUS_SESSION_BUS_ADDRESS 2>/dev/null
|
||||
dbus-update-activation-environment --systemd WAYLAND_DISPLAY DISPLAY DBUS_SESSION_BUS_ADDRESS 2>/dev/null
|
||||
fi
|
||||
|
||||
# Automatically start dwl on TTY 1
|
||||
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
|
||||
exec dwl
|
||||
fi
|
||||
'';
|
||||
|
||||
history = {
|
||||
size = 10000;
|
||||
save = 10000;
|
||||
path = "$HOME/.local/share/zsh/history";
|
||||
ignoreDups = true;
|
||||
ignoreAllDups = true;
|
||||
ignoreSpace = true;
|
||||
share = true;
|
||||
extended = true;
|
||||
};
|
||||
|
||||
plugins = [
|
||||
{
|
||||
name = "fast-syntax-highlighting";
|
||||
src = pkgs.zsh-fast-syntax-highlighting.src;
|
||||
}
|
||||
{
|
||||
name = "zsh-autosuggestions";
|
||||
src = pkgs.zsh-autosuggestions.src;
|
||||
}
|
||||
{
|
||||
name = "zsh-history-substring-search";
|
||||
src = pkgs.zsh-history-substring-search.src;
|
||||
}
|
||||
{
|
||||
name = "fzf-tab";
|
||||
src = pkgs.zsh-fzf-tab.src;
|
||||
}
|
||||
];
|
||||
|
||||
shellAliases = {
|
||||
ls = "eza --group-directories-first";
|
||||
ll = "eza -l --group-directories-first --git";
|
||||
la = "eza -la --group-directories-first --git";
|
||||
lt = "eza --tree --level=2";
|
||||
cat = "bat --paging=never";
|
||||
grep = "grep --color=auto";
|
||||
gs = "git status -sb";
|
||||
gd = "git diff";
|
||||
gc = "git commit";
|
||||
gp = "git push";
|
||||
ga = "git add -A";
|
||||
gm = "git add -m";
|
||||
gl = "git log --oneline";
|
||||
cleanup = "sudo nix-collect-garbage -d";
|
||||
".." = "cd ..";
|
||||
"..." = "cd ../..";
|
||||
};
|
||||
};
|
||||
|
||||
programs.starship = {
|
||||
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
settings = {
|
||||
add_newline = false;
|
||||
command_timeout = 500;
|
||||
scan_timeout = 10;
|
||||
|
||||
format = lib.concatStrings [
|
||||
"$directory"
|
||||
"$git_branch"
|
||||
"$git_status"
|
||||
"$nix_shell"
|
||||
"$python"
|
||||
"$c"
|
||||
"$rust"
|
||||
"$cmd_duration"
|
||||
"$jobs"
|
||||
"$line_break"
|
||||
"$character"
|
||||
];
|
||||
|
||||
character = {
|
||||
success_symbol = "[❯](bold green)";
|
||||
error_symbol = "[❯](bold red)";
|
||||
vimcmd_symbol = "[❮](bold yellow)";
|
||||
};
|
||||
|
||||
directory = {
|
||||
style = "bold cyan";
|
||||
truncation_length = 3;
|
||||
truncate_to_repo = true;
|
||||
truncation_symbol = "…/";
|
||||
read_only = " 🔒";
|
||||
};
|
||||
|
||||
git_branch = {
|
||||
style = "bold purple";
|
||||
format = "[$symbol$branch]($style) ";
|
||||
symbol = " ";
|
||||
};
|
||||
|
||||
git_status = {
|
||||
style = "bold red";
|
||||
format = "([$all_status$ahead_behind]($style)) ";
|
||||
conflicted = "=";
|
||||
ahead = "⇡\${count}";
|
||||
behind = "⇣\${count}";
|
||||
diverged = "⇕⇡\${ahead_count}⇣\${behind_count}";
|
||||
staged = "+\${count}";
|
||||
modified = "!\${count}";
|
||||
untracked = "?\${count}";
|
||||
stashed = "\$";
|
||||
};
|
||||
|
||||
nix_shell = {
|
||||
style = "bold blue";
|
||||
format = "[$symbol$state( \($name\))]($style) ";
|
||||
symbol = "❄ ";
|
||||
impure_msg = "impure";
|
||||
pure_msg = "pure";
|
||||
};
|
||||
|
||||
python = {
|
||||
style = "bold yellow";
|
||||
format = "[$symbol( \($virtualenv\))]($style) ";
|
||||
symbol = " ";
|
||||
detect_extensions = [ "py" ];
|
||||
detect_files = [
|
||||
"pyproject.toml"
|
||||
"requirements.txt"
|
||||
"uv.lock"
|
||||
];
|
||||
};
|
||||
|
||||
c = {
|
||||
style = "bold dimmed white";
|
||||
format = "[$symbol($version(-$name))]($style) ";
|
||||
symbol = " ";
|
||||
detect_extensions = [
|
||||
"c"
|
||||
"h"
|
||||
];
|
||||
};
|
||||
|
||||
rust = {
|
||||
disabled = true;
|
||||
};
|
||||
|
||||
cmd_duration = {
|
||||
style = "bold yellow";
|
||||
format = "[$duration]($style) ";
|
||||
min_time = 2000;
|
||||
show_notifications = false;
|
||||
};
|
||||
|
||||
jobs = {
|
||||
style = "bold blue";
|
||||
symbol = "✦";
|
||||
number_threshold = 1;
|
||||
};
|
||||
|
||||
aws.disabled = true;
|
||||
gcloud.disabled = true;
|
||||
docker_context.disabled = true;
|
||||
kubernetes.disabled = true;
|
||||
package.disabled = true;
|
||||
battery.disabled = true;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
programs.eza = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
icons = "auto";
|
||||
};
|
||||
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
config = {
|
||||
theme = "ansi";
|
||||
};
|
||||
};
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
enableZshIntegration = true;
|
||||
defaultCommand = "fd --type f --hidden --exclude .git";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -6,15 +6,7 @@
|
|||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.dotfiles.user;
|
||||
in
|
||||
{
|
||||
options.dotfiles.user = {
|
||||
enable = lib.mkEnableOption "User configuration";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
users.users."${userVars.username}" = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
|
|
@ -28,5 +20,4 @@ in
|
|||
home.homeDirectory = "/home/${userVars.username}";
|
||||
home.stateVersion = "26.05";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
232
modules/zsh.nix
Normal file
232
modules/zsh.nix
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
userVars,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
programs.zsh.enable = true;
|
||||
|
||||
users.users."${userVars.username}".shell = pkgs.zsh;
|
||||
|
||||
home-manager.users."${userVars.username}" = {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = false;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
dotDir = "/home/${userVars.username}/.config/zsh";
|
||||
|
||||
initContent = ''
|
||||
# -- GPG / SSH Configuration --
|
||||
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
|
||||
|
||||
# Import Wayland environment to systemd for GUI tools (like pinentry-gnome3)
|
||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
systemctl --user import-environment WAYLAND_DISPLAY DISPLAY DBUS_SESSION_BUS_ADDRESS 2>/dev/null
|
||||
dbus-update-activation-environment --systemd WAYLAND_DISPLAY DISPLAY DBUS_SESSION_BUS_ADDRESS 2>/dev/null
|
||||
fi
|
||||
|
||||
# Automatically start dwl on TTY 1
|
||||
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
|
||||
exec dwl
|
||||
fi
|
||||
'';
|
||||
|
||||
history = {
|
||||
size = 10000;
|
||||
save = 10000;
|
||||
path = "$HOME/.local/share/zsh/history";
|
||||
ignoreDups = true;
|
||||
ignoreAllDups = true;
|
||||
ignoreSpace = true;
|
||||
share = true;
|
||||
extended = true;
|
||||
};
|
||||
|
||||
plugins = [
|
||||
{
|
||||
name = "fast-syntax-highlighting";
|
||||
src = pkgs.zsh-fast-syntax-highlighting.src;
|
||||
}
|
||||
{
|
||||
name = "zsh-autosuggestions";
|
||||
src = pkgs.zsh-autosuggestions.src;
|
||||
}
|
||||
{
|
||||
name = "zsh-history-substring-search";
|
||||
src = pkgs.zsh-history-substring-search.src;
|
||||
}
|
||||
{
|
||||
name = "fzf-tab";
|
||||
src = pkgs.zsh-fzf-tab.src;
|
||||
}
|
||||
];
|
||||
|
||||
shellAliases = {
|
||||
ls = "eza --group-directories-first";
|
||||
ll = "eza -l --group-directories-first --git";
|
||||
la = "eza -la --group-directories-first --git";
|
||||
lt = "eza --tree --level=2";
|
||||
cat = "bat --paging=never";
|
||||
grep = "grep --color=auto";
|
||||
gs = "git status -sb";
|
||||
gd = "git diff";
|
||||
gc = "git commit";
|
||||
gp = "git push";
|
||||
ga = "git add -A";
|
||||
gm = "git add -m";
|
||||
gl = "git log --oneline";
|
||||
cleanup = "sudo nix-collect-garbage -d";
|
||||
".." = "cd ..";
|
||||
"..." = "cd ../..";
|
||||
};
|
||||
};
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
settings = {
|
||||
add_newline = false;
|
||||
command_timeout = 500;
|
||||
scan_timeout = 10;
|
||||
|
||||
format = lib.concatStrings [
|
||||
"$directory"
|
||||
"$git_branch"
|
||||
"$git_status"
|
||||
"$nix_shell"
|
||||
"$python"
|
||||
"$c"
|
||||
"$rust"
|
||||
"$cmd_duration"
|
||||
"$jobs"
|
||||
"$line_break"
|
||||
"$character"
|
||||
];
|
||||
|
||||
character = {
|
||||
success_symbol = "[❯](bold green)";
|
||||
error_symbol = "[❯](bold red)";
|
||||
vimcmd_symbol = "[❮](bold yellow)";
|
||||
};
|
||||
|
||||
directory = {
|
||||
style = "bold cyan";
|
||||
truncation_length = 3;
|
||||
truncate_to_repo = true;
|
||||
truncation_symbol = "…/";
|
||||
read_only = " 🔒";
|
||||
};
|
||||
|
||||
git_branch = {
|
||||
style = "bold purple";
|
||||
format = "[$symbol$branch]($style) ";
|
||||
symbol = " ";
|
||||
};
|
||||
|
||||
git_status = {
|
||||
style = "bold red";
|
||||
format = "([$all_status$ahead_behind]($style)) ";
|
||||
conflicted = "=";
|
||||
ahead = "⇡\${count}";
|
||||
behind = "⇣\${count}";
|
||||
diverged = "⇕⇡\${ahead_count}⇣\${behind_count}";
|
||||
staged = "+\${count}";
|
||||
modified = "!\${count}";
|
||||
untracked = "?\${count}";
|
||||
stashed = "\$";
|
||||
};
|
||||
|
||||
nix_shell = {
|
||||
style = "bold blue";
|
||||
format = "[$symbol$state( \($name\))]($style) ";
|
||||
symbol = "❄ ";
|
||||
impure_msg = "impure";
|
||||
pure_msg = "pure";
|
||||
};
|
||||
|
||||
python = {
|
||||
style = "bold yellow";
|
||||
format = "[$symbol( \($virtualenv\))]($style) ";
|
||||
symbol = " ";
|
||||
detect_extensions = [ "py" ];
|
||||
detect_files = [
|
||||
"pyproject.toml"
|
||||
"requirements.txt"
|
||||
"uv.lock"
|
||||
];
|
||||
};
|
||||
|
||||
c = {
|
||||
style = "bold dimmed white";
|
||||
format = "[$symbol($version(-$name))]($style) ";
|
||||
symbol = " ";
|
||||
detect_extensions = [
|
||||
"c"
|
||||
"h"
|
||||
];
|
||||
};
|
||||
|
||||
rust = {
|
||||
disabled = true;
|
||||
};
|
||||
|
||||
cmd_duration = {
|
||||
style = "bold yellow";
|
||||
format = "[$duration]($style) ";
|
||||
min_time = 2000;
|
||||
show_notifications = false;
|
||||
};
|
||||
|
||||
jobs = {
|
||||
style = "bold blue";
|
||||
symbol = "✦";
|
||||
number_threshold = 1;
|
||||
};
|
||||
|
||||
aws.disabled = true;
|
||||
gcloud.disabled = true;
|
||||
docker_context.disabled = true;
|
||||
kubernetes.disabled = true;
|
||||
package.disabled = true;
|
||||
battery.disabled = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
programs.eza = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
icons = "auto";
|
||||
};
|
||||
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
config = {
|
||||
theme = "ansi";
|
||||
};
|
||||
};
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
enableZshIntegration = true;
|
||||
defaultCommand = "fd --type f --hidden --exclude .git";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue