Complete NixOS rewrite: Transform Omarchy from Arch to declarative NixOS

- Replace shell script-based Arch installation with declarative NixOS configuration
- Implement flake-based architecture for reproducible builds
- Add modular system with feature flags (Docker, gaming, development, etc.)
- Create declarative theme system with Tokyo Night and Catppuccin
- Convert utility scripts to Nix packages with proper derivations
- Add comprehensive development environments (Rust, Go, Python, Node.js, C/C++)
- Implement Home Manager integration for user environment management
- Add interactive installer with theme selection and feature configuration
- Update documentation for NixOS-specific workflows and commands
- Provide atomic updates with rollback capability

This maintains all aesthetic and functional benefits of original Omarchy
while gaining NixOS power: reproducibility, version control, and atomic updates.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
theArctesian
2025-09-24 13:59:37 -07:00
parent 2df8c5f7e0
commit aa9c8b4ac4
673 changed files with 4761 additions and 11886 deletions

310
modules/core.nix Normal file
View File

@@ -0,0 +1,310 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.omarchy;
in
{
options.omarchy = {
enable = mkEnableOption "Omarchy system configuration";
user = mkOption {
type = types.str;
default = "user";
description = "Primary user for the system";
};
theme = mkOption {
type = types.enum [ "tokyo-night" "catppuccin" "gruvbox" "nord" "everforest" "rose-pine" "kanagawa" ];
default = "tokyo-night";
description = "System theme";
};
features = {
docker = mkEnableOption "Docker container support";
development = mkEnableOption "Development tools and environments";
gaming = mkEnableOption "Gaming support (Steam, Wine, etc.)";
multimedia = mkEnableOption "Multimedia applications";
};
};
config = mkIf cfg.enable {
# Basic system configuration
system.autoUpgrade = {
enable = true;
flake = "/etc/nixos#omarchy";
flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ];
dates = "weekly";
};
# Enable documentation
documentation = {
enable = true;
man.enable = true;
dev.enable = cfg.features.development;
};
# Security settings
security = {
sudo = {
enable = true;
wheelNeedsPassword = true;
extraRules = [
{
groups = [ "wheel" ];
commands = [
{
command = "/run/current-system/sw/bin/nixos-rebuild";
options = [ "NOPASSWD" ];
}
];
}
];
};
polkit.enable = true;
};
# System services
services = {
# Enable SSH daemon
openssh = {
enable = true;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
};
# Enable fstrim for SSD
fstrim.enable = true;
# Enable thermald for thermal management
thermald.enable = true;
# Enable power management
power-profiles-daemon.enable = true;
upower.enable = true;
# Enable bluetooth
blueman.enable = true;
# Enable GVFS for mounting
gvfs.enable = true;
# Enable Avahi for network discovery
avahi = {
enable = true;
nssmdns4 = true;
publish = {
enable = true;
addresses = true;
domain = true;
userServices = true;
};
};
# Enable flatpak support
flatpak.enable = true;
# System monitoring
smartd = {
enable = true;
autodetect = true;
};
};
# Hardware support
hardware = {
bluetooth = {
enable = true;
powerOnBoot = true;
};
# OpenGL support
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
intel-media-driver
vaapiIntel
vaapiVdpau
libvdpau-va-gl
];
};
};
# Docker configuration
virtualisation = mkIf cfg.features.docker {
docker = {
enable = true;
enableOnBoot = true;
autoPrune = {
enable = true;
dates = "weekly";
};
};
};
# Development configuration
programs = mkIf cfg.features.development {
git = {
enable = true;
lfs.enable = true;
};
npm.enable = true;
};
# Gaming configuration
programs.steam = mkIf cfg.features.gaming {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
};
# Environment variables
environment.variables = {
EDITOR = "nvim";
VISUAL = "nvim";
BROWSER = "firefox";
TERM = "xterm-256color";
# Development
CARGO_HOME = "$HOME/.cargo";
GOPATH = "$HOME/go";
NPM_CONFIG_PREFIX = "$HOME/.npm";
# Omarchy specific
OMARCHY_ROOT = "/etc/nixos";
OMARCHY_VERSION = "1.0.0";
};
# Shell configuration
programs.bash = {
interactiveShellInit = ''
# Omarchy bash initialization
export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$HOME/go/bin:$HOME/.npm/bin:$PATH"
# Aliases
alias ll='eza -la'
alias ls='eza'
alias cat='bat'
alias grep='rg'
alias find='fd'
alias vim='nvim'
alias vi='nvim'
# Omarchy specific aliases
alias omarchy-rebuild='sudo nixos-rebuild switch --flake /etc/nixos#omarchy'
alias omarchy-update='nix flake update --flake /etc/nixos'
alias omarchy-clean='sudo nix-collect-garbage -d'
alias omarchy-search='nix search nixpkgs'
# Functions
omarchy-theme() {
local theme=$1
if [ -z "$theme" ]; then
echo "Available themes: tokyo-night, catppuccin, gruvbox, nord, everforest, rose-pine, kanagawa"
return 1
fi
echo "Switching to theme: $theme"
# This would need to update the configuration and rebuild
sudo sed -i "s/currentTheme = \".*\"/currentTheme = \"$theme\"/" /etc/nixos/configuration.nix
omarchy-rebuild
}
omarchy-help() {
cat << EOF
Omarchy Commands:
================
omarchy-rebuild - Rebuild system configuration
omarchy-update - Update flake inputs
omarchy-clean - Garbage collect nix store
omarchy-search - Search for packages
omarchy-theme - Change system theme
omarchy-help - Show this help message
Key Bindings (Hyprland):
=======================
Super + Return - Open terminal
Super + B - Open browser
Super + E - Open file manager
Super + D - Application launcher
Super + Q - Close window
Super + F - Fullscreen
Super + Space - Toggle floating
For more information, visit: https://omarchy.org
EOF
}
# Welcome message
if [ -z "$IN_NIX_SHELL" ]; then
echo "Welcome to Omarchy! Type 'omarchy-help' for available commands."
fi
'';
promptInit = ''
# Starship prompt
if command -v starship &> /dev/null; then
eval "$(starship init bash)"
fi
'';
};
# System-wide packages
environment.systemPackages = with pkgs; [
# Core utilities
coreutils
findutils
gnugrep
gnused
gawk
# System tools
htop
neofetch
tree
wget
curl
# Text editors
vim
nano
# Development basics
git
make
gcc
# Nix tools
nix-prefetch-git
nixpkgs-fmt
nil
# Custom Omarchy scripts
(writeShellScriptBin "omarchy-info" ''
#!/usr/bin/env bash
echo "Omarchy NixOS"
echo "============="
echo "Version: ${config.omarchy.version or "1.0.0"}"
echo "Theme: ${cfg.theme}"
echo "User: ${cfg.user}"
echo ""
echo "Features:"
echo " Docker: ${if cfg.features.docker then "" else ""}"
echo " Development: ${if cfg.features.development then "" else ""}"
echo " Gaming: ${if cfg.features.gaming then "" else ""}"
echo " Multimedia: ${if cfg.features.multimedia then "" else ""}"
echo ""
echo "System Info:"
nixos-version
'')
];
};
}

