refactor: moved home config to more logical folder structure

This commit is contained in:
Mohammad Rafiq 2025-03-07 13:07:41 +08:00
parent f201190ef1
commit ecaa2c0dc4
29 changed files with 165 additions and 171 deletions

View file

@ -26,7 +26,7 @@
extraSpecialArgs = args;
# Add the users
users.rafiq.imports = [
./users/rafiq
./users/rafiq.nix
];
};
}

10
users/modules/de.nix Normal file
View file

@ -0,0 +1,10 @@
# Default graphical programs and personalisation
{
imports = [
./programs/firefox.nix
./programs/font-terminess.nix
./programs/kitty.nix
./programs/hyprland.nix
./programs/waybar.nix
];
}

View file

@ -0,0 +1,10 @@
{
programs.bash = {
enable = true;
shellAliases = {
rebuild = "sudo nixos-rebuild switch --flake";
gs = "git status";
ai = "aichat -r %shell% -e";
};
};
}

View file

@ -0,0 +1,9 @@
{
# direnv lets us declare a .envrc in each project directory
# and updates the shell with the packages specified.
programs.direnv = {
enable = true;
enableBashIntegration = true;
nix-direnv.enable = true;
};
}

View file

@ -0,0 +1,5 @@
{
programs.firefox = {
enable = true;
};
}

View file

@ -0,0 +1,7 @@
{
programs.fzf = {
enable = true;
enableBashIntegration = true;
tmux.enableShellIntegration = true;
};
}

View file

@ -80,14 +80,4 @@
};
};
};
programs.waybar = {
enable = true;
settings = {
mainBar = {
layer = "top";
};
};
style = ''
'';
};
}

View file

@ -0,0 +1,14 @@
{
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
extraLuaConfig = ''
vim.opt.shiftwidth = 2;
vim.opt.number = true;
vim.opt.relativenumber = true;
'';
};
}

View file

@ -0,0 +1,9 @@
{
# starship is a customisable prompt for any shell
programs.starship = {
enable = true;
enableBashIntegration = true;
settings = {
};
};
}

View file

@ -0,0 +1,7 @@
{
# man page summaries (activate with tldr <command>)
programs.tealdeer = {
enable = true;
enableAutoUpdates = true;
};
}

View file

@ -0,0 +1,27 @@
{ pkgs, ... }: {
# Terminal Multiplexing
programs.tmux = {
enable = true;
plugins = with pkgs.tmuxPlugins; [
catppuccin
# Session Management between Reboots
{
plugin = resurrect;
extraConfig = ''
set -g @resurrect-strategy-nvim 'session'
'';
}
{
plugin = continuum;
extraConfig = ''
set -g @continuum-restore 'on'
'';
}
];
extraConfig = ''
set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"
'';
};
}

View file

@ -0,0 +1,12 @@
{
programs.waybar = {
enable = true;
settings = {
mainBar = {
layer = "top";
};
};
style = ''
'';
};
}

View file

@ -0,0 +1,6 @@
{
programs.yazi = {
enable = true;
enableBashIntegration = true;
};
}

15
users/modules/sh.nix Normal file
View file

@ -0,0 +1,15 @@
# Default shell utilities and programs
{
imports = [
./programs/bash.nix
./programs/direnv.nix
./programs/fzf.nix
./programs/git.nix
./programs/nvim.nix
./programs/starship.nix
./programs/tealdeer.nix
./programs/tmux.nix
./programs/yazi.nix
./scripts
];
}

13
users/modules/utils.nix Normal file
View file

@ -0,0 +1,13 @@
{pkgs, ...}: {
home.packages = with pkgs; [
fastfetch # system info
wl-clipboard # provides cli copy and paste commands
aichat # duh
];
services = {
# clipboard history (depends on wl-clipboard)
cliphist.enable = true;
};
}

20
users/rafiq.nix Normal file
View file

