Make this bitch MODULAR

This commit is contained in:
Javier Feliz 2025-08-13 19:43:40 -04:00
parent f4172e58c7
commit 28eeb1d2f3
37 changed files with 642 additions and 401 deletions

13
flake.lock generated
View File

@ -316,6 +316,18 @@
"url": "https://gitgud.foo/thegrind/hypr-shell.git"
}
},
"my-assets": {
"flake": false,
"locked": {
"path": "./assets",
"type": "path"
},
"original": {
"path": "./assets",
"type": "path"
},
"parent": []
},
"neovim-nightly-overlay": {
"inputs": {
"flake-compat": "flake-compat",
@ -433,6 +445,7 @@
"inputs": {
"home-manager": "home-manager",
"hyprshell": "hyprshell",
"my-assets": "my-assets",
"neovim-nightly-overlay": "neovim-nightly-overlay",
"nixpkgs": "nixpkgs_3",
"stylix": "stylix"

View File

@ -1,6 +1,5 @@
{
description = "Javi's computer configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
home-manager = {
@ -13,28 +12,69 @@
inputs.nixpkgs.follows = "nixpkgs";
};
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
my-assets = {
url = "path:./assets";
flake = false;
};
};
outputs =
{
self,
nixpkgs,
my-assets,
...
}@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
# Common overlays for all hosts
overlays = [
inputs.neovim-nightly-overlay.overlays.default
];
in
{
nixosConfigurations.default = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
# Helper function to create a host configuration
mkHost =
hostname: modules:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit hostname; # Pass hostname to modules
assets = my-assets;
};
modules = [
# Common modules for all hosts
inputs.home-manager.nixosModules.default
inputs.stylix.nixosModules.stylix
./configuration.nix
# Apply overlays to all hosts
(
{ config, pkgs, ... }:
{
nixpkgs.overlays = overlays;
}
)
# Host config
./modules/system/common/fonts.nix
./modules/system/common/xdg.nix
./hosts/${hostname}
]
++ modules; # Additional modules passed to mkHost
};
in
{
nixosConfigurations = {
desktop = mkHost "desktop" [
./modules/system/nvidia.nix
./modules/system/nfs.nix
./modules/system/display-manager/sddm.nix
];
laptop = mkHost "laptop" [
./modules/system/display-manager/sddm.nix
];
};
};

146
home.nix
View File

@ -1,146 +0,0 @@
{
config,
pkgs,
lib,
inputs,
...
}:
{
imports = [
./home/kitty.nix
./home/shell.nix
./home/starship.nix
./home/git.nix
./home/hyprland.nix
./home/util/darkmode.nix
./home/neovim.nix
];
nixpkgs.config.allowUnfree = true;
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "javi";
home.homeDirectory = "/home/javi";
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "25.05"; # Please read the comment before changing.
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = with pkgs; [
# Basics
quickshell
# Terminal tools
yazi
ripgrep
fzf
bat
eza
jq
# Dev tools
jetbrains.datagrip
vscode
nixfmt # Nix formatting
pkgs.libsForQt5.full # QML formatting (for working on quickshell)
# System tools
btop
fastfetch
gnumake
# Langs
php
php84Packages.composer
laravel
go
nodejs_22
bun
];
programs.btop = {
enable = true;
};
programs.yazi = {
enable = true;
keymap = {
manager.prepend_keymap = [
{
on = [
"b"
"g"
];
run = "shell 'hyprctl hyprpaper preload \"$0\" && hyprctl hyprpaper wallpaper \", $0\"'";
desc = "Set as wallpaper";
}
];
};
};
stylix = {
enable = true;
targets = {
btop.enable = true;
};
};
# Environment variables
home.sessionVariables = {
EDITOR = "code";
BROWSER = "brave";
TERMINAL = "kitty";
NVD_BACKEND = "wayland";
OZONE_PLATFORM = "wayland";
OZONE_PLATFORM_HINT = "auto";
XDG_CACHE_HOME = "${config.home.homeDirectory}/.cache";
XDG_CONFIG_HOME = "${config.home.homeDirectory}/.config";
XDG_DATA_HOME = "${config.home.homeDirectory}/.local/share";
XDG_STATE_HOME = "${config.home.homeDirectory}/.local/state";
};
# Configure all the xdg stuff so apps work correctly
xdg = {
enable = true;
# Normal expected directories
userDirs = {
enable = true;
createDirectories = true;
desktop = "${config.home.homeDirectory}/Desktop";
documents = "${config.home.homeDirectory}/Documents";
download = "${config.home.homeDirectory}/Downloads";
music = "${config.home.homeDirectory}/Music";
pictures = "${config.home.homeDirectory}/Pictures";
publicShare = "${config.home.homeDirectory}/Public";
templates = "${config.home.homeDirectory}/Templates";
videos = "${config.home.homeDirectory}/Videos";
};
# TODO: Move the http handler to a browser.nix
# # File/app associations
# mimeApps = {
# enable = true;
# defaultApplications = {
# "text/html" = "brave.desktop";
# "x-scheme-handler/http" = "brave.desktop";
# "x-scheme-handler/https" = "brave.desktop";
# "x-scheme-handler/about" = "brave.desktop";
# "x-scheme-handler/unknown" = "brave.desktop";
# "application/pdf" = "org.gnome.Evince.desktop";
# "text/plain" = "code.desktop";
# "application/json" = "code.desktop";
# "application/javascript" = "code.desktop";
# "text/x-php" = "code.desktop";
# };
# };
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}

View File

@ -1,103 +0,0 @@
{
config,
pkgs,
inputs,
...
}:
{
imports = [
# Configs
./hyprland/binds.nix
# Ecosystem
./hyprland/hyprpaper.nix
# Desktop environment
./hyprland/hyprpanel.nix
./wofi.nix
./hyprland/desktop-env.nix
];
home.packages = with pkgs; [
# Running apps
# wofi
# Notifications
libnotify
# Screenshots
grim
slurp
wl-clipboard
hyprshot
# Desktop env
hyprpanel
# Utility
wl-clipboard
];
# Important for certain apps working
# and dark mode being respected
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-hyprland
];
};
wayland.windowManager.hyprland.enable = true;
wayland.windowManager.hyprland.settings = {
input = {
repeat_delay = 200;
repeat_rate = 20;
};
monitor = [
"DP-5, 3440x1440@179.99, 0x0, 1"
];
general = {
layout = "master";
gaps_out = 0;
gaps_in = 0;
};
workspace = [
"1, persistent:true"
"2, persistent:true"
"3, persistent:true"
"4, persistent:true"
"5, persistent:true"
"6, persistent:true"
];
# Window rules
windowrulev2 = [
"opacity 0.85, class:^(Code)$"
];
decoration = {
blur = {
enabled = false;
size = 8;
passes = 2;
};
active_opacity = 1.0;
inactive_opacity = 1.0;
};
exec-once = [
# "quickshell -c hyprshell"
"hyprpanel"
];
};
wayland.windowManager.hyprland.plugins = [
# inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.hyprbars
];
}

View File

@ -1,53 +0,0 @@
{
inputs,
pkgs,
lib,
config,
...
}:
{
}
# {
# home.packages = with pkgs; [
# papirus-icon-theme
# papirus-folders
# ];
# gtk = {
# enable = true;
# theme = {
# name = "Breeze-Dark";
# package = pkgs.libsForQt5.breeze-gtk;
# };
# iconTheme = {
# name = "Papirus-Dark";
# };
# gtk3 = {
# extraConfig.gtk-application-prefer-dark-theme = true;
# };
# };
# dconf.settings = {
# "org/gnome/desktop/interface" = {
# gtk-theme = "Breeze-Dark";
# color-scheme = "prefer-dark";
# };
# };
# qt = {
# enable = true;
# platformTheme = "gtk";
# style = {
# name = "gtk2";
# package = pkgs.libsForQt5.breeze-qt5;
# };
# };
# # Make Qt apps follow dark mode
# home.sessionVariables = {
# QT_QPA_PLATFORMTHEME = "gtk2";
# QT_STYLE_OVERRIDE = "gtk2";
# };
# }

View File

@ -1,11 +0,0 @@
{
config,
pkgs,
...
}:
{
programs.vscode = {
enable = true;
package = pkgs.vscode;
};
}

210
hosts/desktop/default.nix Executable file
View File

@ -0,0 +1,210 @@
{
config,
pkgs,
inputs,
hostname,
assets,
...
}:
{
imports = [
./hardware-configuration.nix
];
# Bootloader.
boot = {
loader = {
systemd-boot = {
enable = true;
};
efi = {
canTouchEfiVariables = true;
};
};
# Mount my second drive
supportedFilesystems = [ "ntfs" ];
};
networking = {
hostName = hostname;
networkmanager = {
enable = true;
};
};
time = {
timeZone = "America/New_York";
};
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
};
services = {
printing = {
enable = true;
};
# Flatpak is here just for discord pretty much
flatpak = {
enable = true;
};
pulseaudio = {
enable = false;
};
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
openssh = {
enable = true;
};
};
systemd.services.flatpak-repo = {
wantedBy = [ "multi-user.target" ];
path = [ pkgs.flatpak ];
script = ''
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
'';
};
security = {
rtkit = {
enable = true;
};
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
environment = {
systemPackages = with pkgs; [
brave
git
openssh
pkgs.ntfs3g
xdg-user-dirs-gtk # This helps with Nautilus integration
cachix
];
# Set up my user icon
etc = {
"avatars/javi.png".source = "${assets}/user-icon.png";
};
};
# Define a user account. Don't forget to set a password with passwd.
users.users.javi = {
isNormalUser = true;
description = "javi";
shell = pkgs.zsh;
useDefaultShell = true;
extraGroups = [
"networkmanager"
"wheel"
];
};
system = {
stateVersion = "25.05"; # Did you read the comment?
activationScripts.avatar = ''
mkdir -p /var/lib/AccountsService/icons
ln -sf /etc/avatars/javi.png /var/lib/AccountsService/icons/javi
'';
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
nix.settings = {
substituters = [
"https://cache.nixos.org/"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
};
programs = {
hyprland.enable = true;
ssh = {
startAgent = true;
extraConfig = "
Host myhost
Hostname gitgud.foo
";
};
# More thunar support
xfconf = {
enable = true;
};
zsh.enable = true;
};
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# Mount the second drive
fileSystems."/mnt/working-files" = {
device = "/dev/disk/by-uuid/BE8EBBDA8EBB8A03";
fsType = "ntfs";
options = [
"uid=1000" # your user ID (check with `id -u`)
"gid=100" # your primary group ID (check with `id -g`)
"dmask=022" # dir permissions
"fmask=133" # file permissions
"nofail"
# make Nautilus show it with a friendly name/icon
"x-gvfs-show"
"x-gvfs-name=Working Files"
];
};
# Theme
stylix = {
enable = true;
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark.yaml";
# image = "/home/javi/Documents/wallpapers/Fantasy-Mountain.png";
polarity = "dark";
};
# Enable home manager
home-manager = {
extraSpecialArgs = { inherit inputs; };
users = {
"javi" = {
imports = [
../../modules/home/home.nix
];
};
};
};
}

View File

@ -2,26 +2,20 @@
config,
pkgs,
inputs,
hostname,
...
}:
{
imports = [
./hardware-configuration.nix
./system/nvidia.nix
# ./system/de/gdm.nix
./system/de/sddm.nix
./system/de/hypr/hyprland.nix
./system/nfs.nix
./system/fonts.nix
inputs.home-manager.nixosModules.default
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.hostName = hostname;
networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";

View File

@ -14,7 +14,7 @@
shellAliases = {
sudo = "sudo ";
# Nix
rb = "git add . && sudo nixos-rebuild switch --flake $HOME/nix#default";
rb = "git add . && sudo nixos-rebuild switch --flake $HOME/nix#desktop";
eza = "eza";
ls = "eza -lh --group-directories-first --icons";

View File

@ -0,0 +1,23 @@
{
config,
pkgs,
inputs,
...
}:
{
programs.yazi = {
enable = true;
keymap = {
manager.prepend_keymap = [
{
on = [
"b"
"g"
];
run = "shell 'hyprctl hyprpaper preload \"$0\" && hyprctl hyprpaper wallpaper \", $0\"'";
desc = "Set as wallpaper";
}
];
};
};
}

View File

@ -9,6 +9,8 @@
./gnome/keybinds.nix
];
window
home.packages = with pkgs; [
gnomeExtensions.blur-my-shell
gnomeExtensions.dash-to-dock

128
modules/home/home.nix Executable file
View File

@ -0,0 +1,128 @@
{
config,
pkgs,
lib,
inputs,
...
}:
{
imports = [
./common/git.nix
./common/kitty.nix
./common/neovim.nix
./common/shell.nix
./common/starship.nix
./common/yazi.nix
./hyprland
];
nixpkgs.config.allowUnfree = true;
# gtk = {
# enable = true;
# iconTheme = {
# name = "Papirus";
# package = pkgs.papirus-icon-theme;
# };
# };
home = {
username = "javi";
homeDirectory = "/home/javi";
stateVersion = "25.05"; # Home manager version. Do not update carelessly
packages = with pkgs; [
# Basics
quickshell
# Terminal tools
ripgrep
fzf
bat
eza
jq
# Dev tools
jetbrains.datagrip
vscode
nixfmt # Nix formatting
pkgs.libsForQt5.full # QML formatting (for working on quickshell)
# System tools
btop
fastfetch
gnumake
# Langs
php
php84Packages.composer
laravel
go
nodejs_22
bun
];
sessionVariables = {
EDITOR = "code";
BROWSER = "brave";
TERMINAL = "kitty";
NVD_BACKEND = "wayland";
OZONE_PLATFORM = "wayland";
OZONE_PLATFORM_HINT = "auto";
XDG_CACHE_HOME = "${config.home.homeDirectory}/.cache";
XDG_CONFIG_HOME = "${config.home.homeDirectory}/.config";
XDG_DATA_HOME = "${config.home.homeDirectory}/.local/share";
XDG_STATE_HOME = "${config.home.homeDirectory}/.local/state";
};
};
# Programs home manager should manage
programs = {
btop = {
enable = true;
};
};
stylix = {
enable = true;
targets = {
btop.enable = true;
};
};
xdg = {
# Normal expected directories
userDirs = {
enable = true;
createDirectories = true;
desktop = "${config.home.homeDirectory}/Desktop";
documents = "${config.home.homeDirectory}/Documents";
download = "${config.home.homeDirectory}/Downloads";
music = "${config.home.homeDirectory}/Music";
pictures = "${config.home.homeDirectory}/Pictures";
publicShare = "${config.home.homeDirectory}/Public";
templates = "${config.home.homeDirectory}/Templates";
videos = "${config.home.homeDirectory}/Videos";
};
# TODO: Move the http handler to a browser.nix
# # File/app associations
# mimeApps = {
# enable = true;
# defaultApplications = {
# "text/html" = "brave.desktop";
# "x-scheme-handler/http" = "brave.desktop";
# "x-scheme-handler/https" = "brave.desktop";
# "x-scheme-handler/about" = "brave.desktop";
# "x-scheme-handler/unknown" = "brave.desktop";
# "application/pdf" = "org.gnome.Evince.desktop";
# "text/plain" = "code.desktop";
# "application/json" = "code.desktop";
# "application/javascript" = "code.desktop";
# "text/x-php" = "code.desktop";
# };
# };
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}

View File

Before

Width:  |  Height:  |  Size: 7.3 MiB

After

Width:  |  Height:  |  Size: 7.3 MiB

View File

@ -33,7 +33,7 @@
# "$mod ALT, p, exec, $terminal --start-as=normal -- bash -ic 'proj'"
"$mod ALT, p, exec, eza -ld $HOME/projects/* --color=never | awk '{print $7}' | wofi --dmenu --prompt \"Open project:\" | xargs -I{} code {} -n && exit"
"$mod, RETURN, exec, $webapphttps://chatgpt.com"
"$mod, RETURN, exec, $webapphttps://claude.ai"
# Window and workspace navigation
# Move between windows with vim keys

View File

@ -0,0 +1,114 @@
{
config,
pkgs,
inputs,
...
}:
{
imports = [
./binds.nix
./hyprpaper.nix
./hyprpanel.nix
./wofi.nix
./desktop-env.nix
];
home = {
sessionVariables = {
NIXOS_OZON_WL = "1";
};
packages = with pkgs; [
# Notifications
libnotify
# Screenshots
grim
slurp
wl-clipboard
hyprshot
# Desktop env
hyprpanel
# Utility
wl-clipboard
];
};
# Important for certain apps working
# and dark mode being respected
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-hyprland
];
};
gtk = {
enable = true;
iconTheme = {
name = "Papirus";
package = pkgs.papirus-icon-theme;
};
};
wayland.windowManager.hyprland = {
enable = true;
settings = {
input = {
repeat_delay = 200;
repeat_rate = 20;
};
monitor = [
"DP-5, 3440x1440@179.99, 0x0, 1"
];
general = {
layout = "master";
gaps_out = 0;
gaps_in = 0;
};
workspace = [
"1, persistent:true"
"2, persistent:true"
"3, persistent:true"
"4, persistent:true"
"5, persistent:true"
"6, persistent:true"
];
# Window rules
windowrulev2 = [
"opacity 0.85, class:^(Code)$"
];
decoration = {
blur = {
enabled = false;
size = 8;
passes = 2;
};
active_opacity = 1.0;
inactive_opacity = 1.0;
};
exec-once = [
# "quickshell -c hyprshell"
"hyprpanel"
];
};
plugins = [
# inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.hyprbars
];
};
}

View File

@ -98,10 +98,14 @@
"application/x-rar" = "org.kde.ark.desktop";
# Directory
"inode/directory" = "org.kde.dolphin.desktop";
"inode/directory" = "thunar.desktop";
};
};
home.sessionVariables = {
FILE_MANAGER = "thunar";
};
# Configure specific programs
programs = {
# Configure mpv for advanced video playback

View File

@ -0,0 +1,20 @@
{
config,
pkgs,
lib,
inputs,
...
}:
{
# Configure all the xdg stuff so apps work correctly
xdg = {
portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-hyprland
];
};
};
}

View File

@ -0,0 +1,63 @@
{
config,
pkgs,
inputs,
assets,
...
}:
let
basePath = "/home/javi/Documents/wallpapers";
wallpaper = "Fantasy-Mountain.png";
in
{
environment = {
etc = {
"sddm-wallpaper.png".source = "${assets}/sddm-background.png";
"gtk-3.0/settings.ini".text = ''
[Settings]
gtk-icon-theme-name=Papirus
gtk-theme-name=Adwaita
gtk-cursor-theme-name=Adwaita
'';
};
systemPackages = with pkgs; [
papirus-icon-theme
(sddm-chili-theme.override {
themeConfig = {
background = "/etc/sddm-wallpaper.png";
ScreenWidth = "3440";
ScreenHeight = "1440";
recursiveBlurLoops = 1;
recursiveBlurRadius = 10;
};
})
libsForQt5.qt5.qtgraphicaleffects
];
pathsToLink = [
"/share/icons"
];
variables = {
GTK_ICON_THEME = "Papirus";
};
};
programs.dconf.enable = true;
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
theme = "chili";
autoNumlock = true;
package = pkgs.libsForQt5.sddm;
extraPackages = with pkgs.libsForQt5.qt5; [
qtgraphicaleffects
qtquickcontrols2
qtquickcontrols
qtsvg
qtdeclarative # QtQuick core
];
};
}