View File

@@ -0,0 +1,536 @@
{ config, pkgs, lib, inputs, ... }:
with lib;
let
cfg = config.omarchy.desktop;
in
{
options.omarchy.desktop = {
enable = mkEnableOption "Omarchy Hyprland desktop environment";
monitors = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "DP-1,1920x1080@144,0x0,1" ];
description = "Monitor configuration for Hyprland";
};
defaultTerminal = mkOption {
type = types.str;
default = "alacritty";
description = "Default terminal emulator";
};
defaultBrowser = mkOption {
type = types.str;
default = "firefox";
description = "Default web browser";
};
wallpaper = mkOption {
type = types.path;
default = ./wallpapers/default.jpg;
description = "Path to wallpaper image";
};
};
config = mkIf (cfg.enable or true) {
# Enable Hyprland
programs.hyprland = {
enable = true;
xwayland.enable = true;
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
};
# XDG portal for Wayland
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-hyprland
xdg-desktop-portal-gtk
];
config.common.default = "*";
};
# Session variables
environment.sessionVariables = {
# Wayland specific
NIXOS_OZONE_WL = "1";
MOZ_ENABLE_WAYLAND = "1";
QT_QPA_PLATFORM = "wayland";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
GDK_BACKEND = "wayland";
WLR_NO_HARDWARE_CURSORS = "1";
# Default applications
TERMINAL = cfg.defaultTerminal;
BROWSER = cfg.defaultBrowser;
EDITOR = "nvim";
};
# Essential packages for Hyprland
environment.systemPackages = with pkgs; [
# Core Wayland utilities
wayland
wayland-protocols
wayland-utils
wlroots
# Hyprland ecosystem
hyprland-protocols
hyprpaper
hyprlock
hypridle
hyprpicker
# Status bar and launcher
waybar
wofi
rofi-wayland
walker
# Notification daemon
mako
libnotify
# Clipboard
wl-clipboard
cliphist
copyq
# Screen management
wlr-randr
kanshi
nwg-displays
# Screenshots and recording
grim
slurp
swappy
wf-recorder
# System tray and applets
networkmanagerapplet
blueman
pasystray
# Wallpaper managers
swww
swaybg
wpaperd
# File managers
nautilus
thunar
pcmanfm
ranger
yazi
# Polkit agent
polkit_gnome
# Themes and cursors
gnome.adwaita-icon-theme
papirus-icon-theme
bibata-cursors
capitaine-cursors
];
# Create Hyprland config directory structure
system.activationScripts.hyprlandConfig = ''
mkdir -p /etc/omarchy/hyprland
# Main Hyprland configuration
cat > /etc/omarchy/hyprland/hyprland.conf <<'EOF'
# Omarchy Hyprland Configuration
# See https://wiki.hyprland.org/Configuring/
# Monitor configuration
${concatStringsSep "\n" (map (m: "monitor = ${m}") cfg.monitors)}
monitor = ,preferred,auto,1
# Execute on startup
exec-once = waybar
exec-once = mako
exec-once = swww init
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec-once = wl-paste --type text --watch cliphist store
exec-once = wl-paste --type image --watch cliphist store
exec-once = nm-applet --indicator
exec-once = blueman-applet
# Set wallpaper
exec = swww img ${toString cfg.wallpaper} --transition-type wipe
# Input configuration
input {
kb_layout = us
kb_variant =
kb_model =
kb_options = caps:escape
kb_rules =
follow_mouse = 1
mouse_refocus = false
touchpad {
natural_scroll = true
disable_while_typing = true
tap-to-click = true
scroll_factor = 0.5
}
sensitivity = 0 # -1.0 - 1.0, 0 means no modification
}
# General configuration
general {
gaps_in = 5
gaps_out = 10
border_size = 2
col.active_border = rgba(7aa2f7ee) rgba(c4a7e7ee) 45deg
col.inactive_border = rgba(595959aa)
layout = dwindle
allow_tearing = false
}
# Decoration
decoration {
rounding = 10
blur {
enabled = true
size = 6
passes = 2
new_optimizations = true
ignore_opacity = true
}
drop_shadow = true
shadow_range = 20
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
dim_inactive = false
dim_strength = 0.1
}
# Animations
animations {
enabled = true
bezier = overshot, 0.05, 0.9, 0.1, 1.05
bezier = smoothOut, 0.5, 0, 0.99, 0.99
bezier = smoothIn, 0.5, -0.5, 0.68, 1.5
animation = windows, 1, 5, overshot, slide
animation = windowsOut, 1, 4, smoothOut, slide
animation = windowsIn, 1, 4, smoothIn, slide
animation = windowsMove, 1, 4, default
animation = border, 1, 10, default
animation = borderangle, 1, 8, default
animation = fade, 1, 7, default
animation = workspaces, 1, 6, default
}
# Layouts
dwindle {
pseudotile = true
preserve_split = true
force_split = 2
}
master {
new_is_master = true
}
# Gestures
gestures {
workspace_swipe = true
workspace_swipe_fingers = 3
workspace_swipe_distance = 300
workspace_swipe_invert = true
}
# Misc
misc {
force_default_wallpaper = 0
disable_hyprland_logo = true
disable_splash_rendering = true
mouse_move_enables_dpms = true
key_press_enables_dpms = true
enable_swallow = true
swallow_regex = ^(alacritty|kitty|footclient)$
}
# Window rules
windowrulev2 = opacity 0.9 override 0.9 override, class:^(Alacritty|kitty)$
windowrulev2 = opacity 0.9 override 0.9 override, class:^(Code|code-oss)$
windowrulev2 = float, class:^(pavucontrol|nm-connection-editor|blueman-manager)$
windowrulev2 = float, class:^(org.gnome.Calculator|gnome-calculator)$
windowrulev2 = float, title:^(Picture-in-Picture)$
windowrulev2 = pin, title:^(Picture-in-Picture)$
windowrulev2 = float, class:^(imv|mpv|vlc)$
windowrulev2 = center, class:^(imv|mpv|vlc)$
# Workspace rules
workspace = 1, monitor:DP-1, default:true
workspace = 2, monitor:DP-1
workspace = 3, monitor:DP-1
workspace = 4, monitor:DP-1
workspace = 5, monitor:DP-1
workspace = 6, monitor:HDMI-A-1
workspace = 7, monitor:HDMI-A-1
workspace = 8, monitor:HDMI-A-1
workspace = 9, monitor:HDMI-A-1
workspace = 10, monitor:HDMI-A-1
# Key bindings
$mainMod = SUPER
# Application shortcuts
bind = $mainMod, Return, exec, ${cfg.defaultTerminal}
bind = $mainMod, B, exec, ${cfg.defaultBrowser}
bind = $mainMod, E, exec, nautilus
bind = $mainMod, D, exec, walker
bind = $mainMod SHIFT, D, exec, wofi --show drun
bind = $mainMod, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-copy
# Window management
bind = $mainMod, Q, killactive
bind = $mainMod, F, fullscreen, 1
bind = $mainMod SHIFT, F, fullscreen, 0
bind = $mainMod, Space, togglefloating
bind = $mainMod, P, pseudo
bind = $mainMod, J, togglesplit
bind = $mainMod, G, togglegroup
bind = $mainMod, Tab, changegroupactive
# Focus movement
bind = $mainMod, h, movefocus, l
bind = $mainMod, l, movefocus, r
bind = $mainMod, k, movefocus, u
bind = $mainMod, j, movefocus, d
# Window movement
bind = $mainMod SHIFT, h, movewindow, l
bind = $mainMod SHIFT, l, movewindow, r
bind = $mainMod SHIFT, k, movewindow, u
bind = $mainMod SHIFT, j, movewindow, d
# Workspace switching
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
# Move to workspace
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10
# Scroll through workspaces
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1
# Resize mode
bind = $mainMod, R, submap, resize
submap = resize
binde = , h, resizeactive, -10 0
binde = , l, resizeactive, 10 0
binde = , k, resizeactive, 0 -10
binde = , j, resizeactive, 0 10
bind = , escape, submap, reset
submap = reset
# Screenshot bindings
bind = , Print, exec, grim -g "$(slurp)" - | swappy -f -
bind = SHIFT, Print, exec, grim - | swappy -f -
bind = $mainMod, Print, exec, grim -g "$(slurp)" - | wl-copy
# Media keys
binde = , XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+
binde = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bind = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bind = , XF86AudioPlay, exec, playerctl play-pause
bind = , XF86AudioNext, exec, playerctl next
bind = , XF86AudioPrev, exec, playerctl previous
bind = , XF86MonBrightnessUp, exec, brightnessctl set +5%
bind = , XF86MonBrightnessDown, exec, brightnessctl set 5%-
# System control
bind = $mainMod SHIFT, Q, exit
bind = $mainMod SHIFT, R, exec, hyprctl reload
bind = $mainMod SHIFT, L, exec, hyprlock
bind = $mainMod SHIFT, P, exec, systemctl poweroff
bind = $mainMod SHIFT, B, exec, systemctl reboot
# Mouse bindings
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
EOF
'';
# Waybar configuration
home-manager.users.${config.omarchy.user or "user"} = {
programs.waybar = {
enable = true;
systemd.enable = true;
settings = [{
layer = "top";
position = "top";
height = 30;
modules-left = [ "hyprland/workspaces" "hyprland/window" ];
modules-center = [ "clock" ];
modules-right = [ "network" "bluetooth" "pulseaudio" "backlight" "battery" "tray" ];
"hyprland/workspaces" = {
format = "{icon}";
on-click = "activate";
format-icons = {
"1" = "";
"2" = "";
"3" = "";
"4" = "";
"5" = "";
urgent = "";
default = "";
};
};
"hyprland/window" = {
max-length = 50;
separate-outputs = true;
};
clock = {
format = " {:%H:%M}";
format-alt = " {:%A, %B %d, %Y (%R)}";
tooltip-format = "<tt><small>{calendar}</small></tt>";
};
network = {
format-wifi = " {essid}";
format-ethernet = " {ifname}";
format-disconnected = " Disconnected";
tooltip-format = "{ifname}: {ipaddr}/{cidr}";
};
bluetooth = {
format = " {status}";
format-connected = " {device_alias}";
format-connected-battery = " {device_alias} {device_battery_percentage}%";
tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected";
tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}";
tooltip-format-enumerate-connected = "{device_alias}\t{device_address}";
tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%";
};
pulseaudio = {
format = "{icon} {volume}%";
format-muted = "";
format-icons = {
default = [ "" "" "" ];
};
on-click = "pavucontrol";
};
backlight = {
format = "{icon} {percent}%";
format-icons = [ "" "" "" "" "" "" "" "" "" ];
};
battery = {
states = {
warning = 30;
critical = 15;
};
format = "{icon} {capacity}%";
format-charging = " {capacity}%";
format-plugged = " {capacity}%";
format-icons = [ "" "" "" "" "" ];
};
tray = {
icon-size = 16;
spacing = 10;
};
}];
style = ''
* {
font-family: "JetBrainsMono Nerd Font";
font-size: 13px;
}
window#waybar {
background: rgba(30, 30, 46, 0.9);
color: #cdd6f4;
}
#workspaces button {
padding: 0 5px;
background: transparent;
color: #cdd6f4;
border-bottom: 3px solid transparent;
}
#workspaces button.active {
background: rgba(203, 166, 247, 0.2);
border-bottom: 3px solid #cba6f7;
}
#clock,
#battery,
#cpu,
#memory,
#temperature,
#backlight,
#network,
#pulseaudio,
#tray,
#bluetooth {
padding: 0 10px;
margin: 0 5px;
}
#battery.charging {
color: #a6e3a1;
}
#battery.warning:not(.charging) {
color: #fab387;
}
#battery.critical:not(.charging) {
color: #f38ba8;
animation: blink 0.5s linear infinite alternate;
}
@keyframes blink {
to {
background-color: #f38ba8;
color: #1e1e2e;
}
}
'';
};
};
};
}