@ -0,0 +1,20 @@
{ pkgs, ... }: {
imports = [
./modules/sh.nix
./modules/de.nix
./modules/utils.nix
];
# This enables using home-manager from the command line.
programs.home-manager.enable = true;
home = {
username = "rafiq";
homeDirectory = "/home/rafiq";
# This defines the version home-manager
# was originally bulit against on this system.
# Do not change it.
stateVersion = "25.05";
};
}

View file

@ -1,3 +0,0 @@
vim.opt.shiftwidth = 2;
vim.opt.number = true;
vim.opt.relativenumber = true;

View file

@ -1,26 +0,0 @@
{ pkgs, ... }: {
imports = [
./modules/git.nix # git specific configs
./modules/sh.nix # bash and other shell specific configs
./modules/nvim.nix # nvim specific configs
./modules/terminal.nix # terminal emulator configs
./modules/firefox.nix # firefox configs
./modules/hyprland.nix # hyprland settings
./modules/fonts.nix # font settings
./modules/utils.nix # miscellaneous utilities
./scripts
];
# This enables using home-manager from the command line.
programs.home-manager.enable = true;
home = {
username = "rafiq";
homeDirectory = "/home/rafiq";
# This defines the version home-manager
# was originally bulit against on this system.
# Do not change it.
stateVersion = "25.05";
};
}

View file

@ -1,7 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
firefox
];
}

View file

@ -1,12 +0,0 @@
{ config, lib, ... }: let
nvimPath = "${config.home.homeDirectory}/repos/dotfiles/users/rafiq/.config/nvim";
in {
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
};
xdg.configFile."nvim".source = config.lib.file.mkOutOfStoreSymlink nvimPath;
}

View file

@ -1,54 +0,0 @@
{pkgs, ...}: {
programs = {
bash = {
enable = true;
shellAliases = {
rebuild = "sudo nixos-rebuild switch --flake";
gs = "git status";
ai = "aichat -r %shell% -e";
};
};
# direnv lets us declare a .envrc in each project directory
# and updates the shell with the packages specified.
direnv = {
enable = true;
enableBashIntegration = true;
nix-direnv.enable = true;
};
# starship is a customisable prompt for any shell
starship = {
enable = true;
enableBashIntegration = true;
settings = {
};
};
# Terminal Multiplexing
tmux = {
enable = true;
plugins = with pkgs.tmuxPlugins; [
catppuccin
# Session Management between Reboots
{
plugin = resurrect;
extraConfig = ''
set -g @resurrect-strategy-nvim 'session'
'';
}
{
plugin = continuum;
extraConfig = ''
set -g @continuum-restore 'on'
'';
}
];
extraConfig = ''
set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"
'';
};
};
}

View file

@ -1,31 +0,0 @@
{pkgs, ...}: {
# TODO: Move wayland-specific stuff to a wayland config
home.packages = with pkgs; [
fastfetch # system info
wl-clipboard # provides cli copy and paste commands
aichat # duh
];
programs = {
# man page summaries (activate with tldr <command>)
tealdeer = {
enable = true;
enableAutoUpdates = true;
};
fzf = {
enable = true;
enableBashIntegration = true;
tmux.enableShellIntegration = true;
};
yazi = {
enable = true;
enableBashIntegration = true;
};
};
services = {
# clipboard history (depends on wl-clipboard)
cliphist.enable = true;
};
}

View file

@ -1,27 +0,0 @@
{
wayland.windowManager.hyprland = {
enable = true;
systemd.enable = false; # Required for UWSM compat
systemd.variables = ["--all"];
# Use tha packages defined in the system configuration
package = null;
portalPackage = null;
settings = {
monitor = [
"HDMI-A-2, 3840x2160@60, 0x0, 2"
"DP-4, 1920x1080@60, -1920x0, 1"
", preferred, auto, 1"
];
"$terminal" = "kitty";
"$browser" = "firefox";
"$mainMod" = "SUPER";
bind = [
"$mainMod, Q, exec, uwsm app -- $terminal"
"$mainMod, W, killactive"
"$mainMod, E, exec, uwsm app -- $browser"
"$mainMod, M, exec, uwsm stop"
];
debug.disable_logs = false;
};
};
}