View File

@ -33,7 +33,16 @@ let
in
{
services.gvfs.enable = true;
services.udisks2.enable = true;
# Enable NFS client support
boot.supportedFilesystems = [ "nfs" ];
services = {
rpcbind.enable = true; # Required for NFS
gvfs.enable = true;
udisks2.enable = true;
};
fileSystems = fsConfig;
# # Optional: Create mount directories
# systemd.tmpfiles.rules = map (share: "d /mnt/${share} 0755 root root -") shares;
}

1
result
View File

@ -1 +0,0 @@
/nix/store/cy863mrchnaj8v0y419jc7hnwrll43z9-walker-0.13.14

View File

@ -1,16 +0,0 @@
{
config,
pkgs,
inputs,
...
}:
{
# Install hyprland and all the stuff it needs
programs.hyprland.enable = true;
environment.sessionVariables.NIXOS_OZON_WL = "1";
environment.systemPackages = with pkgs; [
hyprlock
];
}

View File

@ -1,49 +0,0 @@
{
config,
pkgs,
inputs,
...
}:
let
basePath = "/home/javi/Documents/wallpapers";
wallpaper = "Fantasy-Mountain.png";
in
{
environment.etc."sddm-wallpaper.png".source = ../../assets/sddm-background.png;
environment.systemPackages = with pkgs; [
(sddm-chili-theme.override {
themeConfig = {
background = "/etc/sddm-wallpaper.png";
ScreenWidth = "3440";
ScreenHeight = "1440";
recursiveBlurLoops = 1;
recursiveBlurRadius = 10;
};
})
libsForQt5.qt5.qtgraphicaleffects
papirus-icon-theme
];
programs.dconf.enable = true;
environment.etc."gtk-3.0/settings.ini".text = ''
[Settings]
gtk-icon-theme-name=Papirus
gtk-theme-name=Adwaita
gtk-cursor-theme-name=Adwaita
'';
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
theme = "chili";
autoNumlock = true;
package = pkgs.libsForQt5.sddm;
extraPackages = with pkgs.libsForQt5.qt5; [
qtgraphicaleffects
qtquickcontrols2
qtquickcontrols
qtsvg
qtdeclarative # QtQuick core
];
};
}