475
modules/development.nix Normal file
View File

@@ -0,0 +1,475 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.omarchy.features.development;
in
{
config = mkIf cfg {
# Development tools
environment.systemPackages = with pkgs; [
# Version control
git
git-lfs
lazygit
gh
gitlab
hub
# Editors and IDEs
neovim
vscode
vim
emacs
# Language servers and tools
# Nix
nil
nixpkgs-fmt
statix
deadnix
nixd
alejandra
# Rust
rustc
cargo
rustfmt
rust-analyzer
clippy
cargo-watch
cargo-edit
cargo-audit
bacon
# Go
go
gopls
gotools
go-tools
golangci-lint
delve
gomodifytags
gotests
impl
# Python
python3
python3Packages.pip
python3Packages.virtualenv
python3Packages.black
python3Packages.pylint
python3Packages.pytest
python3Packages.ipython
pyright
ruff
# Node.js
nodejs_20
nodePackages.npm
nodePackages.pnpm
nodePackages.yarn
nodePackages.typescript
nodePackages.typescript-language-server
nodePackages.eslint
nodePackages.prettier
nodePackages.nodemon
deno
bun
# C/C++
gcc
clang
cmake
gnumake
gdb
lldb
clang-tools
ccls
bear
valgrind
# Java
jdk
maven
gradle
jdt-language-server
# Database tools
postgresql
mysql80
sqlite
redis
mongodb
dbeaver
# Container tools
docker
docker-compose
podman
buildah
skopeo
dive
lazydocker
# Kubernetes tools
kubectl
kubernetes-helm
k9s
kind
minikube
kustomize
kubectx
stern
kubecolor
# Cloud tools
awscli2
google-cloud-sdk
azure-cli
terraform
terragrunt
ansible
vagrant
packer
# API development
httpie
curl
postman
insomnia
grpcurl
evans
# Build tools
bazel
meson
ninja
scons
# Documentation tools
mdbook
hugo
mkdocs
sphinx
# Performance tools
hyperfine
flamegraph
perf-tools
heaptrack
# Network tools
wireshark
tcpdump
nmap
netcat
socat
mtr
# Misc development utilities
jq
yq-go
fx
direnv
watchexec
entr
tmux
tmuxinator
asciinema
tokei
loc
cloc
tree-sitter
];
# Docker daemon
virtualisation.docker = {
enable = true;
enableOnBoot = true;
daemon.settings = {
features = { buildkit = true; };
registry-mirrors = [ "https://mirror.gcr.io" ];
};
autoPrune = {
enable = true;
dates = "weekly";
flags = [ "--all" ];
};
};
# Podman as Docker alternative
virtualisation.podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
# Development services
services = {
# PostgreSQL
postgresql = {
enable = false; # Set to true to enable
package = pkgs.postgresql_15;
dataDir = "/var/lib/postgresql/15";
authentication = ''
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
'';
};
# Redis
redis.servers."" = {
enable = false; # Set to true to enable
port = 6379;
bind = "127.0.0.1";
};
# MySQL/MariaDB
mysql = {
enable = false; # Set to true to enable
package = pkgs.mariadb;
settings = {
mysqld = {
bind-address = "127.0.0.1";
port = 3306;
};
};
};
};
# VSCode settings
environment.variables = {
# Enable VSCode to use Wayland
NIXOS_OZONE_WL = "1";
};
# Development shell environments
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
# Git configuration
programs.git = {
enable = true;
lfs.enable = true;
config = {
init.defaultBranch = "main";
core = {
editor = "nvim";
autocrlf = "input";
};
pull.rebase = false;
push.autoSetupRemote = true;
};
};
# Enable lorri for automatic nix-shell
services.lorri.enable = true;
# Add custom development scripts
environment.systemPackages = with pkgs; [
(writeShellScriptBin "dev-postgres" ''
#!/usr/bin/env bash
echo "Starting PostgreSQL development container..."
docker run --rm -d \
--name dev-postgres \
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
postgres:15-alpine
echo "PostgreSQL running on localhost:5432"
echo "Username: postgres, Password: postgres"
echo "Stop with: docker stop dev-postgres"
'')
(writeShellScriptBin "dev-redis" ''
#!/usr/bin/env bash
echo "Starting Redis development container..."
docker run --rm -d \
--name dev-redis \
-p 6379:6379 \
redis:alpine
echo "Redis running on localhost:6379"
echo "Stop with: docker stop dev-redis"
'')
(writeShellScriptBin "dev-mysql" ''
#!/usr/bin/env bash
echo "Starting MySQL development container..."
docker run --rm -d \
--name dev-mysql \
-e MYSQL_ROOT_PASSWORD=mysql \
-p 3306:3306 \
mysql:8
echo "MySQL running on localhost:3306"
echo "Username: root, Password: mysql"
echo "Stop with: docker stop dev-mysql"
'')
(writeShellScriptBin "dev-mongodb" ''
#!/usr/bin/env bash
echo "Starting MongoDB development container..."
docker run --rm -d \
--name dev-mongodb \
-p 27017:27017 \
mongo:latest
echo "MongoDB running on localhost:27017"
echo "Stop with: docker stop dev-mongodb"
'')
(writeShellScriptBin "dev-env" ''
#!/usr/bin/env bash
# Create a development shell for a specific language
case "$1" in
rust)
nix-shell -p rustc cargo rustfmt rust-analyzer clippy
;;
go)
nix-shell -p go gopls gotools
;;
python)
nix-shell -p python3 python3Packages.pip python3Packages.virtualenv
;;
node)
nix-shell -p nodejs_20 nodePackages.npm nodePackages.pnpm
;;
c|cpp)
nix-shell -p gcc cmake gnumake gdb
;;
*)
echo "Usage: dev-env <language>"
echo "Supported languages: rust, go, python, node, c, cpp"
exit 1
;;
esac
'')
(writeShellScriptBin "dev-project" ''
#!/usr/bin/env bash
# Initialize a new development project
PROJECT_NAME="$1"
PROJECT_TYPE="$2"
if [ -z "$PROJECT_NAME" ] || [ -z "$PROJECT_TYPE" ]; then
echo "Usage: dev-project <name> <type>"
echo "Types: rust, go, python, node, nix"
exit 1
fi
mkdir -p "$PROJECT_NAME"
cd "$PROJECT_NAME"
case "$PROJECT_TYPE" in
rust)
cargo init
echo "use flake" > .envrc
cat > flake.nix << 'EOF'
{
description = "Rust development environment";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
in {
devShells.x86_64-linux.default = pkgs.mkShell {
packages = with pkgs; [ rustc cargo rustfmt rust-analyzer clippy ];
};
};
}
EOF
;;
go)
go mod init "$PROJECT_NAME"
echo "use flake" > .envrc
cat > flake.nix << 'EOF'
{
description = "Go development environment";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
in {
devShells.x86_64-linux.default = pkgs.mkShell {
packages = with pkgs; [ go gopls gotools ];
};
};
}
EOF
;;
python)
echo "use flake" > .envrc
cat > flake.nix << 'EOF'
{
description = "Python development environment";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
in {
devShells.x86_64-linux.default = pkgs.mkShell {
packages = with pkgs; [
python3 python3Packages.pip python3Packages.virtualenv
];
shellHook = "python -m venv .venv && source .venv/bin/activate";
};
};
}
EOF
;;
node)
npm init -y
echo "use flake" > .envrc
cat > flake.nix << 'EOF'
{
description = "Node.js development environment";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
in {
devShells.x86_64-linux.default = pkgs.mkShell {
packages = with pkgs; [ nodejs_20 nodePackages.pnpm ];
};
};
}
EOF
;;
nix)
echo "use flake" > .envrc
cat > flake.nix << 'EOF'
{
description = "Nix development environment";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
in {
packages.x86_64-linux.default = pkgs.hello;
devShells.x86_64-linux.default = pkgs.mkShell {
packages = with pkgs; [ nixpkgs-fmt nil ];
};
};
}
EOF
;;
*)
echo "Unknown project type: $PROJECT_TYPE"
exit 1
;;
esac
git init
direnv allow
echo "Project '$PROJECT_NAME' created with $PROJECT_TYPE template"
echo "Run 'direnv allow' to activate the development environment"
'')
];
};
}

