feat(system): establish dual-host architecture and finalize environment integrations
This commit finalizes the multi-host deployment framework, introducing the laptop profile alongside the desktop. It integrates essential hardware services, declaratively binds the Hyprland compositor, and thoroughly documents the repository architecture. - Initialize `hosts/laptop` profile configured for the Niri compositor, utilizing `lib.mkForce` to override default `greetd` logic. - Declare `hyprland.conf` directly via Home Manager (`home.file`) to ensure reproducible compositor settings (blur, gaps, bindings). - Enable Bluetooth daemon (`hardware.bluetooth`) and printing services (`cups-pk-helper`) system-wide. - Configure default system typography with `inter` and `fira-code` via `fonts.fontconfig`. - Enhance `tuigreet` login screen with session memory, password asterisks, and a custom declarative greeting. - Add comprehensive inline documentation to all Nix modules and shell scripts, alongside a complete project `README.md`. - Update the Home Manager declarations in flake.nix to include home-manager.backupFileExtension = "backup" Rationale: Hardcoding the Hyprland configuration and core hardware services ensures the desktop is fully immutable. Branching the host profiles allows the laptop to share 100% of the user-space configurations (terminal, editor, shell aliases) while cleanly swapping the graphical compositor stack to Niri.
This commit is contained in:
1 parent
7d8b167304
commit
7245d8c22a
18 files changed
+570
-117
No files matched your search
@@ -0,0 +1,113 @@
|
||||
# ❄️ Declarative NixOS Workstation
|
||||
|
||||
## 📖 Overview
|
||||
|
||||
This repository contains a purely declarative, fully reproducible NixOS configuration tailored for modern software development and multi-host deployment. It serves as the single source of truth for managing a unified Wayland-native environment across different hardware profiles, ensuring identical terminal workflows, editor configurations, and core toolchains on every machine.
|
||||
|
||||
The bash shell configuration is a modular port of the static Arch-based environment [bash-custom](https://github.com/kiskaadee/bash-custom). The desktop experience is designed to achieve visual and functional parity with [DankMaterialShell (DMS)](https://danklinux.com/docs/dankmaterialshell/).
|
||||
|
||||
---
|
||||
|
||||
## 🛑 The Problem (Why this exists)
|
||||
|
||||
Traditional Linux distributions (like Arch Linux) rely on imperative package management and stateful configurations. Over time, this leads to:
|
||||
|
||||
* **Configuration Drift:** Packages and dotfiles drift out of sync between a desktop and a laptop.
|
||||
* **Imperative Rot:** System stability degrades as manual tweaks, forgotten dependencies, and monolithic Bash configurations (`.bashrc` files spanning hundreds of lines) pile up.
|
||||
* **Replication Friction:** Setting up a new machine requires manually executing scripts, remembering package names, and migrating complex configurations by hand.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Goals
|
||||
|
||||
This repository solves these issues by treating the operating system as code, specifically focusing on:
|
||||
|
||||
* **Deterministic Multi-Host Architecture:** Define a shared base system ([modules/](./modules)) while maintaining completely isolated hardware profiles and display managers for specific machines (e.g., Hyprland for the desktop, Niri for the laptop).
|
||||
* **Frictionless Development:** Provide a pre-configured, battle-tested toolchain out of the box for backend and systems programming, specifically optimized for Python, Rust, and Java.
|
||||
* **Modular Shell Environment:** Replace monolithic shell scripts with cleanly separated, single-purpose modules (Git workflows, Wayland clipboard utilities, fuzzy navigation). These are natively compiled into the environment via Nix without relying on brittle source chains.
|
||||
* **Maintainability & Discoverability:** Utilize a logical, flat directory structure that avoids the "hyper-abstraction" trap of overly complex Nix flakes. If a configuration needs to be changed, its location should be immediately obvious.
|
||||
|
||||
---
|
||||
|
||||
## 🚫 Non-Goals
|
||||
|
||||
To keep the system fast and maintainable, this configuration explicitly avoids:
|
||||
|
||||
* **Legacy Display Protocols:** There is no support or fallback for X11; this is a pure Wayland environment.
|
||||
* **Full Desktop Environments (DEs):** Avoiding bloated DEs (like GNOME or KDE) in favor of lightweight, composable window managers and standalone system monitors.
|
||||
* **Over-Engineering Nix:** Avoiding deeply nested Nix functions or custom abstract configuration languages. The goal is to use standard NixOS modules and native file inclusion (`builtins.readFile`) to keep the codebase readable for standard Linux users.
|
||||
|
||||
---
|
||||
|
||||
## 📂 Architecture
|
||||
|
||||
The repository relies on a standard Nix Flake structure to enforce isolation:
|
||||
|
||||
* [flake.nix](./flake.nix): The entry point of the configuration. Defines system inputs, channels, dependencies (like DMS, `dgop`, etc.), and exposes desktop and laptop deployment targets.
|
||||
* [home.nix](./home.nix): Home Manager entrypoint defining the user context (`kiskaadee`) and importing user-space configuration modules.
|
||||
* [hosts/](./hosts): Machine-specific configurations.
|
||||
* [hosts/desktop](./hosts/desktop): Contains [desktop/configuration.nix](./hosts/desktop/configuration.nix) (machine-specific packages/settings) and [desktop/hardware-configuration.nix](./hosts/desktop/hardware-configuration.nix) (autogenerated hardware specifications).
|
||||
* `hosts/laptop`: Laptop hardware configuration and Niri implementation (*under construction*).
|
||||
* [modules/](./modules): Shared configurations applied across hosts.
|
||||
* [modules/system](./modules/system): Core OS-level settings (bootloaders, networking, audio, greetd login manager).
|
||||
* [modules/system/base.nix](./modules/system/base.nix): Hardware-agnostic OS base configuration (Docker, Pipewire, SSH, greetd, environment variables).
|
||||
* [modules/system/graphical.nix](./modules/system/graphical.nix): Settings for DMS (DankMaterialShell) daemon, system monitoring, and dynamic theming.
|
||||
* [modules/user](./modules/user): User-space configurations (Home Manager, Neovim, Alacritty, Tmux, Starship, fastfetch).
|
||||
* [modules/user/base.nix](./modules/user/base.nix): Core shell utilities, Git configuration, fastfetch dashboard, aliases, and shell integration.
|
||||
* [modules/user/apps.nix](./modules/user/apps.nix): User packages (Zen Browser, GIMP, MPV, Cloud SDKs, credentials).
|
||||
* [modules/user/graphical.nix](./modules/user/graphical.nix): Neovim configuration, Neovim plugins, and graphical session targets.
|
||||
* [modules/user/terminal.nix](./modules/user/terminal.nix): Terminal emulator (Alacritty), multiplexer (Tmux), and cross-shell prompt (Starship).
|
||||
* [modules/user/shell/](./modules/user/shell): Extracted, domain-specific shell scripts natively compiled into the shell configuration:
|
||||
* [git.sh](./modules/user/shell/git.sh): Git helpers (`gitignore`, `gacp`, `new-repo`).
|
||||
* [jump.sh](./modules/user/shell/jump.sh): Yazi and fzf-based quick navigation wrappers (`cnf`, `pj`, `jump`, etc.).
|
||||
* [pdf.sh](./modules/user/shell/pdf.sh): Helper functions for decrypting PDFs using `qpdf`.
|
||||
* [quicklinks.sh](./modules/user/shell/quicklinks.sh): Fzf interactive menu for running custom saved web links or commands.
|
||||
* [wayland.sh](./modules/user/shell/wayland.sh): Wayland clipboard integration command wrapper (`wlc`).
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Quick Start / Deployment
|
||||
|
||||
### 1. Clone the Configuration
|
||||
Clone this repository to your home directory (usually target location is `~/Config`):
|
||||
```bash
|
||||
git clone https://github.com/kiskaadee/nixos-config.git ~/Config
|
||||
cd ~/Config
|
||||
```
|
||||
|
||||
### 2. Build and Switch the Configuration
|
||||
To apply the configuration for the first time or rebuild after a change, run the `nixos-rebuild` command pointing to the host's flake target:
|
||||
|
||||
```bash
|
||||
# Rebuild the system for the 'desktop' target
|
||||
sudo nixos-rebuild switch --flake ~/Config#desktop
|
||||
```
|
||||
|
||||
*Note: For convenience, a shell alias `nix-switch` is pre-configured to automatically run this rebuild command for the current host name.*
|
||||
|
||||
### 3. Updating Flake Inputs
|
||||
To update all flake inputs (such as home-manager, nixpkgs, or dms):
|
||||
```bash
|
||||
nix flake update
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🗺️ Roadmap & Next Steps
|
||||
|
||||
Here is the current status of features planned to complete the environment and prepare it for dual-host capability:
|
||||
|
||||
### Phase 1: Complete DankMaterialShell (DMS) Integration
|
||||
* [ ] **Adding Background Blur:** Configure Hyprland compositor to enable background blur under the shell and terminal elements ([DMS CLI Doctor - Compositor Checks](https://danklinux.com/docs/dankmaterialshell/cli-doctor#compositor-checks)).
|
||||
* [ ] **Cups-pk-helper:** Enable and configure `cups-pk-helper` for privileged printer administration checks ([DMS CLI Doctor - Optional Features](https://danklinux.com/docs/dankmaterialshell/cli-doctor#optional-features)).
|
||||
* [ ] **Set Core Fonts:** Ensure proper font styling settings:
|
||||
* **Normal Font:** Configure *Inter Variable* as the default system-wide sans-serif font ([DMS Fonts](https://danklinux.com/docs/dankmaterialshell/cli-doctor#fonts)).
|
||||
* **Monospace Font:** Ensure *Fira Code* is the primary system monospace font for coding.
|
||||
|
||||
### Phase 2: Hardware & Display Greeter Polish
|
||||
* [ ] **Bluetooth Adapter Configuration:** Enable Bluetooth services globally, configure power-on on boot, and enable media controls via Bluetooth.
|
||||
* [ ] **Custom Greetd Configuration:** Clean up the console/login manager setup, styling `tuigreet` or auto-logging to the graphical environment cleanly.
|
||||
|
||||
### Phase 3: Laptop Profile (Multi-Host Readiness)
|
||||
* [ ] Create `./hosts/laptop/configuration.nix` and `./hosts/laptop/hardware-configuration.nix`.
|
||||
* [ ] Integrate the **Niri** compositor as the default desktop environment for the laptop while sharing 100% of the terminal, editor, toolchain, and styling modules.
|
||||
@@ -1,54 +1,70 @@
|
||||
{
|
||||
description = "Kiskaadee's Modular NixOS Configuration";
|
||||
|
||||
# --- External Repositories & Flake Inputs ---
|
||||
# These inputs specify where Nix downloads package sets, tools, and configurations.
|
||||
inputs = {
|
||||
# NixOS Unstable channel - used for bleeding-edge package releases
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
# Home Manager - manages user-space configurations, dotfiles, and shell environments
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.nixpkgs.follows = "nixpkgs"; # Forces home-manager to use the same nixpkgs channel
|
||||
};
|
||||
|
||||
# DankMaterialShell (DMS) - core custom desktop shell environment and panel
|
||||
dms = {
|
||||
url = "github:AvengeMedia/DankMaterialShell";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# dgop - companion system monitoring / daemon utility for DankMaterialShell
|
||||
dgop = {
|
||||
url = "github:AvengeMedia/dgop";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Zen Browser - modern, lightweight, community-maintained browser
|
||||
zen-browser = {
|
||||
url = "github:0xc000022070/zen-browser-flake";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Antigravity CLI - coding companion and local AI agent helper
|
||||
antigravity = {
|
||||
url = "github:jacopone/antigravity-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
# --- System Outputs (Configuration Definitions) ---
|
||||
# Maps host machines to target environments, architecture types, and user settings.
|
||||
outputs = { self, nixpkgs, home-manager, dms, dgop, zen-browser, antigravity, ...}@inputs: {
|
||||
nixosConfigurations = {
|
||||
|
||||
# 🖥️ DESKTOP HOST
|
||||
# Target workstation running Hyprland as the window manager.
|
||||
desktop = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
specialArgs = { inherit inputs; }; # Pass flake inputs into submodules (e.g. system/base.nix)
|
||||
modules = [
|
||||
./hosts/desktop/hardware-configuration.nix
|
||||
./hosts/desktop/configuration.nix
|
||||
./hosts/desktop/hardware-configuration.nix # Autogenerated hardware/disk/CPU module
|
||||
./hosts/desktop/configuration.nix # Desktop environment / system package settings
|
||||
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.nixosModules.home-manager {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.backupFileExtension = "backup"; # Auto-back up conflicting files
|
||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||
home-manager.users.kiskaadee = import ./home.nix;
|
||||
home-manager.users.kiskaadee = import ./home.nix; # Mount home configuration
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# 💻 LAPTOP HOST
|
||||
# Target laptop workstation. Intended to run Niri window manager.
|
||||
# Shares modules/ base, but customizes graphical desktop components.
|
||||
laptop = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
@@ -56,10 +72,10 @@
|
||||
./hosts/laptop/hardware-configuration.nix
|
||||
./hosts/laptop/configuration.nix
|
||||
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.nixosModules.home-manager {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.backupFileExtension = "backup"; # Auto-back up conflicting files
|
||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||
home-manager.users.kiskaadee = import ./home.nix;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
# 🏠 Home Manager Configuration Entrypoint
|
||||
# This module defines the user-space environment config for 'kiskaadee'
|
||||
# across all systems (desktop and laptop).
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Import user-specific modules
|
||||
imports = [
|
||||
./modules/user/base.nix
|
||||
./modules/user/apps.nix
|
||||
./modules/user/graphical.nix
|
||||
./modules/user/terminal.nix
|
||||
./modules/user/base.nix # Core shell configurations, utilities, git aliases
|
||||
./modules/user/apps.nix # User applications (e.g. Zen Browser, media players, SDKs)
|
||||
./modules/user/graphical.nix # Graphical user apps (Neovim configuration, window manager targets)
|
||||
./modules/user/terminal.nix # Terminal emulators and multiplexers (Alacritty, Tmux, Starship)
|
||||
];
|
||||
|
||||
# Home directory settings
|
||||
home.username = "kiskaadee";
|
||||
home.homeDirectory = "/home/kiskaadee";
|
||||
|
||||
# The state version of Home Manager that this configuration is compatible with.
|
||||
# Avoid changing this value even if you upgrade NixOS.
|
||||
home.stateVersion = "26.05";
|
||||
|
||||
# Enable Home Manager to manage itself (creates `home-manager` command)
|
||||
programs.home-manager.enable = true;
|
||||
}
|
||||
@@ -1,33 +1,57 @@
|
||||
# 🖥️ Desktop Machine Configuration
|
||||
# This file defines host-specific system configurations for the Desktop environment.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../../modules/system/graphical.nix
|
||||
../../modules/system/base.nix # Injected Base OS Settings
|
||||
./hardware-configuration.nix # Desktop-specific disk and CPU configuration
|
||||
../../modules/system/graphical.nix # System-wide graphical stack settings (DMS daemon)
|
||||
../../modules/system/base.nix # General hardware-agnostic OS settings
|
||||
];
|
||||
|
||||
nix.settings.experimental-features = ["nix-command" "flakes" ];
|
||||
# Enable experimental Nix features (required for Flakes and newer command line tools)
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# System-wide fonts installed for general window manager / applications
|
||||
fonts.packages = with pkgs; [
|
||||
inter
|
||||
nerd-fonts.fira-code
|
||||
nerd-fonts.jetbrains-mono
|
||||
nerd-fonts.roboto-mono
|
||||
];
|
||||
|
||||
# Configure default fonts for system-wide alias fallbacks
|
||||
fonts.fontconfig = {
|
||||
enable = true;
|
||||
defaultFonts = {
|
||||
monospace = [ "Fira Code" ];
|
||||
sansSerif = [ "Inter" ];
|
||||
};
|
||||
};
|
||||
|
||||
# EFI bootloader configuration
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# Network identification
|
||||
networking.hostName = "desktop";
|
||||
|
||||
# Define the main user profile
|
||||
users.users.kiskaadee = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" "docker" "networkmanager" ];
|
||||
extraGroups = [
|
||||
"wheel" # Enable sudo access for administrative tasks
|
||||
"docker" # Allows running docker commands without sudo
|
||||
"networkmanager" # Allows modifying network configurations
|
||||
];
|
||||
};
|
||||
|
||||
# Host-specific graphical compositor (Hyprland window manager for desktop)
|
||||
programs = {
|
||||
hyprland.enable = true;
|
||||
};
|
||||
|
||||
# Rebuild/State version. Do not modify.
|
||||
system.stateVersion = "26.05";
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
# 💻 Laptop Machine Configuration
|
||||
# This file defines host-specific system configurations for the Laptop environment.
|
||||
# Sharing 100% of base shell, neovim, apps, and terminal settings with desktop,
|
||||
# but swapping the graphical compositor stack to Niri.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../../modules/system/base.nix # General hardware-agnostic OS settings
|
||||
];
|
||||
|
||||
# Enable experimental Nix features (required for Flakes and newer command line tools)
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# System-wide fonts installed for general window manager / applications
|
||||
fonts.packages = with pkgs; [
|
||||
inter
|
||||
nerd-fonts.fira-code
|
||||
nerd-fonts.jetbrains-mono
|
||||
nerd-fonts.roboto-mono
|
||||
];
|
||||
|
||||
# Configure default fonts for system-wide alias fallbacks
|
||||
fonts.fontconfig = {
|
||||
enable = true;
|
||||
defaultFonts = {
|
||||
monospace = [ "Fira Code" ];
|
||||
sansSerif = [ "Inter" ];
|
||||
};
|
||||
};
|
||||
|
||||
# EFI bootloader configuration
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# Network identification
|
||||
networking.hostName = "laptop";
|
||||
|
||||
# Define the main user profile
|
||||
users.users.kiskaadee = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"wheel" # Enable sudo access for administrative tasks
|
||||
"docker" # Allows running docker commands without sudo
|
||||
"networkmanager" # Allows modifying network configurations
|
||||
];
|
||||
};
|
||||
|
||||
# Host-specific graphical compositor (Niri window manager for laptop)
|
||||
programs.niri.enable = true;
|
||||
|
||||
# Override greetd to launch Niri compositor instead of Hyprland on the laptop
|
||||
services.greetd.settings.default_session.command = lib.mkForce "${pkgs.tuigreet}/bin/tuigreet --time --remember --remember-session --asterisks --greeting '❄️ Declarative NixOS Workstation' --cmd niri";
|
||||
|
||||
# Rebuild/State version. Do not modify.
|
||||
system.stateVersion = "26.05";
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
# 💻 Laptop Hardware Configuration
|
||||
# This file is placeholder code and should be regenerated on the physical laptop via:
|
||||
# `nixos-generate-config --dir ./hosts/laptop`
|
||||
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usbhid" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-label/boot";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0022" "dmask=0022" ];
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
||||
+48
-22
@@ -1,47 +1,73 @@
|
||||
# This is the place for all hardware-agnostic OS settings
|
||||
# ⚙️ Hardware-Agnostic Base System Configuration
|
||||
# This file contains common system configurations shared by all machines (desktop, laptop).
|
||||
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
# Regional and Language settings
|
||||
time.timeZone = "America/Bogota";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
# Enable network management daemon
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
# Enable virtualisation / Docker container daemon
|
||||
virtualisation.docker.enable = true;
|
||||
|
||||
# Sound daemon configuration using modern Pipewire backend
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
pulse.enable = true;
|
||||
pulse.enable = true; # Enable legacy PulseAudio emulation wrapper
|
||||
};
|
||||
|
||||
# Enable printing service
|
||||
services.printing.enable = true;
|
||||
|
||||
# Install cups-pk-helper to register PolicyKit and DBus printer configuration policies
|
||||
environment.systemPackages = with pkgs; [
|
||||
cups-pk-helper
|
||||
];
|
||||
|
||||
# SSH daemon settings for secure remote command execution
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
ports = [ 22 ];
|
||||
settings.PermitRootLogin = "no";
|
||||
settings.PermitRootLogin = "no"; # Security: disable root ssh login
|
||||
};
|
||||
|
||||
# Wayland Native TUI Greeter
|
||||
services.greetd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
default_session = {
|
||||
# This will default to Hyprland. We will override this on the laptop later.
|
||||
command = "${pkgs.tuigreet}/bin/tuigreet --time --cmd start-hyprland";
|
||||
};
|
||||
# 📶 Bluetooth Configuration
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
powerOnBoot = true; # Automatically power on the Bluetooth adapter at boot
|
||||
};
|
||||
services.blueman.enable = true; # Enable Blueman DBus/Applet service integrations
|
||||
|
||||
# 🚪 Wayland Native TUI Greeter (greetd + tuigreet)
|
||||
services.greetd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
default_session = {
|
||||
# Command executed when the system displays the login prompt.
|
||||
# Customized with flags (remember user, asterisks, custom header greeting) for a cleaner login UI.
|
||||
command = "${pkgs.tuigreet}/bin/tuigreet --time --remember --remember-session --asterisks --greeting '❄️ Declarative NixOS Workstation' --cmd start-hyprland";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Suppress greeter startup messages for a clean boot
|
||||
systemd.services.greetd.serviceConfig = {
|
||||
Type = "idle";
|
||||
StandardInput = "tty";
|
||||
StandardOutput = "tty";
|
||||
StandardError = "journal";
|
||||
TTYReset = true;
|
||||
TTYVHangup = true;
|
||||
TTYVTDisallocate = true;
|
||||
};
|
||||
# Clean boot configuration for the greeter
|
||||
# Suppresses systemd diagnostic messages on tty1 so the greeter loads cleanly.
|
||||
systemd.services.greetd.serviceConfig = {
|
||||
Type = "idle";
|
||||
StandardInput = "tty";
|
||||
StandardOutput = "tty";
|
||||
StandardError = "journal";
|
||||
TTYReset = true;
|
||||
TTYVHangup = true;
|
||||
TTYVTDisallocate = true;
|
||||
};
|
||||
|
||||
# Ensure Wayland variables are globally set
|
||||
# Global environment variables
|
||||
# NIXOS_OZONE_WL forces Electron / Chromium applications (like Discord or VSCode)
|
||||
# to natively execute under Wayland instead of fallback XWayland.
|
||||
environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
}
|
||||
@@ -1,22 +1,26 @@
|
||||
# 🎨 Graphical Environment System Module
|
||||
# Configures system-wide services and integrations for DankMaterialShell (DMS).
|
||||
|
||||
{inputs, pkgs, ...}:
|
||||
|
||||
{
|
||||
# Enable the native NixOS module
|
||||
# Configure the DMS graphical helper/shell service daemon.
|
||||
# DMS handles background management, panels, and notifications.
|
||||
programs.dms-shell = {
|
||||
enable = true;
|
||||
|
||||
# Override the package binary with the latest build from the flake input
|
||||
# Override standard nixpkgs package binary with the bleeding-edge flake output.
|
||||
package = inputs.dms.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||
|
||||
# Autostart daemon configuration
|
||||
# Run the DMS daemon as a Systemd user service.
|
||||
# Automatically restarts the daemon whenever the NixOS configuration changes.
|
||||
systemd.enable = true;
|
||||
systemd.restartIfChanged = true;
|
||||
|
||||
|
||||
## see: https://danklinux.com/docs/dgop/
|
||||
# dgop.package = inputs.dgop.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||
enableSystemMonitoring = true;
|
||||
enableDynamicTheming = true;
|
||||
enableClipboardPaste = true;
|
||||
# DMS System Options
|
||||
# Refer to documentation: https://danklinux.com/docs/dgop/
|
||||
enableSystemMonitoring = true; # Enables daemon hooks for gathering memory, CPU, and disk metrics
|
||||
enableDynamicTheming = true; # Automatically applies system-wide material palettes to shells and apps
|
||||
enableClipboardPaste = true; # Bridges terminal and Wayland clipboard buffers seamlessly
|
||||
};
|
||||
}
|
||||
+17
-7
@@ -1,17 +1,27 @@
|
||||
# 📦 User Applications Configuration
|
||||
# This file declares standalone user-space binaries managed by Home Manager.
|
||||
|
||||
{ inputs, pkgs, ... }:
|
||||
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
# Custom Flake injections
|
||||
# Custom Flake injections: Google Antigravity CLI helper
|
||||
inputs.antigravity.packages.${pkgs.stdenv.hostPlatform.system}.google-antigravity-cli
|
||||
|
||||
# Media & Editing
|
||||
mpv gimp
|
||||
# Media & Image editing
|
||||
mpv # Fast, scriptable, keyboard-driven CLI media player
|
||||
gimp # GNU Image Manipulation Program for graphical assets
|
||||
|
||||
# Cloud & Archiving
|
||||
google-cloud-sdk turso-cli wget zip unzip rsync aria2
|
||||
# Cloud CLI, Database Management & Archive tools
|
||||
google-cloud-sdk # GCP administration utilities
|
||||
turso-cli # Management interface for Turso libSQL cloud databases
|
||||
wget # Standard network file downloader
|
||||
zip # File archiving utility
|
||||
unzip # Extraction utility for .zip files
|
||||
rsync # Efficient incremental file transfer tool
|
||||
aria2 # High-speed multi-protocol download utility
|
||||
|
||||
# Secrets
|
||||
rbw
|
||||
# Secrets Management
|
||||
rbw # Unofficial command line client for Bitwarden
|
||||
];
|
||||
}
|
||||
+24
-11
@@ -1,8 +1,13 @@
|
||||
# 🛠️ User Base Shell & Git Environment
|
||||
# This module defines the foundation of the interactive user shell, command line utilities,
|
||||
# custom shell scripts, aliases, and Git workflows.
|
||||
|
||||
{ pkgs, ...}:
|
||||
|
||||
{
|
||||
programs = {
|
||||
# Version Control
|
||||
# 🌟 Git Version Control Configuration
|
||||
# Declares default user identity, global conflict styles, and highly optimized git aliases
|
||||
git = {
|
||||
enable = true;
|
||||
settings = {
|
||||
@@ -53,7 +58,8 @@
|
||||
};
|
||||
};
|
||||
|
||||
# Core Environment Management
|
||||
# ⚡ Direnv - Automatic environment loading
|
||||
# Automatically activates nix development shells when entering project directories containing .envrc
|
||||
direnv = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
@@ -75,7 +81,8 @@
|
||||
};
|
||||
};
|
||||
|
||||
### Navigation
|
||||
# 🗺️ Navigation & Directory Listing
|
||||
# Modern replacements for traditional cd, ls, and grep tools.
|
||||
zoxide = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
@@ -105,11 +112,13 @@
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Bash Shell Config
|
||||
# 🐚 Bash Shell Configuration
|
||||
# Bridges the Arch 'bash-custom' environment to NixOS, defining aliases and sourcing modular scripts.
|
||||
bash = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
enableCompletion = true; # Enable programmable auto-completion for system commands
|
||||
|
||||
# Shell Aliases for speed, productivity, and command overrides
|
||||
shellAliases = {
|
||||
zed = "zeditor";
|
||||
reload = "exec bash";
|
||||
@@ -164,14 +173,17 @@
|
||||
gadc = "git add -A && git diff --staged | wl-copy";
|
||||
};
|
||||
|
||||
# Inject modular shell helper scripts directly into .bashrc.
|
||||
# This allows us to keep discrete logic files without cluttering home.nix or base.nix.
|
||||
bashrcExtra = ''
|
||||
${builtins.readFile ./shell/wayland.sh}
|
||||
${builtins.readFile ./shell/git.sh}
|
||||
${builtins.readFile ./shell/pdf.sh}
|
||||
${builtins.readFile ./shell/quicklinks.sh}
|
||||
${builtins.readFile ./shell/jump.sh}
|
||||
${builtins.readFile ./shell/wayland.sh} # Wayland clipboard helper (wlc)
|
||||
${builtins.readFile ./shell/git.sh} # Git workflow automations (gacp, gitignore)
|
||||
${builtins.readFile ./shell/pdf.sh} # Command line PDF decryption helper
|
||||
${builtins.readFile ./shell/quicklinks.sh} # Interactive fzf web launcher
|
||||
${builtins.readFile ./shell/jump.sh} # Directory jumper & interactive fuzzy navigation
|
||||
|
||||
# --- Visual Entry ---
|
||||
# Display system information dashboard upon opening interactive shells
|
||||
if [[ $- == *i* ]]; then
|
||||
fastfetch --logo none
|
||||
fi
|
||||
@@ -179,7 +191,8 @@
|
||||
};
|
||||
};
|
||||
|
||||
# Custom Catnap-style Fastfetch
|
||||
# 📊 Custom Catnap-style Fastfetch
|
||||
# A stylized, minimalist system information dashboard displayed on shell startup
|
||||
programs.fastfetch = {
|
||||
enable = true;
|
||||
settings = {
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
# ❄️ Hyprland Compositor Configuration
|
||||
# This file is managed declaratively via Home Manager.
|
||||
# It defines compositor behavior, decoration properties (like background blur), and keybindings.
|
||||
|
||||
# --- Monitor Setup ---
|
||||
# Automatically detect and configure display scale and resolution
|
||||
monitor=,preferred,auto,auto
|
||||
|
||||
# --- General Properties ---
|
||||
general {
|
||||
gaps_in = 5
|
||||
gaps_out = 10
|
||||
border_size = 2
|
||||
col.active_border = rgba(cdd6f4ee)
|
||||
col.inactive_border = rgba(595959aa)
|
||||
layout = dwindle
|
||||
}
|
||||
|
||||
# --- Visual Styling & Decoration ---
|
||||
decoration {
|
||||
rounding = 10
|
||||
|
||||
# 🌪️ Background Blur Configuration
|
||||
# Required to support DankMaterialShell translucent dynamic components and blur checks
|
||||
blur {
|
||||
enabled = true
|
||||
size = 8
|
||||
passes = 3
|
||||
newOptimizations = true
|
||||
ignore_opacity = true # Apply blur regardless of window transparency levels
|
||||
}
|
||||
}
|
||||
|
||||
# --- Compositor Layer Rules ---
|
||||
# Forces background blur rendering underneath DankMaterialShell panels and menus
|
||||
layerrule = blur, dms
|
||||
layerrule = ignorezero, dms
|
||||
layerrule = blur, dms-shell
|
||||
layerrule = ignorezero, dms-shell
|
||||
|
||||
# --- Window Rules ---
|
||||
# Sets default opacity to ensure the terminal window background displays blur nicely
|
||||
windowrulev2 = opacity 0.95 0.95, class:^(Alacritty)$
|
||||
|
||||
# --- Key Bindings ---
|
||||
$mainMod = SUPER
|
||||
|
||||
# Base Application Launchers
|
||||
bind = $mainMod, Return, exec, alacritty
|
||||
bind = $mainMod, Q, killactive,
|
||||
bind = $mainMod, M, exit,
|
||||
bind = $mainMod, V, togglefloating,
|
||||
bind = $mainMod, R, exec, wofi --show drun
|
||||
bind = $mainMod, P, pseudo, # dwindle
|
||||
bind = $mainMod, J, togglesplit, # dwindle
|
||||
|
||||
# Workspace Navigation (Vim-style navigation)
|
||||
bind = $mainMod, h, movefocus, l
|
||||
bind = $mainMod, l, movefocus, r
|
||||
bind = $mainMod, k, movefocus, u
|
||||
bind = $mainMod, j, movefocus, d
|
||||
|
||||
# Switch Workspaces
|
||||
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 Window 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
|
||||
|
||||
# Mouse Bindings (Move / Resize)
|
||||
bindm = $mainMod, mouse:272, movewindow
|
||||
bindm = $mainMod, mouse:273, resizewindow
|
||||
+27
-16
@@ -1,26 +1,34 @@
|
||||
# 🎨 User Graphical Module
|
||||
# Configures graphical workspace tools, text editors, and session unit targets.
|
||||
|
||||
{ inputs, pkgs, ...}:
|
||||
{
|
||||
# Mount custom Hyprland configuration file declaratively
|
||||
home.file.".config/hypr/hyprland.conf".text = builtins.readFile ./config/hyprland.conf;
|
||||
|
||||
# Graphical packages managed via Home Manager
|
||||
home.packages = with pkgs; [
|
||||
inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default
|
||||
zed-editor
|
||||
inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default # Modern browser build
|
||||
zed-editor # GPU-accelerated desktop text editor
|
||||
];
|
||||
|
||||
# Neovim configuration
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
defaultEditor = true; # Make neovim the default `$EDITOR`
|
||||
viAlias = true; # Symlink `vi` to `nvim`
|
||||
vimAlias = true; # Symlink `vim` to `nvim`
|
||||
|
||||
## Core settings
|
||||
## Core Editor Settings (Lua-based)
|
||||
initLua = ''
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.wrap = false
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.number = true -- Show line numbers
|
||||
vim.opt.relativenumber = true -- Relative line numbers for easier navigation jumps
|
||||
vim.opt.shiftwidth = 2 -- 2-space indents
|
||||
vim.opt.tabstop = 2 -- Tab spacing
|
||||
vim.opt.expandtab = true -- Convert tabs to spaces
|
||||
vim.opt.smartindent = true -- Intelligent auto-indenting based on file syntax
|
||||
vim.opt.wrap = false -- Disable automatic line wrapping
|
||||
vim.opt.termguicolors = true -- Enable 24-bit RGB terminal colors
|
||||
'';
|
||||
|
||||
## Declarative Plugin Management
|
||||
@@ -33,9 +41,9 @@
|
||||
vim.cmd("packadd catppuccin-nvim")
|
||||
vim.cmd("colorscheme catppuccin-mocha")
|
||||
'';
|
||||
}
|
||||
}
|
||||
|
||||
# Advanced Syntax Highlighting for Python, Rust and Nix
|
||||
# Advanced Syntax Highlighting for developer workflows (Python, Rust, Java, Nix)
|
||||
(nvim-treesitter.withPlugins (p: with p; [
|
||||
python
|
||||
rust
|
||||
@@ -48,6 +56,9 @@
|
||||
];
|
||||
};
|
||||
|
||||
# ⚙️ Systemd user session targets for window managers
|
||||
# This target allows user services (like background daemons, screenshot helpers) to bind
|
||||
# to the graphical workspace startup cycle correctly.
|
||||
systemd.user.targets.hyprland-session = {
|
||||
Unit = {
|
||||
Description = "Hyprland graphical session";
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
# --- Git Automation ---
|
||||
# 🌟 Custom Git Automation & Helper Utilities
|
||||
# Sourced in .bashrc to streamline gitignore modifications, commit-push workflows, and new repo setups.
|
||||
|
||||
# 1. gitignore: Quickly appends patterns to the repository's root .gitignore file
|
||||
# then automatically commits and pushes the change.
|
||||
gitignore() {
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: gitignore <pattern> [pattern...]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Find the top-level repository directory path
|
||||
local GIT_ROOT=$(git rev-parse --show-toplevel 2> /dev/null)
|
||||
if [ -z "$GIT_ROOT" ]; then
|
||||
echo "Error: Not a Git repository."
|
||||
@@ -18,6 +22,7 @@ gitignore() {
|
||||
touch "$GIT_IGNORE_FILE"
|
||||
fi
|
||||
|
||||
# Ensure the gitignore file ends with a trailing newline if it has content
|
||||
if [ -s "$GIT_IGNORE_FILE" ] && [ "$(tail -c1 "$GIT_IGNORE_FILE" | wc -l)" -eq 0 ]; then
|
||||
echo "" >> "$GIT_IGNORE_FILE"
|
||||
fi
|
||||
@@ -26,6 +31,7 @@ gitignore() {
|
||||
local commit_msg_list=""
|
||||
|
||||
for pattern in "$@"; do
|
||||
# Check if the pattern is already present in the .gitignore file
|
||||
if rg -Fxq "$pattern" "$GIT_IGNORE_FILE"; then
|
||||
echo "Skipping '$pattern' (already in .gitignore)"
|
||||
else
|
||||
@@ -36,6 +42,7 @@ gitignore() {
|
||||
fi
|
||||
done
|
||||
|
||||
# If any patterns were added, commit and push them automatically
|
||||
if [ $added_count -gt 0 ]; then
|
||||
commit_msg_list="${commit_msg_list%, }"
|
||||
echo "Committing and pushing changes..."
|
||||
@@ -47,6 +54,8 @@ gitignore() {
|
||||
fi
|
||||
}
|
||||
|
||||
# 2. gacp: Git Add, Commit, and Push shorthand
|
||||
# Performs a global staging, commits with the specified message, and pushes to origin on the active branch.
|
||||
gacp() {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: gacp <commit-message>"
|
||||
@@ -59,6 +68,7 @@ gacp() {
|
||||
echo "Pushed to origin/${branch_name}"
|
||||
}
|
||||
|
||||
# 3. new-repo: Initializes a new directory, git repository, and pushes it to GitHub via 'gh' CLI.
|
||||
new-repo() {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: new-repo <repository-name>"
|
||||
@@ -71,5 +81,6 @@ new-repo() {
|
||||
echo "# $repo_name" > README.md
|
||||
touch .gitignore LICENSE
|
||||
git add -A && git commit -m "Initial commit"
|
||||
# Call the GitHub CLI tool to create the repository on GitHub
|
||||
gh repo create "$repo_name" --public --source=. --remote=origin --push
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
# Yazi Sticky Navigation
|
||||
# 🗺️ Fuzzy Navigation & Directory Jump Helpers
|
||||
# Sourced in .bashrc to provide quick, interactive folder traversal using Yazi and fzf.
|
||||
|
||||
# 1. fm: Interactive file manager wrapper using Yazi.
|
||||
# Synchronizes the active terminal shell working directory to Yazi's exit folder (sticky directory).
|
||||
fm() {
|
||||
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
|
||||
yazi "$@" --cwd-file="$tmp"
|
||||
@@ -8,7 +12,7 @@ fm() {
|
||||
rm -f -- "$tmp"
|
||||
}
|
||||
|
||||
# --- Fuzzy Jumpers ---
|
||||
# 2. _fuzzy_select_dir: Internal helper to locate subdirectories using fd and fzf.
|
||||
_fuzzy_select_dir() {
|
||||
local base="$1"
|
||||
local query="$2"
|
||||
@@ -18,6 +22,7 @@ _fuzzy_select_dir() {
|
||||
fzf --query="$query" --select-1 --exit-0
|
||||
}
|
||||
|
||||
# 3. _fuzzy_select_dir_preview: Internal helper displaying eza directory previews inside fzf.
|
||||
_fuzzy_select_dir_preview() {
|
||||
local base="$1"
|
||||
local query="$2"
|
||||
@@ -29,6 +34,7 @@ _fuzzy_select_dir_preview() {
|
||||
--preview-window="right:50%:rounded"
|
||||
}
|
||||
|
||||
# 4. _jump_to: Internal helper to safely enter a target folder and optionally list contents.
|
||||
_jump_to() {
|
||||
local dir="$1"
|
||||
[[ -d "$dir" ]] || return 1
|
||||
@@ -39,12 +45,15 @@ _jump_to() {
|
||||
fi
|
||||
}
|
||||
|
||||
# 5. jump: Primary entrypoint for fuzzy folder traversal.
|
||||
# Finds a directory under the base path and enters it.
|
||||
jump() {
|
||||
local dir
|
||||
dir=$(_fuzzy_select_dir_preview "$1" "$2" "${3:-2}") || return
|
||||
_jump_to "$dir"
|
||||
}
|
||||
|
||||
# 6. _fuzzy_search_dir: Locates files containing text, and returns their parent directory.
|
||||
_fuzzy_search_dir() {
|
||||
local base="$1"
|
||||
local query="$2"
|
||||
@@ -55,26 +64,30 @@ _fuzzy_search_dir() {
|
||||
fzf --header "Search: $query"
|
||||
}
|
||||
|
||||
# 7. jump_search: Traverses to a directory that contains a file matching a query.
|
||||
jump_search() {
|
||||
local dir
|
||||
dir=$(_fuzzy_search_dir "$1" "$2") || return
|
||||
_jump_to "$dir"
|
||||
}
|
||||
|
||||
# 8. edit_dir: Fuzzy selects a Project folder and opens Neovim directly in it.
|
||||
edit_dir() {
|
||||
local dir
|
||||
dir=$(_fuzzy_select_dir "$HOME/Projects") || return
|
||||
nvim "$dir"
|
||||
}
|
||||
|
||||
# 9. copy_dir: Fuzzy selects a directory and copies its absolute path to the clipboard.
|
||||
copy_dir() {
|
||||
local dir
|
||||
dir=$(_fuzzy_select_dir "$HOME") || return
|
||||
printf "%s" "$dir" | wl-copy
|
||||
}
|
||||
|
||||
cnf() { jump "$HOME/Config" "$1" 2; }
|
||||
pj() { jump "$HOME/Projects" "$1"; }
|
||||
dl() { jump "$HOME/Downloads" "$1"; }
|
||||
pd() { jump "$HOME/Production" "$1"; }
|
||||
md() { jump "/media"; }
|
||||
# 10. Shorthand Navigation Aliases
|
||||
cnf() { jump "$HOME/Config" "$1" 2; } # Quickly jump inside ~/Config modules
|
||||
pj() { jump "$HOME/Projects" "$1"; } # Jump into local workspace projects
|
||||
dl() { jump "$HOME/Downloads" "$1"; } # Jump to Downloads
|
||||
pd() { jump "$HOME/Production" "$1"; } # Jump to Production folder
|
||||
md() { jump "/media"; } # Jump to /media mounted storage
|
||||
@@ -1,10 +1,15 @@
|
||||
# --- PDF Utilities ---
|
||||
# 📄 Command Line PDF Utilities
|
||||
# Sourced in .bashrc to provide quick file operations on PDF documents.
|
||||
|
||||
# 1. pdf_dc: Decrypts a password-protected PDF document.
|
||||
# Uses 'qpdf' under the hood. Automatically searches for a default password ("defpass")
|
||||
# in the user's local secrets environment file (`~/Secrets/.env`) if no password argument is supplied.
|
||||
pdf_dc() {
|
||||
local env_file="$HOME/Secrets/.env"
|
||||
local input_file="$1"
|
||||
local password="$2"
|
||||
|
||||
# Attempt to auto-load password from environment if none was provided on the CLI
|
||||
if [[ -z "$password" ]]; then
|
||||
if [[ -f "$env_file" ]]; then
|
||||
local defpass
|
||||
@@ -25,6 +30,7 @@ pdf_dc() {
|
||||
|
||||
local output_file="${input_file%.pdf}_decrypted.pdf"
|
||||
|
||||
# Handle file overwrite prompts
|
||||
if [[ -f "$output_file" ]]; then
|
||||
echo "Error: Output file '$output_file' already exists."
|
||||
read -p "Do you want to overwrite it? (y/n): " overwrite
|
||||
@@ -35,6 +41,7 @@ pdf_dc() {
|
||||
fi
|
||||
|
||||
echo "Decrypting $input_file..."
|
||||
# Execute qpdf tool to perform decryption
|
||||
if qpdf --password="$password" --decrypt "$input_file" "$output_file"; then
|
||||
echo "✅ Decryption successful: $output_file"
|
||||
else
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# --- Quicklinks Launcher ---
|
||||
# 🚀 Quicklinks Launcher Utility
|
||||
# Sourced in .bashrc to provide an interactive bookmarks and command-launcher interface.
|
||||
# Parses a pipe-separated config file (`~/.quicklinks`) containing custom CLI commands or URLs.
|
||||
|
||||
# 1. quicklinks: Evaluates custom commands stored in the `~/.quicklinks` list.
|
||||
quicklinks() {
|
||||
local CONFIG_FILE="$HOME/.quicklinks"
|
||||
local SELECTED_LINE
|
||||
local COMMAND
|
||||
|
||||
# Create a boilerplate/template configuration file if it doesn't already exist
|
||||
if [[ ! -f "$CONFIG_FILE" ]]; then
|
||||
echo "--------------------------------------------------------"
|
||||
echo "⚠️ Quicklinks file not found!"
|
||||
@@ -21,6 +25,7 @@ quicklinks() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Display configured entries using bat syntax-highlighting and search interactively using fzf
|
||||
SELECTED_LINE=$(bat "$CONFIG_FILE" | fzf \
|
||||
--style full \
|
||||
--height 40% --layout reverse --border \
|
||||
@@ -29,6 +34,7 @@ quicklinks() {
|
||||
|
||||
[[ -z "$SELECTED_LINE" ]] && return 0
|
||||
|
||||
# Extract the third field (the bash command) and strip leading/trailing spaces
|
||||
COMMAND=$(echo "$SELECTED_LINE" | cut -d'|' -f3- | sed 's/^[[:space:]]*//')
|
||||
|
||||
echo "🚀 Executing: $COMMAND"
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
# --- Wayland Utilities ---
|
||||
# 📋 Custom Wayland Desktop Utilities
|
||||
# Sourced in .bashrc to provide command-line utilities optimized for Wayland compositor environments.
|
||||
|
||||
# Execute command and copy output to Wayland clipboard while viewing it
|
||||
# 1. wlc: Executing a command, printing output to terminal, and concurrently piping output into the Wayland clipboard.
|
||||
# Optional `-h` or `--headers` inserts a command/time header at the top of clipboard content.
|
||||
wlc() {
|
||||
local header_mode=false
|
||||
local cmd_str
|
||||
|
||||
# Process script command line flags
|
||||
while [[ "$#" -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-h|--headers) header_mode=true; shift ;;
|
||||
@@ -20,6 +23,7 @@ wlc() {
|
||||
|
||||
cmd_str="$*"
|
||||
|
||||
# Execute and output
|
||||
{
|
||||
if [[ "$header_mode" == true ]]; then
|
||||
printf "# Command: %s\n" "$cmd_str"
|
||||
@@ -27,5 +31,5 @@ wlc() {
|
||||
printf "# Type: combined (stdout/stderr)\n\n"
|
||||
fi
|
||||
"$@" 2>&1
|
||||
} | tee >(wl-copy)
|
||||
} | tee >(wl-copy) # Output to terminal and copy to clipboard buffer using wl-copy
|
||||
}
|
||||
+29
-21
@@ -1,69 +1,77 @@
|
||||
# 🖥️ Terminal Environment configuration
|
||||
# Defines user-space preferences for Alacritty, Tmux, and Starship.
|
||||
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
# GPU-Accelerated Terminal Emulator
|
||||
# GPU-Accelerated Terminal Emulator (Alacritty)
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
window = {
|
||||
padding = { x = 10; y = 10; };
|
||||
decorations = "none";
|
||||
opacity = 0.95;
|
||||
padding = { x = 10; y = 10; }; # Padding to avoid text hugging window borders
|
||||
decorations = "none"; # Frameless windows for clean tiling layouts
|
||||
opacity = 0.95; # Subtle background translucency
|
||||
};
|
||||
font = {
|
||||
# Font settings. (Nerd Font version required for UI icons)
|
||||
normal = { family = "JetBrainsMono Nerd Font"; style = "Regular"; };
|
||||
size = 12.0;
|
||||
};
|
||||
colors = {
|
||||
primary = {
|
||||
background = "#1e1e2e"; # Catppuccin Mocha Base
|
||||
foreground = "#cdd6f4"; # Catppuccin Mocha Text
|
||||
background = "#1e1e2e"; # Catppuccin Mocha Base (Dark Theme)
|
||||
foreground = "#cdd6f4"; # Catppuccin Mocha Text (Light grey)
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Terminal Multiplexer
|
||||
# Terminal Multiplexer (Tmux)
|
||||
# Allows maintaining persistent shell sessions, window splitting, and tabs.
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
shortcut = "a"; # Maps prefix to Ctrl+a
|
||||
baseIndex = 1;
|
||||
newSession = true;
|
||||
escapeTime = 0;
|
||||
mouse = true;
|
||||
shortcut = "a"; # Remaps Tmux prefix key to `Ctrl+a` (similar to GNU Screen)
|
||||
baseIndex = 1; # Sets starting window index to 1 (matching keyboard layout)
|
||||
newSession = true; # Spawns a new session automatically when calling tmux attach
|
||||
escapeTime = 0; # Zero latency for Vim mode transitions (removes Esc lag)
|
||||
mouse = true; # Enables scrollback navigation and pane resizing using the mouse pointer
|
||||
terminal = "tmux-256color";
|
||||
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
catppuccin
|
||||
vim-tmux-navigator
|
||||
catppuccin # Visual styling matching system theme
|
||||
vim-tmux-navigator # Seamless navigation switching between Vim panes and Tmux splits (Ctrl+h/j/k/l)
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
# Enable True Color (24-bit) support for Neovim themes
|
||||
# Enable True Color (24-bit RGB) support inside Tmux for editor colorschemes
|
||||
set -ag terminal-overrides ",xterm-256color:RGB"
|
||||
|
||||
# Vim-style pane switching
|
||||
# Vim-style bindings for switching between active Tmux panes
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
|
||||
# Status bar position
|
||||
# Place status bar at the top of the terminal screen rather than the bottom
|
||||
set-option -g status-position top
|
||||
'';
|
||||
};
|
||||
|
||||
# Cross-Shell Prompt
|
||||
# Cross-Shell Prompt (Starship)
|
||||
# A highly customizable, language-aware shell status prompt.
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
enableBashIntegration = true; # Mount prompt configuration inside Bash shells
|
||||
settings = {
|
||||
add_newline = false;
|
||||
add_newline = false; # Do not add empty lines before the prompt line
|
||||
character = {
|
||||
success_symbol = "[➜](bold green)";
|
||||
error_symbol = "[➜](bold red)";
|
||||
};
|
||||
directory = {
|
||||
style = "bold blue";
|
||||
truncate_to_repo = true;
|
||||
truncate_to_repo = true; # Hides directory path prefixes when navigating inside Git repositories
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user