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:
237
flake.nix
Normal file
237
flake.nix
Normal file
@@ -0,0 +1,237 @@
|
||||
{
|
||||
description = "Omarchy - NixOS configuration for modern development";
|
||||
|
||||
inputs = {
|
||||
# Nixpkgs
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
|
||||
|
||||
# Home manager
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Hyprland
|
||||
hyprland = {
|
||||
url = "github:hyprwm/Hyprland";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Hyprland plugins
|
||||
hyprland-plugins = {
|
||||
url = "github:hyprwm/hyprland-plugins";
|
||||
inputs.hyprland.follows = "hyprland";
|
||||
};
|
||||
|
||||
# Stylix for theming
|
||||
stylix = {
|
||||
url = "github:danth/stylix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Nix colors
|
||||
nix-colors.url = "github:misterio77/nix-colors";
|
||||
|
||||
# Neovim nightly
|
||||
neovim-nightly-overlay = {
|
||||
url = "github:nix-community/neovim-nightly-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# NUR for additional packages
|
||||
nur.url = "github:nix-community/NUR";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, ... }@inputs:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
};
|
||||
overlays = [
|
||||
inputs.nur.overlay
|
||||
inputs.neovim-nightly-overlay.overlay
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
# NixOS configuration
|
||||
nixosConfigurations = {
|
||||
omarchy = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
./configuration.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = { inherit inputs; };
|
||||
users = {
|
||||
# Replace with your username
|
||||
user = import ./home.nix;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Development shells
|
||||
devShells.${system} = {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
# Development tools
|
||||
git
|
||||
neovim
|
||||
ripgrep
|
||||
fd
|
||||
bat
|
||||
eza
|
||||
fzf
|
||||
zoxide
|
||||
starship
|
||||
lazygit
|
||||
gh
|
||||
|
||||
# Language servers and formatters
|
||||
nil # Nix LSP
|
||||
nixpkgs-fmt
|
||||
statix
|
||||
deadnix
|
||||
|
||||
# Build tools
|
||||
gnumake
|
||||
gcc
|
||||
nodejs_20
|
||||
python3
|
||||
rustc
|
||||
cargo
|
||||
go
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "🚀 Welcome to Omarchy development environment!"
|
||||
echo ""
|
||||
echo "Available commands:"
|
||||
echo " omarchy-rebuild - Rebuild system configuration"
|
||||
echo " omarchy-update - Update flake inputs"
|
||||
echo " omarchy-clean - Garbage collect nix store"
|
||||
echo ""
|
||||
|
||||
# Setup aliases
|
||||
alias omarchy-rebuild="sudo nixos-rebuild switch --flake .#omarchy"
|
||||
alias omarchy-update="nix flake update"
|
||||
alias omarchy-clean="nix-collect-garbage -d"
|
||||
|
||||
# Initialize starship prompt
|
||||
eval "$(starship init bash)"
|
||||
'';
|
||||
};
|
||||
|
||||
# Python development
|
||||
python = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
python3
|
||||
python3Packages.pip
|
||||
python3Packages.virtualenv
|
||||
python3Packages.ipython
|
||||
python3Packages.black
|
||||
python3Packages.pylint
|
||||
python3Packages.pytest
|
||||
ruff
|
||||
];
|
||||
};
|
||||
|
||||
# Node.js development
|
||||
node = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
nodejs_20
|
||||
nodePackages.npm
|
||||
nodePackages.pnpm
|
||||
nodePackages.yarn
|
||||
nodePackages.typescript
|
||||
nodePackages.eslint
|
||||
nodePackages.prettier
|
||||
];
|
||||
};
|
||||
|
||||
# Rust development
|
||||
rust = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
rustc
|
||||
cargo
|
||||
rustfmt
|
||||
rust-analyzer
|
||||
clippy
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Packages that can be built
|
||||
packages.${system} = {
|
||||
# Omarchy scripts as packages
|
||||
omarchy-scripts = pkgs.callPackage ./packages/scripts.nix {};
|
||||
|
||||
# Plymouth theme
|
||||
plymouth-theme-omarchy = pkgs.callPackage ./packages/plymouth-theme.nix {};
|
||||
};
|
||||
|
||||
# Apps that can be run
|
||||
apps.${system} = {
|
||||
# Installer
|
||||
installer = {
|
||||
type = "app";
|
||||
program = "${pkgs.writeShellScriptBin "omarchy-install" ''
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
echo "🚀 Omarchy NixOS Installer"
|
||||
echo "========================="
|
||||
echo ""
|
||||
|
||||
# Check if running on NixOS
|
||||
if [ ! -f /etc/nixos/configuration.nix ]; then
|
||||
echo "Error: This installer must be run on a NixOS system"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "This will install Omarchy configuration to your NixOS system."
|
||||
read -p "Continue? (y/n) " -n 1 -r
|
||||
echo
|
||||
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Backup existing configuration
|
||||
echo "📦 Backing up existing configuration..."
|
||||
sudo cp -r /etc/nixos /etc/nixos.backup.$(date +%Y%m%d-%H%M%S)
|
||||
|
||||
# Copy new configuration
|
||||
echo "📝 Installing Omarchy configuration..."
|
||||
sudo cp -r ${self}/* /etc/nixos/
|
||||
|
||||
# Initialize flake
|
||||
echo "🔧 Initializing flake..."
|
||||
cd /etc/nixos
|
||||
sudo git init
|
||||
sudo git add -A
|
||||
|
||||
# Rebuild
|
||||
echo "🏗️ Rebuilding system..."
|
||||
sudo nixos-rebuild switch --flake /etc/nixos#omarchy
|
||||
|
||||
echo ""
|
||||
echo "✅ Installation complete!"
|
||||
echo "🎉 Welcome to Omarchy!"
|
||||
''}/bin/omarchy-install";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user