View File

@@ -0,0 +1,170 @@
{ config, lib, pkgs, ... }:
with lib;
{
imports = [
./nvidia.nix
./amd.nix
./intel.nix
./audio.nix
./bluetooth.nix
./touchpad.nix
];
# Common hardware support
hardware = {
# Enable all firmware
enableAllFirmware = true;
enableRedistributableFirmware = true;
# CPU microcode updates
cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# OpenGL/Graphics
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
# Common OpenGL packages
extraPackages = with pkgs; [
intel-media-driver # Intel VAAPI
vaapiIntel
vaapiVdpau
libvdpau-va-gl
intel-compute-runtime # Intel OpenCL
];
extraPackages32 = with pkgs.pkgsi686Linux; [
vaapiIntel
vaapiVdpau
libvdpau-va-gl
];
};
# USB support
usb-modeswitch.enable = true;
# Sensor support (for laptops)
sensor.iio.enable = true;
# Firmware updater
fwupd.enable = true;
};
# Kernel modules
boot.kernelModules = [
# Virtualization
"kvm-intel"
"kvm-amd"
# USB
"usbhid"
# Network
"iwlwifi"
];
# Power management
powerManagement = {
enable = true;
cpuFreqGovernor = lib.mkDefault "powersave";
};
services = {
# Thermal management
thermald.enable = mkDefault true;
# Power profiles daemon (modern power management)
power-profiles-daemon.enable = true;
# Firmware update service
fwupd.enable = true;
# Hardware monitoring
smartd = {
enable = true;
autodetect = true;
};
# Automatic CPU frequency scaling
auto-cpufreq = {
enable = false; # Disabled by default, conflicts with power-profiles-daemon
settings = {
battery = {
governor = "powersave";
turbo = "never";
};
charger = {
governor = "performance";
turbo = "auto";
};
};
};
};
# Additional hardware-specific packages
environment.systemPackages = with pkgs; [
# Hardware info
lshw
hwinfo
inxi
dmidecode
lscpu
lsusb
lspci
pciutils
usbutils
# Disk tools
smartmontools
hdparm
nvme-cli
# CPU tools
cpufrequtils
cpupower-gui
# GPU tools
glxinfo
vulkan-tools
# Sensors
lm_sensors
# Power management
powertop
acpi
# Benchmarking
stress
stress-ng
s-tui
];
# Udev rules for hardware
services.udev = {
enable = true;
extraRules = ''
# Allow users in wheel group to control backlight
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="*", GROUP="wheel", MODE="0664"
# Allow users in wheel group to control LEDs
ACTION=="add", SUBSYSTEM=="leds", KERNEL=="*", GROUP="wheel", MODE="0664"
# Gaming controllers
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="028e", GROUP="wheel", MODE="0664"
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="028f", GROUP="wheel", MODE="0664"
'';
};
# Virtual console configuration
console = {
earlySetup = true;
font = "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz";
packages = [ pkgs.terminus_font ];
};
}

