diff --git a/.sops.yaml b/.sops.yaml deleted file mode 100644 index e8a10f1..0000000 --- a/.sops.yaml +++ /dev/null @@ -1,12 +0,0 @@ -keys: - - &server age18q3lr2z4yeg2f86my42ym4hx0dvcwgjshmchyhdkgwvf4k37dsyq3mcjse - - &laptop age1pln9sxy5j93lklqklfwp3qepx7x4cs4y2w63n9y3ykt68qgra5ysqleesg - -creation_rules: - - path_regex: hosts/(server|laptop)/secrets\.yaml$ - key_groups: - - pgp: [] - age: - - *server - - *laptop - diff --git a/README.md b/README.md index 04c846a..dc94186 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,6 @@ sudo nixos-rebuild switch --flake ~/Config#laptop * [Package & Secrets Workflow Guide](docs/package-and-secrets.md) — Steps for adding custom applications and managing secrets. * [System Maintenance Guide](docs/system-maintenance.md) — Instructions for safe system updates, health checking, and garbage collection. * [Declarative Development Environments](docs/development-environments.md) — How to use nix-shell, devShells, direnv, and uv for project isolation. -* [Secrets Management Details](docs/secrets-management.md) — Secure storage bootstrapping using `sops-nix` and `age`. +* [Secrets Management Guide](docs/secrets-management.md) — GitOps secrets workflow using SOPS and age for homelab Core management. * [Tmux Terminal Multiplexer](docs/tmux.md) — Fast navigation bindings, layouts, and pane splits guide. * [Google Antigravity Setup](docs/antigravity.md) — Technical instructions for packaging and using the Antigravity agent CLI on NixOS. diff --git a/architecture.md b/architecture.md index 090000d..2629ecc 100644 --- a/architecture.md +++ b/architecture.md @@ -4,12 +4,13 @@ This repository manages a purely declarative NixOS and Home Manager configuration for a standalone mobile workstation host (`laptop`). -1. **Git is the Source of Truth**: Every persistent system setting, user dotfile, and toolchain declaration must be declaratively defined within this repository. -2. **Domain-Driven Cohesion**: Configuration is organized by functional domain (`core`, `hardware`, `desktop`, `dev`, `shell`) rather than artificial host tiers or defensive multi-machine boundaries. +1. **Git is the Source of Truth for Configuration**: Every persistent configuration decision intended to be reproducible is declaratively defined within this repository. Dynamic runtime state (SSH host private keys, machine-id, user application state, caches, browser profiles, and Docker volumes) lives outside the declarative boundary. +2. **Domain-Driven Cohesion**: Configuration is organized by functional domain (`core`, `hardware`, `desktop`, `dev`, `shell`) rather than artificial multi-machine abstractions. 3. **Privilege Boundary Separation**: - **`system/` (Root/NixOS)**: Governs hardware, kernel, bootloader, base OS daemons, and system-level compositor enablement. - **`home/` (User/Home Manager)**: Governs user dotfiles, application settings, toolchains, and desktop keybindings inside `/home/kiskaadee`. 4. **Decoupled Homelab Infrastructure**: Production server daemons, Docker stacks, Traefik edge routing, and DDNS automation are maintained independently in the [Core](file:///home/kiskaadee/Projects/active/homelab/Core) repository. +5. **Workstation Remote Access ≠ Server Infrastructure**: Local system daemons (such as the OpenSSH server) are legitimate workstation facilities for LAN access, remote editor attachments, and file transfers. They do not constitute "server infrastructure," which refers to independently operated application workloads and edge proxies. --- @@ -17,20 +18,20 @@ This repository manages a purely declarative NixOS and Home Manager configuratio ```text Config/ -├── flake.nix # Flake inputs and nixosConfigurations.laptop entrypoint +├── flake.nix # Flake inputs and composition root for nixosConfigurations.laptop ├── flake.lock # Pinned dependency revisions │ ├── system/ # NixOS system-level configuration (root / privileged) │ ├── default.nix # System composition entrypoint │ ├── hardware-configuration.nix # Generated hardware scan (disks, CPU, kernel modules) │ ├── core.nix # Base OS: networking, users, locale, openssh, nix-ld -│ ├── hardware.nix # Laptop hardware: power daemon, upower, PipeWire, bluetooth, printing, docker -│ └── desktop.nix # Desktop stack: Niri compositor, DMS, greetd, fonts +│ ├── hardware.nix # Machine services & peripherals: power, PipeWire, bluetooth, printing, docker +│ └── desktop.nix # Desktop stack: Niri compositor, DMS daemon, greetd, fonts │ ├── home/ # Home Manager user-level configuration (kiskaadee) │ ├── default.nix # User session entrypoint (paths, state version) │ ├── desktop.nix # Graphical apps (Zen, Zed, media), Wayland tools, DankSearch, Niri/Zed dotfiles -│ ├── dev.nix # Developer toolchains (Rust, Python, Node, LSPs), Antigravity, Neovim +│ ├── dev.nix # Developer toolchains (Rust, Python, Node, LSPs), Antigravity, Neovim, SOPS/age CLI │ ├── shell.nix # Interactive shell (Bash, aliases, modular scripts), Git, Delta, Tmux, Starship │ ├── config/ # Managed application dotfiles (alacritty, niri, nvim, zed, fastfetch, tmux) │ ├── scripts/ # Standalone helper scripts (bundle-project, record) @@ -41,46 +42,48 @@ Config/ --- -## Layer Responsibilities +## Layer Responsibilities & Composition Roots + +The repository utilizes a dual-composition model anchored by `flake.nix`: ```mermaid graph TD - FLAKE["flake.nix"] --> CFG["nixosConfigurations.laptop"] + FLAKE["flake.nix
(Composition Root)"] --> CFG["nixosConfigurations.laptop"] subgraph System Layer ["system/ (Privileged Root / NixOS)"] CFG --> S_DEF["system/default.nix"] S_DEF --> S_HW["hardware-configuration.nix"] - S_DEF --> S_CORE["core.nix
(Host, Users, Boot, Nix-LD)"] - S_DEF --> S_DEV["hardware.nix
(Power, PipeWire, Bluetooth, Printing)"] + S_DEF --> S_CORE["core.nix
(Host, Users, Boot, OpenSSH, Nix-LD)"] + S_DEF --> S_DEV["hardware.nix
(Power, PipeWire, Bluetooth, Printing, Docker)"] S_DEF --> S_DESK["desktop.nix
(Niri, DMS Daemon, Greeter, Fonts)"] end subgraph User Layer ["home/ (Unprivileged User / Home Manager)"] CFG --> H_DEF["home/default.nix"] H_DEF --> H_DESK["desktop.nix
(GUI Apps, Wayland Tools, Alacritty, Zed, Niri Config)"] - H_DEF --> H_DEV["dev.nix
(Neovim, Compilers, LSPs, Antigravity, Cloud Tools)"] + H_DEF --> H_DEV["dev.nix
(Neovim, Compilers, LSPs, Antigravity, SOPS/age CLI)"] H_DEF --> H_SH["shell.nix
(Bash, Git, Delta, Tmux, Starship, Fastfetch)"] end ``` ### 1. `flake.nix` -- **Role**: Public entry point declaring external flake inputs (`nixpkgs`, `home-manager`, `dms`, `zen-browser`, `antigravity`, etc.) and composing the single `laptop` target. -- **Rule**: Contains only inputs and host output definitions. No package lists or host-specific options. +- **Role**: Sole public composition root declaring external flake inputs (`nixpkgs`, `home-manager`, `dms`, `zen-browser`, `antigravity`, etc.) and wiring `system/` and `home/` into the `laptop` target. +- **Rule**: Contains only inputs and host output definitions. No inline packages, scripts, or machine-specific options. -### 2. `system/` -- **Role**: Contains all system-level declarations requiring root privileges. +### 2. `system/` (Machine Privileged Layer) +- **Role**: Contains all machine-level declarations requiring root privileges. - **Components**: - `hardware-configuration.nix`: Generated hardware parameters (managed by `nixos-generate-config`). - - `core.nix`: Bootloader (`systemd-boot`), network identity, time zone, locale, main user account (`kiskaadee`), unfree license acceptance, and `nix-ld` dynamic library loader. - - `hardware.nix`: Power & battery management (`power-profiles-daemon`, `upower`, `brightnessctl`), PipeWire audio, Bluetooth, printing/scanning drivers, and Docker runtime. + - `core.nix`: Bootloader (`systemd-boot`), network identity, time zone, locale, main user account (`kiskaadee`), dynamic binary support (`nix-ld`), and workstation remote access (`openssh`). + - `hardware.nix`: Machine services & peripherals (`power-profiles-daemon`, `upower`, `brightnessctl`), PipeWire audio, Bluetooth, printing/scanning drivers, and Docker runtime. - `desktop.nix`: Niri window manager enablement, DMS background daemon & greeter, greetd login manager, typography/fonts, and Wayland session environment variables. -### 3. `home/` +### 3. `home/` (User-Space Interactive Layer) - **Role**: Contains all user-space declarations and dotfiles managed by Home Manager. - **Components**: - - `default.nix`: Root user environment declaration (username, home directory, state version, session paths). + - `default.nix`: Root user environment declaration (username, home directory, state version, session search paths). - `desktop.nix`: Graphical productivity tools, Wayland screen capture/clipboard utilities, Alacritty terminal emulator, Firefox profile, DankSearch indexer, and declarative symlinks for Niri (`config.kdl`, `custom.kdl`) and Zed (`settings.json`, themes). - - `dev.nix`: Neovim editor configuration (Lua init, Tree-sitter, LSP plugins, DAP), toolchains (Rust, Python, Node), language servers, API testing tools (`httpie`, `bruno`), and Antigravity CLI. + - `dev.nix`: Neovim editor configuration (Lua init, Tree-sitter, LSP plugins, DAP), toolchains (Rust, Python, Node), language servers, API testing tools, Antigravity CLI, and operator secrets tooling (`sops`, `age`, `rbw`). - `shell.nix`: Bash shell aliases, prompt (`starship`), multiplexer (`tmux`), Git/Delta configuration, SSH client profiles, and modular shell helpers. --- @@ -91,24 +94,26 @@ graph TD | :--- | :--- | :--- | | **External Dependencies** | `flake.nix` | Flake inputs only; lock `inputs.nixpkgs.follows` where applicable. | | **Kernel / Disks / Firmware** | `system/hardware-configuration.nix` | Generated hardware scan. Do not manually restructure. | -| **Root OS / User Groups / Boot** | `system/core.nix` | Bootloader, users, host name, locale, nix-ld. | -| **Machine Hardware Services** | `system/hardware.nix` | Audio, power profiles, battery, bluetooth, printing, docker. | +| **Root OS / User Groups / Boot** | `system/core.nix` | Bootloader, users, host name, locale, nix-ld, workstation SSH daemon. | +| **Machine Services & Peripherals**| `system/hardware.nix` | Audio, power profiles, battery, bluetooth, printing, docker. | | **System Compositor & Greeter** | `system/desktop.nix` | Niri enablement, greetd, DMS shell daemon, system fonts. | | **GUI Apps & Wayland Utilities** | `home/desktop.nix` | Browser, Zed, Alacritty, clipboard, screen capture tools. | | **Compilers, LSPs & Editors** | `home/dev.nix` | Neovim, toolchains, language servers, developer utilities. | -| **Shell, Aliases & Multiplexer** | `home/shell.nix` | Bash, Tmux, Starship, Fastfetch, Git, Direnv, SSH config. | +| **Shell, Aliases & Multiplexer** | `home/shell.nix` | Bash, Tmux, Starship, Fastfetch, Git, Direnv, SSH client config. | | **Static Application Dotfiles** | `home/config/` | Application configs linked into `$HOME/.config/`. | | **Standalone Scripts** | `home/scripts/` | Executable user utility scripts. | | **Modular Shell Helpers** | `home/shell/` | Discrete `.sh` files sourced by `.bashrc`. | -| **Encrypted Secrets** | SOPS / age | Decrypted dynamically into memory at runtime via SOPS. | -| **Homelab Services** | `~/Projects/active/homelab/Core` | Managed independently in the Core repository. | +| **Operator Secrets Tooling** | `home/dev.nix` | `sops`, `age`, and `rbw` CLI tools for authoring Core homelab secrets. | +| **Homelab Services & Secrets** | `~/Projects/active/homelab/Core` | Managed independently in the Core repository. | --- ## Architectural Invariants -1. **Single Entrypoint Invariant**: `flake.nix` is the sole entrypoint for building the workstation system (`laptop`). -2. **Domain Separation Invariant**: User packages belong in `home/` categorized by functional domain (`desktop.nix` for GUI/Wayland, `dev.nix` for developer tools, `shell.nix` for terminal productivity). System-level packages in `system/` are strictly reserved for root administration and core OS daemons. -3. **Decoupled Homelab Invariant**: Server infrastructure, Traefik edge proxying, and Docker container stacks belong in the `Core` repository and must never be merged back into this workstation configuration. +1. **Single Entrypoint Invariant**: `flake.nix` is the sole entrypoint for building the workstation system (`laptop`). Neither `system/` nor `home/` are deployed independently. +2. **Context-Driven Package Ownership**: + - Packages in `system/` are reserved for tools required by NixOS modules, system services, hardware integration, login/session infrastructure, or privileged administration. + - Packages in `home/` are dedicated to the user's interactive environment, developer toolchains, and desktop applications. +3. **Decoupled Homelab Invariant**: Server infrastructure, Traefik edge proxying, and Docker container stacks belong exclusively in the `Core` repository and must never be merged back into this workstation configuration. 4. **Hardware Configuration Invariant**: `system/hardware-configuration.nix` is generated by `nixos-generate-config`. Do not manually alter hardware disk UUIDs or module lists without explicit verification. 5. **State Compatibility Invariant**: `system.stateVersion` and `home.stateVersion` (`26.05`) are compatibility declarations for stateful data and must not be bumped casually. diff --git a/docs/development-environments.md b/docs/development-environments.md index 891e4ae..ae92d2d 100644 --- a/docs/development-environments.md +++ b/docs/development-environments.md @@ -6,7 +6,7 @@ This guide shows how to run isolated project environments using `nix-shell` or ` ## ⚡ DevShells and nix-shell -Instead of installing packages globally in [apps.nix](file:///home/kiskaadee/Config/modules/user/apps.nix) for one-off projects, define them per-project. +Instead of installing packages globally in [home/dev.nix](file:///home/kiskaadee/Config/home/dev.nix) for one-off projects, define them per-project. ### 1. Classic `shell.nix` (Nix Channels) For standard Nix projects, place a `shell.nix` in your project root: diff --git a/docs/package-and-secrets.md b/docs/package-and-secrets.md index 6b973b3..1989884 100644 --- a/docs/package-and-secrets.md +++ b/docs/package-and-secrets.md @@ -48,37 +48,15 @@ sudo nixos-rebuild switch --flake .#laptop --- -## 🔒 Adding a New Secret (SOPS Workflow) +## 🔒 Secrets Management (Operator Workflow) -Sensitive credentials (like passwords, API keys, and environment variables) are managed using `sops-nix` and `age`. +The laptop acts as the administrative management station for homelab credentials using `sops` and `age`. Secrets are stored encrypted in Git under the [Core](file:///home/kiskaadee/Projects/active/homelab/Core) repository. -### Step 1: Edit the Secrets File -Launch `sops` inside `nix-shell` to decrypt and edit your secrets file: +### Editing Homelab Secrets +To edit or rotate homelab secrets from your laptop: ```bash -nix-shell -p sops --run "sops secrets.yaml" +sops ~/Projects/active/homelab/Core/nixos/secrets.yaml ``` -Add your key-value pair under the YAML structure: -```yaml -my_new_api_key: "secure_token_goes_here" -``` -*When you save and close your editor, SOPS automatically encrypts the file before saving it back to disk.* +SOPS uses your personal age key at `~/.config/sops/age/keys.txt` to decrypt the file locally, and re-encrypts it for both the server and your workstation upon save. -### Step 2: Declare the Secret in Nix -To make the decrypted secret available to services or applications at runtime, register it in your Nix configuration: - -```nix -sops.secrets.my_new_api_key = { - # (Optional) Restrict file access to specific users/groups - owner = "kiskaadee"; - mode = "0400"; -}; -``` - -### Step 3: Reference the Decrypted Path -Once declared, `sops-nix` exposes the decrypted value under `/run/secrets/` at boot time. You can reference the file path dynamically in your Nix configuration using: - -```nix -# This resolves to "/run/secrets/my_new_api_key" -config.sops.secrets.my_new_api_key.path -``` -Avoid hardcoding raw paths; instead, pass this dynamic path directly to service configurations (e.g., via `EnvironmentFile` or command-line flags). +For detailed architecture diagrams and recovery steps, see the [Secrets Management Guide](docs/secrets-management.md). diff --git a/docs/secrets-management.md b/docs/secrets-management.md index 000f4df..1b43406 100644 --- a/docs/secrets-management.md +++ b/docs/secrets-management.md @@ -1,72 +1,71 @@ -# 🔒 Secrets Management via SOPS & age +# 🔒 Homelab & Workstation Secrets Management -This repository utilizes **`sops`** and **`age`** (with optional **`sops-nix`** integration) to manage sensitive information (passwords, tokens, API keys) declaratively and securely. - -Secrets are stored encrypted directly in the Git repository, and decrypted dynamically into memory (`/run/secrets/`), ensuring no credentials leak into the public-readable Nix store. +This document describes the GitOps secrets management workflow using **Mozilla SOPS** and **age**. --- -## 🛠️ Bootstrapping Secrets on the Workstation +## 🏛️ Architectural Model: Author vs Consumer -To set up or re-initialize secrets encryption on the laptop: +Secrets management follows a strict separation between **authoring** (human operator on the workstation) and **runtime consumption** (headless server): -### Step 1: Generate a User age Key Pair -To encrypt and decrypt files on your local machine, generate a native `age` key pair: +```text +┌─────────────────────────────────────────────────────────┐ +│ WORKSTATION (Author / Operator) │ +│ - Key: ~/.config/sops/age/keys.txt (&laptop) │ +│ - Tooling: sops, age, rbw (installed in home/dev.nix) │ +│ - Action: Decrypt, edit, and re-encrypt secrets locally │ +└───────────────────────────┬─────────────────────────────┘ + │ + Git Commit (Ciphertext in repo) + │ + ▼ +┌─────────────────────────────────────────────────────────┐ +│ SERVER (Consumer / Runtime) │ +│ - Key: /etc/ssh/ssh_host_ed25519_key (&server) │ +│ - Tooling: sops-nix systemd activation service (root) │ +│ - Action: Unattended decryption into RAM (/run/secrets) │ +└─────────────────────────────────────────────────────────┘ +``` + +* **Why editing secrets directly on the remote server fails**: The server does not have the operator's age key. Its host SSH key is owned by `root:root` with `0600` permissions and is only read by `sops-nix` during systemd activation at boot. +* **Why the workstation is the author**: The operator's private age key resides in `~/.config/sops/age/keys.txt` on the laptop. This allows secure local editing without exposing administrative keys on production nodes. + +--- + +## 🛠️ Managing Secrets for Core + +Production homelab secrets are maintained in the [Core](file:///home/kiskaadee/Projects/active/homelab/Core) repository at `Core/nixos/secrets.yaml`. + +### 1. Edit Secrets Locally +From your laptop, open the encrypted secrets file: +```bash +sops ~/Projects/active/homelab/Core/nixos/secrets.yaml +``` +SOPS reads your local `~/.config/sops/age/keys.txt`, decrypts the file in `$EDITOR`, and automatically re-encrypts the ciphertext using the public recipient keys configured in `Core/.sops.yaml`: +- `*server` (for server boot decryption) +- `*laptop` (for operator editing) + +### 2. Commit and Deploy +Commit the newly encrypted ciphertext and push to your git remote: +```bash +cd ~/Projects/active/homelab/Core +git add nixos/secrets.yaml +git commit -m "chore(secrets): rotate service credentials" +git push +``` +On the server, pulling and rebuilding will activate the updated secrets into `/run/secrets/`. + +--- + +## 🔑 Workstation Key Bootstrapping + +If setting up a new workstation, generate your operator `age` key pair: ```bash -# Create the standard config directory mkdir -p ~/.config/sops/age - -# Generate the age key pair -nix-shell -p age --run "age-keygen -o ~/.config/sops/age/keys.txt" - -# Lock down key permissions +age-keygen -o ~/.config/sops/age/keys.txt chmod 600 ~/.config/sops/age/keys.txt ``` -To print your public key for configuration, run: +To print the public key for addition to `Core/.sops.yaml`: ```bash grep "public key" ~/.config/sops/age/keys.txt ``` - -### Step 2: Convert the Host SSH Public Key to age -To allow systemd to decrypt secrets automatically at boot time, obtain the host's SSH public key converted to `age` format: -```bash -nix run nixpkgs#ssh-to-age -- -i /etc/ssh/ssh_host_ed25519_key.pub -``` -*Note: The private key counterpart `/etc/ssh/ssh_host_ed25519_key` is automatically read by `sops-nix` at boot with root privileges.* - -### Step 3: Configure Public Keys in `.sops.yaml` -Add both the user `age` public key and the host `age` public key to the [.sops.yaml](file:///home/kiskaadee/Config/.sops.yaml) configuration file at the root of the repository: - -```yaml -keys: - - &laptop age1...your_laptop_age_key... - -creation_rules: - - path_regex: secrets\.yaml$ - key_groups: - - pgp: [] - age: - - *laptop -``` - ---- - -## ✏️ Editing and Managing Secrets - -Because `sops` automatically reads from your local `~/.config/sops/age/keys.txt` keyfile, you can manage secrets using simple commands: - -### Create/Edit an Encrypted File -```bash -nix-shell -p sops --run "sops secrets.yaml" -``` -This decrypts the file, opens it in your editor defined by `$EDITOR`, and automatically re-encrypts the values when you save and exit. - ---- - -## 🔄 Runtime Decryption - -At boot time, `sops-nix` performs the following steps: -1. Systemd runs the `sops-install-secrets` activation script. -2. The script reads `/etc/ssh/ssh_host_ed25519_key` to decrypt the encrypted secrets file. -3. The values are exposed under `/run/secrets/` as individual files (or templates) with strict user/group ownership. -4. Services read these paths at startup, keeping secrets secure and decoupled from the world-readable `/nix/store`. diff --git a/docs/tmux.md b/docs/tmux.md index 10bc9a3..6181c3e 100644 --- a/docs/tmux.md +++ b/docs/tmux.md @@ -1,6 +1,6 @@ # 🎛️ Tmux Environment & Cheat Sheet -This repository configures **Tmux** declaratively via Home Manager in [terminal.nix](file:///home/kiskaadee/Config/modules/user/terminal.nix#L30). The configuration is optimized for speed, Vim keybindings, and seamless split-pane navigation. +This repository configures **Tmux** declaratively via Home Manager in [home/shell.nix](file:///home/kiskaadee/Config/home/shell.nix). The configuration is optimized for speed, Vim keybindings, and seamless split-pane navigation. --- diff --git a/flake.lock b/flake.lock index 99e1878..a250d2f 100644 --- a/flake.lock +++ b/flake.lock @@ -271,30 +271,9 @@ "dms": "dms", "home-manager": "home-manager", "nixpkgs": "nixpkgs", - "sops-nix": "sops-nix", "zen-browser": "zen-browser" } }, - "sops-nix": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1788914643, - "narHash": "sha256-4GuMPW90JSxXWDPUB9M+1m7fYbe3H0apOd86/zBQ2Kw=", - "owner": "Mic92", - "repo": "sops-nix", - "rev": "13616fff713a9f94055c66f15687ebdc17a335df", - "type": "github" - }, - "original": { - "owner": "Mic92", - "repo": "sops-nix", - "type": "github" - } - }, "systems": { "locked": { "lastModified": 1681028828, diff --git a/flake.nix b/flake.nix index 2151940..eefcaeb 100644 --- a/flake.nix +++ b/flake.nix @@ -48,12 +48,6 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - # Cryptographic Secrets management - sops-nix = { - url = "github:Mic92/sops-nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - # Antigravity CLI - coding companion and local AI agent helper antigravity = { url = "github:jacopone/antigravity-nix"; diff --git a/home/default.nix b/home/default.nix index 11d249c..5c19984 100644 --- a/home/default.nix +++ b/home/default.nix @@ -18,7 +18,6 @@ home.sessionPath = [ "$HOME/.cargo/bin" "$HOME/.local/bin" - "$HOME/Core/scripts" ]; # Compatibility state version diff --git a/home/desktop.nix b/home/desktop.nix index e5f39ab..78add17 100644 --- a/home/desktop.nix +++ b/home/desktop.nix @@ -65,16 +65,7 @@ in home.file.".config/niri/config.kdl".source = ./config/niri/config.kdl; home.file.".config/niri/custom.kdl".source = ./config/niri/custom.kdl; - # Systemd user session targets for window managers - systemd.user.targets.hyprland-session = { - Unit = { - Description = "Hyprland graphical session"; - Documentation = [ "man:systemd.special(7)" ]; - BindsTo = [ "graphical-session.target" ]; - Wants = [ "graphical-session-pre.target" ]; - After = [ "graphical-session-pre.target" ]; - }; - }; + # Systemd user session target for Niri window manager systemd.user.targets.niri-session = { Unit = { diff --git a/home/scripts/record.sh b/home/scripts/record.sh index 3971149..b7185a6 100755 --- a/home/scripts/record.sh +++ b/home/scripts/record.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -# 📹 Wayland Screen Recording Utility (Niri & Hyprland compatible) -# Leverages 'wf-recorder' for GPU-accelerated video recording and pipewire audio routing. +# 📹 Wayland Screen Recording Utility (Niri-native) +# Leverages 'wf-recorder' for GPU-accelerated video recording and PipeWire audio routing. # Supports capturing specific regions, active windows, focused monitors, or full displays. # # Usage: @@ -69,14 +69,8 @@ case "$MODE" in TYPE_DESC="Area Recording" ;; window) - # Try querying Hyprland active window coordinates if on Hyprland - if [ "$XDG_CURRENT_DESKTOP" = "Hyprland" ] && command -v hyprctl >/dev/null 2>&1; then - GEOM=$(hyprctl activewindow -j 2>/dev/null | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"') - fi - # Fallback to interactive window / region selection via slurp - if [ -z "$GEOM" ] || [ "$GEOM" = "null,null nullxnull" ]; then - GEOM=$(slurp) - fi + # Interactive window selection via slurp + GEOM=$(slurp) if [ -z "$GEOM" ]; then notify-send -t 2000 "Screen Recorder" "Recording cancelled" exit 1 @@ -84,13 +78,10 @@ case "$MODE" in TYPE_DESC="Window Recording" ;; output) - # Query focused monitor on Niri or Hyprland - if [ "$XDG_CURRENT_DESKTOP" = "niri" ] || command -v niri >/dev/null 2>&1; then + # Query focused monitor on Niri + if command -v niri >/dev/null 2>&1; then OUTPUT_TARGET=$(niri msg -j focused-output 2>/dev/null | jq -r '.name // empty') fi - if [ -z "$OUTPUT_TARGET" ] && command -v hyprctl >/dev/null 2>&1; then - OUTPUT_TARGET=$(hyprctl monitors -j 2>/dev/null | jq -r '.[] | select(.focused == true) | .name // empty') - fi TYPE_DESC="Monitor Recording" ;; screen) diff --git a/home/shell.nix b/home/shell.nix index 9b54c66..42f659b 100644 --- a/home/shell.nix +++ b/home/shell.nix @@ -227,7 +227,7 @@ # Ensure Home Manager session variables and user PATH are available in non-login / SSH shells [[ -f /etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh ]] && . /etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh [[ -f ~/.profile ]] && . ~/.profile - export PATH="$HOME/Core/scripts:$HOME/.local/bin:$HOME/.cargo/bin:$PATH" + export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH" ${builtins.readFile ./shell/wayland.sh} # Wayland clipboard helper (wlc) ${builtins.readFile ./shell/git.sh} # Git workflow automations (gacp, gitignore) diff --git a/home/shell/pdf.sh b/home/shell/pdf.sh index 0815b17..e08aaa9 100644 --- a/home/shell/pdf.sh +++ b/home/shell/pdf.sh @@ -3,17 +3,19 @@ # 1. pdf_dc: Decrypts a password-protected PDF document. # Uses 'qpdf' under the hood. Automatically searches for a default password -# decrypted securely by sops-nix in `/run/secrets/pdf_decrypt_password` +# in `$HOME/.config/pdf_decrypt_password` (or `/run/secrets/pdf_decrypt_password`) # if no password argument is supplied. pdf_dc() { - local secret_file="/run/secrets/pdf_decrypt_password" + local secret_file="${PDF_PASSWORD_FILE:-$HOME/.config/pdf_decrypt_password}" local input_file="$1" local password="$2" - # Attempt to auto-load password from sops secret if none was provided on the CLI + # Attempt to auto-load password from config file if none was provided on the CLI if [[ -z "$password" ]]; then if [[ -f "$secret_file" ]]; then password=$(cat "$secret_file") + elif [[ -f "/run/secrets/pdf_decrypt_password" ]]; then + password=$(cat "/run/secrets/pdf_decrypt_password") fi fi diff --git a/system/desktop.nix b/system/desktop.nix index 48db4c2..167df26 100644 --- a/system/desktop.nix +++ b/system/desktop.nix @@ -13,9 +13,7 @@ package = inputs.dms.packages.${pkgs.stdenv.hostPlatform.system}.default; systemd.enable = true; systemd.restartIfChanged = true; - enableSystemMonitoring = true; enableDynamicTheming = true; - enableClipboardPaste = true; }; # DMS Greeter (dank-greeter + greetd) diff --git a/system/hardware.nix b/system/hardware.nix index e9667dc..fd92f14 100644 --- a/system/hardware.nix +++ b/system/hardware.nix @@ -1,5 +1,5 @@ -# 🔋 Laptop Hardware, Power & Peripheral Management -# Manages audio (PipeWire), power daemons, Bluetooth, printing, scanning, and virtualization. +# 🔋 Machine Services, Hardware & Peripherals +# Manages audio (PipeWire), power daemons, Bluetooth, printing, scanning, and container virtualization. { pkgs, ... }: