initial commit
This commit is contained in:
13
modules/home/configs.nix
Normal file
13
modules/home/configs.nix
Normal file
@@ -0,0 +1,13 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
xdg.configFile = {
|
||||
"alacritty".source = ../../config/alacritty;
|
||||
"btop".source = ../../config/btop;
|
||||
"chromium".source = ../../config/chromium;
|
||||
"fastfetch".source = ../../config/fastfetch;
|
||||
"kitty".source = ../../config/kitty;
|
||||
"swayosd".source = ../../config/swayosd;
|
||||
"xdg-terminals.list".source = ../../config/xdg-terminals.list;
|
||||
};
|
||||
}
|
||||
35
modules/home/default.nix
Normal file
35
modules/home/default.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
{ config, pkgs, inputs, lib, ... }:
|
||||
|
||||
let
|
||||
palettes = import ../../themes/nomarchy-palettes.nix;
|
||||
# Reads the state file. If it doesn't exist, defaults to dracula.
|
||||
stateFile = "${config.home.homeDirectory}/.config/home-manager/theme-state.nix";
|
||||
activeThemeName = if builtins.pathExists stateFile then
|
||||
lib.removeSuffix "\n" (builtins.readFile stateFile)
|
||||
else "dracula";
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.nix-colors.homeManagerModules.default
|
||||
inputs.walker.homeManagerModules.default
|
||||
./fonts.nix
|
||||
./stylix.nix
|
||||
./hyprland.nix
|
||||
./waybar.nix
|
||||
./walker.nix
|
||||
./theme-switcher.nix
|
||||
./scripts.nix
|
||||
./configs.nix
|
||||
];
|
||||
|
||||
colorScheme = palettes.${activeThemeName} or palettes.dracula;
|
||||
|
||||
home.packages = with pkgs; [
|
||||
alacritty
|
||||
];
|
||||
|
||||
home.shellAliases = {
|
||||
sys-update = "sudo nixos-rebuild switch --flake /etc/nixos#default";
|
||||
env-update = "home-manager switch --flake /etc/nixos#default --impure";
|
||||
};
|
||||
}
|
||||
17
modules/home/fonts.nix
Normal file
17
modules/home/fonts.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
stateFile = "${config.home.homeDirectory}/.config/home-manager/font-state.nix";
|
||||
activeFont = if builtins.pathExists stateFile then
|
||||
lib.removeSuffix "\n" (builtins.readFile stateFile)
|
||||
else "JetBrainsMono Nerd Font";
|
||||
in
|
||||
{
|
||||
options.nomarchy.fonts = {
|
||||
monospace = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = activeFont;
|
||||
description = "Monospace font for the system";
|
||||
};
|
||||
};
|
||||
}
|
||||
31
modules/home/hyprland.nix
Normal file
31
modules/home/hyprland.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
wallpaperStateFile = "${config.home.homeDirectory}/.config/home-manager/wallpaper-state.nix";
|
||||
activeWallpaper = if builtins.pathExists wallpaperStateFile then
|
||||
lib.removeSuffix "\n" (builtins.readFile wallpaperStateFile)
|
||||
else "";
|
||||
in
|
||||
{
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
settings = {
|
||||
"general" = {
|
||||
"col.active_border" = "rgb(${config.colorScheme.palette.base0E})";
|
||||
"col.inactive_border" = "rgb(${config.colorScheme.palette.base03})";
|
||||
};
|
||||
"exec-once" = [
|
||||
"swww init && swww fill ${activeWallpaper}"
|
||||
"nomarchy-welcome"
|
||||
];
|
||||
"bind" = [
|
||||
"SUPER ALT, Space, exec, nomarchy-theme-selector"
|
||||
"SUPER CTRL, Space, exec, nomarchy-font-selector"
|
||||
"SUPER SHIFT, Space, exec, nomarchy-wallpaper-selector"
|
||||
"SUPER, Return, exec, alacritty"
|
||||
"SUPER, Q, killactive,"
|
||||
"SUPER, M, exit,"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
40
modules/home/scripts.nix
Normal file
40
modules/home/scripts.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
# Core dependencies needed by most Nomarchy scripts
|
||||
nomarchy-deps = with pkgs; [
|
||||
gum
|
||||
hyprland
|
||||
procps
|
||||
libnotify
|
||||
coreutils
|
||||
gnused
|
||||
gnugrep
|
||||
pciutils
|
||||
findutils
|
||||
jq
|
||||
swww
|
||||
xmlstarlet
|
||||
# Add any others commonly used in bin/
|
||||
];
|
||||
|
||||
nomarchy-scripts = pkgs.stdenv.mkDerivation {
|
||||
pname = "nomarchy-scripts";
|
||||
version = "1.0.0";
|
||||
src = ../../bin;
|
||||
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp -r * $out/bin/
|
||||
|
||||
# Wrap every script to ensure dependencies are in PATH
|
||||
find $out/bin -type f -exec wrapProgram {} \
|
||||
--prefix PATH : ${lib.makeBinPath nomarchy-deps} \;
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
home.packages = [ nomarchy-scripts ];
|
||||
}
|
||||
72
modules/home/stylix.nix
Normal file
72
modules/home/stylix.nix
Normal file
@@ -0,0 +1,72 @@
|
||||
{ config, pkgs, inputs, lib, ... }:
|
||||
|
||||
let
|
||||
# Re-use our state-based logic
|
||||
palettes = import ../../themes/nomarchy-palettes.nix;
|
||||
|
||||
themeStateFile = "${config.home.homeDirectory}/.config/home-manager/theme-state.nix";
|
||||
activeThemeName = if builtins.pathExists themeStateFile then
|
||||
lib.removeSuffix "\n" (builtins.readFile themeStateFile)
|
||||
else "dracula";
|
||||
|
||||
wallpaperStateFile = "${config.home.homeDirectory}/.config/home-manager/wallpaper-state.nix";
|
||||
activeWallpaper = if builtins.pathExists wallpaperStateFile then
|
||||
lib.removeSuffix "\n" (builtins.readFile wallpaperStateFile)
|
||||
else "${../../themes/catppuccin/backgrounds/1-totoro.png}"; # Fallback
|
||||
|
||||
# Map nix-colors palette to a format Stylix expects (attrset of hex strings)
|
||||
currentPalette = (palettes.${activeThemeName} or palettes.dracula).palette;
|
||||
in
|
||||
{
|
||||
imports = [ inputs.stylix.homeModules.stylix ];
|
||||
|
||||
stylix = {
|
||||
enable = true;
|
||||
image = activeWallpaper;
|
||||
base16Scheme = currentPalette;
|
||||
|
||||
# Force dark/light mode based on theme name if possible, or just default to dark
|
||||
polarity = if lib.strings.hasInfix "light" activeThemeName then "light" else "dark";
|
||||
|
||||
cursor = {
|
||||
package = pkgs.bibata-cursors;
|
||||
name = "Bibata-Modern-Ice";
|
||||
size = 24;
|
||||
};
|
||||
|
||||
fonts = {
|
||||
monospace = {
|
||||
package = pkgs.nerd-fonts.jetbrains-mono;
|
||||
name = config.nomarchy.fonts.monospace;
|
||||
};
|
||||
sansSerif = {
|
||||
package = pkgs.dejavu_fonts;
|
||||
name = "DejaVu Sans";
|
||||
};
|
||||
serif = {
|
||||
package = pkgs.dejavu_fonts;
|
||||
name = "DejaVu Serif";
|
||||
};
|
||||
emoji = {
|
||||
package = pkgs.noto-fonts-color-emoji;
|
||||
name = "Noto Color Emoji";
|
||||
};
|
||||
sizes = {
|
||||
applications = 11;
|
||||
terminal = 11;
|
||||
desktop = 11;
|
||||
popups = 11;
|
||||
};
|
||||
};
|
||||
|
||||
# Enable theming for specific targets
|
||||
targets = {
|
||||
hyprland.enable = false; # We keep our custom hyprland config for borders/rules
|
||||
waybar.enable = false; # We keep our custom waybar CSS
|
||||
alacritty.enable = true;
|
||||
kitty.enable = true;
|
||||
gtk.enable = true;
|
||||
gnome.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
67
modules/home/theme-switcher.nix
Normal file
67
modules/home/theme-switcher.nix
Normal file
@@ -0,0 +1,67 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
palettes = import ../../themes/nomarchy-palettes.nix;
|
||||
themeNames = builtins.attrNames palettes;
|
||||
themeList = builtins.concatStringsSep "\\n" themeNames;
|
||||
|
||||
nomarchy-theme-selector = pkgs.writeShellScriptBin "nomarchy-theme-selector" ''
|
||||
STATE_DIR="$HOME/.config/home-manager"
|
||||
THEME_STATE_FILE="$STATE_DIR/theme-state.nix"
|
||||
WALLPAPER_STATE_FILE="$STATE_DIR/wallpaper-state.nix"
|
||||
THEMES_DIR="/etc/nixos/themes" # This depends on where the repo is cloned
|
||||
|
||||
mkdir -p "$STATE_DIR"
|
||||
|
||||
SELECTED_THEME=$(echo -e "${themeList}" | walker --dmenu)
|
||||
|
||||
if [ -n "$SELECTED_THEME" ]; then
|
||||
echo "$SELECTED_THEME" > "$THEME_STATE_FILE"
|
||||
|
||||
# Try to find a background for this theme
|
||||
BG_DIR="$THEMES_DIR/$SELECTED_THEME/backgrounds"
|
||||
if [ -d "$BG_DIR" ]; then
|
||||
BG=$(ls "$BG_DIR" | head -n 1)
|
||||
if [ -n "$BG" ]; then
|
||||
echo "$BG_DIR/$BG" > "$WALLPAPER_STATE_FILE"
|
||||
fi
|
||||
fi
|
||||
|
||||
env-update
|
||||
fi
|
||||
'';
|
||||
nomarchy-font-selector = pkgs.writeShellScriptBin "nomarchy-font-selector" ''
|
||||
STATE_DIR="$HOME/.config/home-manager"
|
||||
STATE_FILE="$STATE_DIR/font-state.nix"
|
||||
|
||||
mkdir -p "$STATE_DIR"
|
||||
|
||||
# Simple list of common nerd fonts, could be expanded
|
||||
FONTS="JetBrainsMono Nerd Font\nRobotoMono Nerd Font\nFiraCode Nerd Font\nUbuntuMono Nerd Font"
|
||||
SELECTED_FONT=$(echo -e "$FONTS" | walker --dmenu)
|
||||
|
||||
if [ -n "$SELECTED_FONT" ]; then
|
||||
echo "$SELECTED_FONT" > "$STATE_FILE"
|
||||
env-update
|
||||
fi
|
||||
'';
|
||||
nomarchy-wallpaper-selector = pkgs.writeShellScriptBin "nomarchy-wallpaper-selector" ''
|
||||
STATE_DIR="$HOME/.config/home-manager"
|
||||
WALLPAPER_STATE_FILE="$STATE_DIR/wallpaper-state.nix"
|
||||
THEMES_DIR="/etc/nixos/themes"
|
||||
|
||||
mkdir -p "$STATE_DIR"
|
||||
|
||||
# List all images in all themes backgrounds
|
||||
WALLPAPERS=$(find "$THEMES_DIR" -type f \( -name "*.jpg" -o -name "*.png" \))
|
||||
SELECTED_WP=$(echo -e "$WALLPAPERS" | walker --dmenu)
|
||||
|
||||
if [ -n "$SELECTED_WP" ]; then
|
||||
echo "$SELECTED_WP" > "$WALLPAPER_STATE_FILE"
|
||||
env-update
|
||||
fi
|
||||
'';
|
||||
in
|
||||
{
|
||||
home.packages = [ nomarchy-theme-selector nomarchy-font-selector nomarchy-wallpaper-selector ];
|
||||
}
|
||||
30
modules/home/walker.nix
Normal file
30
modules/home/walker.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.walker = {
|
||||
enable = true;
|
||||
runAsService = true;
|
||||
config = {
|
||||
theme = "nomarchy";
|
||||
ui = {
|
||||
anchors = {
|
||||
top = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
themes."nomarchy" = {
|
||||
style = ''
|
||||
* {
|
||||
color: #${config.colorScheme.palette.base05};
|
||||
}
|
||||
#window {
|
||||
background-color: #${config.colorScheme.palette.base00};
|
||||
}
|
||||
.item.active {
|
||||
background-color: #${config.colorScheme.palette.base03};
|
||||
color: #${config.colorScheme.palette.base0B};
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
82
modules/home/waybar.nix
Normal file
82
modules/home/waybar.nix
Normal file
@@ -0,0 +1,82 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
style = ''
|
||||
* {
|
||||
background-color: #${config.colorScheme.palette.base00};
|
||||
color: #${config.colorScheme.palette.base05};
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
min-height: 0;
|
||||
font-family: '${config.nomarchy.fonts.monospace}';
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.modules-left { margin-left: 8px; }
|
||||
.modules-right { margin-right: 8px; }
|
||||
|
||||
#workspaces button {
|
||||
all: initial;
|
||||
padding: 0 6px;
|
||||
margin: 0 1.5px;
|
||||
min-width: 9px;
|
||||
color: #${config.colorScheme.palette.base04};
|
||||
}
|
||||
|
||||
#workspaces button.focused, #workspaces button.active {
|
||||
color: #${config.colorScheme.palette.base0B};
|
||||
}
|
||||
|
||||
#workspaces button.empty { opacity: 0.5; }
|
||||
|
||||
#cpu, #battery, #pulseaudio, #custom-nomarchy, #custom-update {
|
||||
min-width: 12px;
|
||||
margin: 0 7.5px;
|
||||
}
|
||||
|
||||
#tray { margin-right: 16px; }
|
||||
#bluetooth { margin-right: 17px; }
|
||||
'';
|
||||
settings = [{
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 26;
|
||||
spacing = 0;
|
||||
modules-left = [ "custom/nomarchy" "hyprland/workspaces" ];
|
||||
modules-center = [ "clock" "custom/update" "custom/voxtype" "custom/screenrecording-indicator" "custom/idle-indicator" "custom/notification-silencing-indicator" ];
|
||||
modules-right = [ "group/tray-expander" "bluetooth" "network" "pulseaudio" "cpu" "battery" ];
|
||||
"custom/nomarchy" = {
|
||||
format = "<span font='nomarchy'>\ue900</span>";
|
||||
on-click = "nomarchy-menu";
|
||||
on-click-right = "xdg-terminal-exec";
|
||||
tooltip-format = "Nomarchy Menu\n\nSuper + Alt + Space";
|
||||
};
|
||||
"hyprland/workspaces" = {
|
||||
on-click = "activate";
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
default = "";
|
||||
active = "";
|
||||
};
|
||||
};
|
||||
"clock" = {
|
||||
format = "{:%H:%M}";
|
||||
};
|
||||
"battery" = {
|
||||
format = "{icon} {capacity}%";
|
||||
format-icons = ["" "" "" "" ""];
|
||||
};
|
||||
"pulseaudio" = {
|
||||
format = "{icon} {volume}%";
|
||||
format-icons = ["" "" ""];
|
||||
};
|
||||
"network" = {
|
||||
format-wifi = " {essid}";
|
||||
format-ethernet = " {ipaddr}";
|
||||
format-disconnected = "⚠ Disconnected";
|
||||
};
|
||||
}];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user