360
modules/packages.nix Normal file
View File

@@ -0,0 +1,360 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.omarchy;
in
{
options.omarchy.packages = {
enable = mkEnableOption "Omarchy packages";
categories = {
base = mkEnableOption "Base system packages" // { default = true; };
development = mkEnableOption "Development packages" // { default = true; };
multimedia = mkEnableOption "Multimedia packages" // { default = true; };
productivity = mkEnableOption "Productivity packages" // { default = true; };
gaming = mkEnableOption "Gaming packages" // { default = false; };
};
};
config = mkIf (cfg.enable or true) {
environment.systemPackages = with pkgs;
# Base system packages (always installed)
[
# Core utilities
coreutils
util-linux
binutils
pciutils
usbutils
lshw
# File management
file
tree
ncdu
duf
dust
# Networking
iproute2
iputils
dnsutils
nettools
nmap
wget
curl
aria2
# Archives
zip
unzip
p7zip
rar
unrar
xz
# System monitoring
btop
htop
iotop
iftop
nethogs
lsof
sysstat
# Text processing
vim
nano
sed
gawk
jq
yq-go
ripgrep
fd
bat
eza
fzf
zoxide
# Version control
git
git-lfs
lazygit
gh
# Terminal multiplexers
tmux
screen
# System tools
rsync
rclone
age
sops
gnupg
pass
pwgen
# Shell and prompts
bash
zsh
fish
starship
oh-my-posh
# Package management helpers
nix-index
nix-tree
nix-diff
nixpkgs-fmt
nil
statix
deadnix
cachix
lorri
direnv
]
# Development packages
++ optionals cfg.packages.categories.development [
# Editors and IDEs
neovim
emacs
vscode
jetbrains.idea-community
# Language servers
nodePackages.typescript-language-server
nodePackages.vscode-langservers-extracted
rust-analyzer
gopls
pyright
lua-language-server
clang-tools
# Debuggers
gdb
lldb
delve
# Build tools
gnumake
cmake
meson
ninja
autoconf
automake
libtool
pkg-config
# Compilers and interpreters
gcc
clang
rustc
cargo
go
python3
nodejs_20
deno
bun
# Container tools
docker
docker-compose
podman
buildah
skopeo
kind
kubectl
kubernetes-helm
k9s
# Database clients
postgresql
mysql80
sqlite
redis
mongodb-tools
dbeaver
# API testing
httpie
curl
postman
insomnia
# Cloud tools
awscli2
google-cloud-sdk
azure-cli
terraform
ansible
# Documentation
mdbook
hugo
zola
]
# Multimedia packages
++ optionals cfg.packages.categories.multimedia [
# Audio
pipewire
pulseaudio
pavucontrol
easyeffects
spotify
spotifyd
spotify-tui
cmus
mpd
ncmpcpp
# Video
mpv
vlc
obs-studio
kdenlive
handbrake
ffmpeg-full
# Images
imv
feh
gimp
inkscape
krita
imagemagick
graphicsmagick
# Screen capture
grim
slurp
wf-recorder
flameshot
peek
# PDF
zathura
evince
okular
mupdf
]
# Productivity packages
++ optionals cfg.packages.categories.productivity [
# Browsers
firefox
chromium
brave
qutebrowser
# Communication
discord
slack
telegram-desktop
signal-desktop
element-desktop
zoom-us
teams
# Office
libreoffice
onlyoffice-bin
wpsoffice
# Note taking
obsidian
logseq
joplin-desktop
zettlr
# Email
thunderbird
aerc
neomutt
# Calendar
calcurse
khal
# Password managers
bitwarden
keepassxc
pass
# Sync and backup
syncthing
nextcloud-client
rclone
restic
borgbackup
]
# Gaming packages
++ optionals cfg.packages.categories.gaming [
steam
lutris
wine
winetricks
proton-ge-bin
mangohud
gamemode
discord
obs-studio
];
# Font packages
fonts.packages = with pkgs; [
# Nerd fonts (for icons in terminal)
(nerdfonts.override {
fonts = [
"JetBrainsMono"
"FiraCode"
"Hack"
"Iosevka"
"Meslo"
"SourceCodePro"
"UbuntuMono"
"DroidSansMono"
"RobotoMono"
"Inconsolata"
];
})
# System fonts
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
liberation_ttf
ubuntu_font_family
roboto
open-sans
lato
# Programming fonts
jetbrains-mono
fira-code
hasklig
victor-mono
# Icon fonts
font-awesome
material-icons
material-design-icons
];
# Enable font configuration
fonts.fontconfig = {
enable = true;
defaultFonts = {
serif = [ "Noto Serif" "Liberation Serif" ];
sansSerif = [ "Noto Sans" "Liberation Sans" ];
monospace = [ "JetBrainsMono Nerd Font" "Noto Sans Mono" ];
emoji = [ "Noto Color Emoji" ];
};
};
};
}

323
modules/services.nix Normal file
View File

@@ -0,0 +1,323 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.omarchy;
in
{
# System services configuration
services = {
# Display server
xserver = {
enable = true;
# Display Manager
displayManager = {
gdm = {
enable = true;
wayland = true;
};
defaultSession = "hyprland";
};
# Touchpad support
libinput = {
enable = true;
touchpad = {
naturalScrolling = true;
tapping = true;
clickMethod = "clickfinger";
};
};
# Keyboard layout
xkb = {
layout = "us";
variant = "";
options = "caps:escape,compose:ralt";
};
};
# Printing support
printing = {
enable = true;
drivers = with pkgs; [
gutenprint
gutenprintBin
hplip
epson-escpr
epson-escpr2
];
};
# Scanner support
sane = {
enable = true;
extraBackends = with pkgs; [
sane-airscan
epkowa
];
};
# Sound
pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
jack.enable = true;
wireplumber.enable = true;
};
# Network
resolved = {
enable = true;
dnssec = "true";
domains = [ "~." ];
fallbackDns = [
"1.1.1.1"
"8.8.8.8"
"1.0.0.1"
"8.8.4.4"
];
};
# Bluetooth
blueman.enable = true;
# Power management
power-profiles-daemon.enable = true;
thermald.enable = true;
upower = {
enable = true;
percentageLow = 15;
percentageCritical = 5;
percentageAction = 3;
};
# System monitoring
smartd = {
enable = true;
autodetect = true;
};
# File indexing and search
locate = {
enable = true;
interval = "daily";
package = pkgs.plocate;
localuser = null;
};
# Backup service (optional)
restic = {
backups = {
# Example backup configuration
# home = {
# paths = [ "/home/${cfg.user}" ];
# repository = "/backup/restic";
# passwordFile = "/etc/restic/password";
# timerConfig = {
# OnCalendar = "daily";
# Persistent = true;
# };
# pruneOpts = [
# "--keep-daily 7"
# "--keep-weekly 4"
# "--keep-monthly 12"
# ];
# };
};
};
# SSH daemon
openssh = {
enable = true;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
X11Forwarding = false;
};
};
# Firewall
fail2ban = {
enable = true;
maxretry = 3;
bantime = "1h";
bantime-increment.enable = true;
};
# System maintenance
fstrim = {
enable = true;
interval = "weekly";
};
# Scheduled tasks
cron = {
enable = true;
systemCronJobs = [
# Example: Update system database daily
# "0 3 * * * root ${pkgs.nix-index}/bin/nix-index"
];
};
# Syncthing for file synchronization
syncthing = {
enable = false; # Set to true to enable
user = cfg.user;
dataDir = "/home/${cfg.user}/Documents";
configDir = "/home/${cfg.user}/.config/syncthing";
};
# Tailscale VPN
tailscale = {
enable = false; # Set to true to enable
useRoutingFeatures = "client";
};
# Flatpak support
flatpak.enable = true;
# GVFS for mounting and trash support
gvfs.enable = true;
# Thumbnail generation
tumbler.enable = true;
# Notification daemon is handled by mako in Hyprland config
# System daemons
dbus = {
enable = true;
packages = with pkgs; [ dconf ];
};
# Avahi for network discovery
avahi = {
enable = true;
nssmdns4 = true;
publish = {
enable = true;
addresses = true;
workstation = true;
};
};
# ACPI daemon for power management
acpid.enable = true;
# Automatic upgrades (disabled by default)
# system.autoUpgrade = {
# enable = true;
# allowReboot = false;
# dates = "04:00";
# flake = "/etc/nixos#omarchy";
# };
# Earlyoom - out of memory killer
earlyoom = {
enable = true;
freeMemThreshold = 5;
freeSwapThreshold = 10;
};
# Logrotate
logrotate = {
enable = true;
settings = {
"/var/log/omarchy/*.log" = {
frequency = "weekly";
rotate = 4;
compress = true;
delaycompress = true;
notifempty = true;
create = "644 root root";
};
};
};
};
# Systemd services
systemd = {
# User session environment
user.extraConfig = ''
DefaultEnvironment="PATH=/run/wrappers/bin:/home/${cfg.user}/.nix-profile/bin:/etc/profiles/per-user/${cfg.user}/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"
'';
# Automatic cleanup
timers.clear-tmp = {
description = "Clear /tmp weekly";
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "weekly";
Persistent = true;
};
};
services.clear-tmp = {
description = "Clear /tmp directory";
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.coreutils}/bin/find /tmp -type f -atime +7 -delete";
};
};
# Custom Omarchy services
services.omarchy-init = {
description = "Omarchy initialization service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = pkgs.writeShellScript "omarchy-init" ''
#!/usr/bin/env bash
echo "Initializing Omarchy..."
# Create necessary directories
mkdir -p /var/log/omarchy
mkdir -p /var/lib/omarchy
mkdir -p /etc/omarchy
# Set up initial configuration
if [ ! -f /etc/omarchy/initialized ]; then
echo "$(date): Omarchy initialized" > /etc/omarchy/initialized
echo "Welcome to Omarchy!" > /etc/motd
fi
'';
};
};
};
# Security policies
security = {
polkit = {
enable = true;
extraConfig = ''
/* Allow members of wheel group to manage systemd services without password */
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.systemd1.manage-units" &&
subject.isInGroup("wheel")) {
return polkit.Result.YES;
}
});
'';
};
# AppArmor
apparmor = {
enable = true;
packages = with pkgs; [
apparmor-utils
apparmor-profiles
];
};
};
}

View File

@@ -0,0 +1,198 @@
{ config, pkgs, lib, ... }:
{
# Catppuccin Mocha theme configuration
config = {
# Color palette
environment.variables = {
OMARCHY_THEME = "catppuccin";
OMARCHY_THEME_BG = "#1e1e2e";
OMARCHY_THEME_FG = "#cdd6f4";
OMARCHY_THEME_ACCENT = "#cba6f7";
};
# Home-manager theme configuration
home-manager.users.${config.omarchy.user or "user"} = {
# Alacritty theme
programs.alacritty.settings.colors = {
primary = {
background = "#1e1e2e";
foreground = "#cdd6f4";
dim_foreground = "#a6adc8";
bright_foreground = "#cdd6f4";
};
cursor = {
text = "#1e1e2e";
cursor = "#f5e0dc";
};
vi_mode_cursor = {
text = "#1e1e2e";
cursor = "#b4befe";
};
search = {
matches = {
foreground = "#1e1e2e";
background = "#a6adc8";
};
focused_match = {
foreground = "#1e1e2e";
background = "#a6e3a1";
};
};
hints = {
start = {
foreground = "#1e1e2e";
background = "#f9e2af";
};
end = {
foreground = "#1e1e2e";
background = "#a6adc8";
};
};
selection = {
text = "#1e1e2e";
background = "#f5e0dc";
};
normal = {
black = "#45475a";
red = "#f38ba8";
green = "#a6e3a1";
yellow = "#f9e2af";
blue = "#89b4fa";
magenta = "#f5c2e7";
cyan = "#94e2d5";
white = "#bac2de";
};
bright = {
black = "#585b70";
red = "#f38ba8";
green = "#a6e3a1";
yellow = "#f9e2af";
blue = "#89b4fa";
magenta = "#f5c2e7";
cyan = "#94e2d5";
white = "#a6adc8";
};
dim = {
black = "#45475a";
red = "#f38ba8";
green = "#a6e3a1";
yellow = "#f9e2af";
blue = "#89b4fa";
magenta = "#f5c2e7";
cyan = "#94e2d5";
white = "#bac2de";
};
};
# GTK theme
gtk = {
theme = {
name = "Catppuccin-Mocha-Standard-Lavender-Dark";
package = pkgs.catppuccin-gtk.override {
accents = ["lavender"];
size = "standard";
variant = "mocha";
};
};
iconTheme = {
name = "Papirus-Dark";
package = pkgs.catppuccin-papirus-folders.override {
flavor = "mocha";
accent = "lavender";
};
};
};
# Starship theme
programs.starship.settings = {
palette = "catppuccin_mocha";
palettes.catppuccin_mocha = {
rosewater = "#f5e0dc";
flamingo = "#f2cdcd";
pink = "#f5c2e7";
mauve = "#cba6f7";
red = "#f38ba8";
maroon = "#eba0ac";
peach = "#fab387";
yellow = "#f9e2af";
green = "#a6e3a1";
teal = "#94e2d5";
sky = "#89dceb";
sapphire = "#74c7ec";
blue = "#89b4fa";
lavender = "#b4befe";
text = "#cdd6f4";
subtext1 = "#bac2de";
subtext0 = "#a6adc8";
overlay2 = "#9399b2";
overlay1 = "#7f849c";
overlay0 = "#6c7086";
surface2 = "#585b70";
surface1 = "#45475a";
surface0 = "#313244";
base = "#1e1e2e";
mantle = "#181825";
crust = "#11111b";
};
format = ''
[](surface2)$username[@](yellow)$hostname [in ](text)$directory$git_branch$git_status$cmd_duration
[](surface2)$character
'';
character = {
success_symbol = "[](green)";
error_symbol = "[](red)";
};
directory = {
style = "blue";
};
git_branch = {
style = "mauve";
symbol = " ";
};
git_status = {
style = "red";
};
};
# Mako notification theme
services.mako = {
backgroundColor = "#1e1e2e";
textColor = "#cdd6f4";
borderColor = "#cba6f7";
progressColor = "#cba6f7";
defaultTimeout = 5000;
borderRadius = 10;
borderSize = 2;
font = "JetBrainsMono Nerd Font 10";
padding = "10";
margin = "20";
};
};
# Hyprland theme colors
environment.systemPackages = with pkgs; [
(writeShellScriptBin "set-catppuccin-colors" ''
#!/usr/bin/env bash
# Set Catppuccin Mocha colors in Hyprland
hyprctl keyword general:col.active_border "rgba(cba6f7ee) rgba(89b4faee) 45deg"
hyprctl keyword general:col.inactive_border "rgba(585b70aa)"
hyprctl keyword decoration:col.shadow "rgba(1e1e2eee)"
'')
];
};
}

View File

@@ -0,0 +1,257 @@
{ config, pkgs, lib, ... }:
{
# Tokyo Night theme configuration
config = {
# Color palette
environment.variables = {
OMARCHY_THEME = "tokyo-night";
OMARCHY_THEME_BG = "#1a1b26";
OMARCHY_THEME_FG = "#c0caf5";
OMARCHY_THEME_ACCENT = "#7aa2f7";
};
# Home-manager theme configuration
home-manager.users.${config.omarchy.user or "user"} = {
# Alacritty theme
programs.alacritty.settings.colors = {
primary = {
background = "#1a1b26";
foreground = "#c0caf5";
};
normal = {
black = "#15161e";
red = "#f7768e";
green = "#9ece6a";
yellow = "#e0af68";
blue = "#7aa2f7";
magenta = "#bb9af7";
cyan = "#7dcfff";
white = "#a9b1d6";
};
bright = {
black = "#414868";
red = "#f7768e";
green = "#9ece6a";
yellow = "#e0af68";
blue = "#7aa2f7";
magenta = "#bb9af7";
cyan = "#7dcfff";
white = "#c0caf5";
};
indexed_colors = [
{ index = 16; color = "#ff9e64"; }
{ index = 17; color = "#db4b4b"; }
];
};
# Kitty theme
programs.kitty = {
theme = "Tokyo Night";
settings = {
background = "#1a1b26";
foreground = "#c0caf5";
selection_background = "#33467c";
selection_foreground = "#c0caf5";
cursor = "#c0caf5";
cursor_text_color = "#1a1b26";
# Black
color0 = "#15161e";
color8 = "#414868";
# Red
color1 = "#f7768e";
color9 = "#f7768e";
# Green
color2 = "#9ece6a";
color10 = "#9ece6a";
# Yellow
color3 = "#e0af68";
color11 = "#e0af68";
# Blue
color4 = "#7aa2f7";
color12 = "#7aa2f7";
# Magenta
color5 = "#bb9af7";
color13 = "#bb9af7";
# Cyan
color6 = "#7dcfff";
color14 = "#7dcfff";
# White
color7 = "#a9b1d6";
color15 = "#c0caf5";
};
};
# VS Code theme
programs.vscode.userSettings = {
"workbench.colorTheme" = "Tokyo Night";
"editor.tokenColorCustomizations" = {
"[Tokyo Night]" = {
"textMateRules" = [];
};
};
"workbench.colorCustomizations" = {
"[Tokyo Night]" = {
"editor.background" = "#1a1b26";
"editor.foreground" = "#c0caf5";
"sideBar.background" = "#16161e";
"sideBar.foreground" = "#a9b1d6";
"activityBar.background" = "#16161e";
"activityBar.foreground" = "#c0caf5";
};
};
};
# GTK theme
gtk = {
theme = {
name = "Tokyo-Night";
package = pkgs.tokyo-night-gtk or (pkgs.adw-gtk3.overrideAttrs (oldAttrs: {
pname = "tokyo-night-gtk";
postInstall = (oldAttrs.postInstall or "") + ''
# Customize colors for Tokyo Night
sed -i 's/#1e1e2e/#1a1b26/g' $out/share/themes/*/gtk-3.0/gtk.css
sed -i 's/#cdd6f4/#c0caf5/g' $out/share/themes/*/gtk-3.0/gtk.css
'';
}));
};
};
# Rofi/Wofi theme
programs.rofi = {
theme = let
inherit (config.lib.formats.rasi) mkLiteral;
in {
"*" = {
background = mkLiteral "#1a1b26";
foreground = mkLiteral "#c0caf5";
selected = mkLiteral "#33467c";
active = mkLiteral "#7aa2f7";
urgent = mkLiteral "#f7768e";
};
};
};
# Starship theme adjustments
programs.starship.settings = {
palette = "tokyo-night";
palettes.tokyo-night = {
bg = "#1a1b26";
fg = "#c0caf5";
black = "#15161e";
red = "#f7768e";
green = "#9ece6a";
yellow = "#e0af68";
blue = "#7aa2f7";
magenta = "#bb9af7";
cyan = "#7dcfff";
white = "#a9b1d6";
};
character = {
success_symbol = "[](green)";
error_symbol = "[](red)";
};
directory = {
style = "blue";
truncation_length = 3;
};
git_branch = {
style = "magenta";
symbol = " ";
};
git_status = {
style = "red";
};
};
# Neovim theme
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = tokyonight-nvim;
type = "lua";
config = ''
vim.cmd[[colorscheme tokyonight-night]]
'';
}
];
# Bat theme
programs.bat.config.theme = "TwoDark"; # Close to Tokyo Night
# btop theme
programs.btop.settings.color_theme = "tokyo-night";
# Lazygit theme
programs.lazygit.settings = {
gui.theme = {
activeBorderColor = [ "#7aa2f7" "bold" ];
inactiveBorderColor = [ "#414868" ];
selectedLineBgColor = [ "#33467c" ];
selectedRangeBgColor = [ "#33467c" ];
cherryPickedCommitBgColor = [ "#33467c" ];
cherryPickedCommitFgColor = [ "#7aa2f7" ];
unstagedChangesColor = [ "#f7768e" ];
defaultFgColor = [ "#c0caf5" ];
};
};
# Firefox theme
programs.firefox.profiles.default = {
userChrome = ''
/* Tokyo Night theme for Firefox */
:root {
--toolbar-bgcolor: #1a1b26 !important;
--toolbar-color: #c0caf5 !important;
--toolbarbutton-hover-background: #33467c !important;
--toolbarbutton-active-background: #414868 !important;
--urlbar-focused-bg-color: #1a1b26 !important;
--urlbar-focused-color: #c0caf5 !important;
--tab-selected-bgcolor: #33467c !important;
--tab-selected-color: #c0caf5 !important;
}
'';
};
# Mako notification theme
services.mako = {
backgroundColor = "#1a1b26";
textColor = "#c0caf5";
borderColor = "#7aa2f7";
progressColor = "#7aa2f7";
defaultTimeout = 5000;
borderRadius = 10;
borderSize = 2;
font = "JetBrainsMono Nerd Font 10";
padding = "10";
margin = "20";
};
};
# Wallpaper
environment.systemPackages = with pkgs; [
(writeShellScriptBin "set-wallpaper" ''
#!/usr/bin/env bash
# Set Tokyo Night themed wallpaper
swww img ${./wallpapers/tokyo-night.jpg} --transition-type wipe --transition-angle 30 --transition-step 90
'')
];
};
}

122
modules/users.nix Normal file
View File

@@ -0,0 +1,122 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.omarchy;
in
{
# User account configuration
users.users.${cfg.user} = {
isNormalUser = true;
description = "Omarchy User";
extraGroups = [
"wheel"
"networkmanager"
"audio"
"video"
"docker"
"libvirtd"
"input"
"dialout"
];
shell = pkgs.bash;
# Set initial password (should be changed on first login)
initialPassword = "omarchy";
# SSH keys (add your SSH public keys here)
openssh.authorizedKeys.keys = [
# "ssh-ed25519 AAAAC3... user@example.com"
];
};
# Additional user-related configurations
users = {
# Allow users in wheel group to use sudo
mutableUsers = true;
# Default shell
defaultUserShell = pkgs.bash;
};
# Security settings for users
security.pam.services = {
# Enable fingerprint authentication
login.fprintAuth = false;
sudo.fprintAuth = false;
# Enable U2F authentication (for YubiKey etc.)
login.u2fAuth = false;
sudo.u2fAuth = false;
};
# Home directory encryption (optional)
# security.pam.enableEcryptfs = true;
# Automatic login (disable for production)
services.xserver.displayManager.autoLogin = {
enable = false;
user = cfg.user;
};
# User environment
environment.systemPackages = with pkgs; [
# User management tools
shadow
passwd
# Session management
loginctl
# User info
finger_bsd
id-utils
];
# User-specific services
systemd.user.services = {
# Example: Syncthing for the user
# syncthing = {
# description = "Syncthing for ${cfg.user}";
# wantedBy = [ "default.target" ];
# serviceConfig = {
# ExecStart = "${pkgs.syncthing}/bin/syncthing serve --no-browser --no-restart --logflags=0";
# Restart = "on-failure";
# RestartSec = 10;
# };
# };
};
# Shell initialization for all users
programs.bash.interactiveShellInit = ''
# User-specific aliases
alias profile='nvim ~/.bashrc'
alias reload='source ~/.bashrc'
# Safety aliases
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Directory shortcuts
alias home='cd ~'
alias downloads='cd ~/Downloads'
alias documents='cd ~/Documents'
alias projects='cd ~/Projects'
# Create standard directories if they don't exist
mkdir -p ~/Downloads ~/Documents ~/Projects ~/Pictures ~/Videos ~/Music
'';
# XDG Base Directory specification
environment.variables = {
XDG_CACHE_HOME = "$HOME/.cache";
XDG_CONFIG_HOME = "$HOME/.config";
XDG_DATA_HOME = "$HOME/.local/share";
XDG_STATE_HOME = "$HOME/.local/state";
};
# User quotas (optional)
# fileSystems."/home".options = [ "usrquota" ];
}