diff --git a/.gitignore b/.gitignore index 5f606824..08c06ecd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,17 @@ result .direnv .devenv -.aider* +.aider.chat.history.md +.aider.input.history +.aider.tags.cache.v3 + +# Devenv +.devenv* +devenv.local.nix +devenv.local.yaml + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..73a6b14f --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,61 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Repository Overview + +This is a personal Nix configuration repository for development environments using NixOS and home-manager. It supports both Linux (primarily in VMs) and macOS systems with a focus on VM-based development workflows. + +## Common Commands + +### System Management +- `make switch` - Rebuild and switch to the new configuration (main command for applying changes) +- `sudo nixos-rebuild switch --flake .#` - Alternative to make switch on NixOS +- `home-manager switch --flake .#sand` - Apply home-manager changes for Linux user +- `home-manager switch --flake .#san.nguyen` - Apply home-manager changes for macOS user + +### Flake Management +- `nix flake update` - Update all flake inputs +- `nix flake lock --update-input ` - Update specific input + +## Architecture + +### Directory Structure +- `modules/` - Home-manager modules for individual programs/tools +- `pkgs/` - Custom package definitions (e.g., nvchad configuration) +- `machines/` - Machine-specific NixOS configurations +- `users/` - User-specific home-manager configurations +- `overlays/` - Nix overlays for package modifications + +### Key Configuration Patterns +1. **Modular Design**: Each tool/program has its own module in `modules/` that can be enabled/disabled +2. **User Separation**: Configurations are split between `sand` (Linux) and `san.nguyen` (macOS) +3. **VM Platform Support**: Specific configurations for VMware Fusion and Parallels Desktop +4. **Flake-based**: All dependencies are pinned through flake.lock for reproducibility + +### Important Files +- `flake.nix` - Main entry point defining inputs and outputs +- `configuration.nix` - Base NixOS system configuration +- `home.nix` - Base home-manager configuration +- `machines/parallels-desktop.nix` and `machines/vmware-fusion.nix` - VM-specific configs + +### Module System +Modules typically follow this pattern: +```nix +{ config, lib, pkgs, ... }: { + programs.toolname = { + enable = true; + # tool-specific configuration + }; + # or + home.file.".config/toolname" = { + source = ./config; + }; +} +``` + +### Git Configuration +The repository uses conditional git includes for work directories: +- Work repos assumed to be in `~/Work/` +- Personal repos elsewhere +- Separate git identities for work/personal commits diff --git a/Makefile b/Makefile index 323ba381..3c97ed2c 100644 --- a/Makefile +++ b/Makefile @@ -28,12 +28,12 @@ NIXNAME ?= vm-aarch64 SSH_OPTIONS=-o PubkeyAuthentication=no -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no switch: - nixos-rebuild switch --use-remote-sudo --impure --flake ".#parallels-desktop" + rsync -av $(MAKEFILE_DIR)/modules/karabiner/mbp_m1_woven_planet/* /media/psf/Home/.config/karabiner + nixos-rebuild switch --sudo --impure --flake ".#parallels-desktop" # nix store gc # nix store optimise # nixos-rebuild switch --use-remote-sudo --impure --flake ".#vmware-fusion" # /home/$(NIXUSER)/.nix-profile/bin/home-manager switch --impure --flake ".#$(NIXUSER)" -b backup - # rsync -av $(MAKEFILE_DIR)/users/$(NIXUSER)/karabiner/mbp_m1_woven_planet/* /media/psf/Home/.config/karabiner # bootstrap a brand new VM. The VM should have NixOS ISO on the CD drive # and just set the password of the root user to "root". This will install diff --git a/README.md b/README.md index 57c01f63..6a6a73a7 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,28 @@ sudo vim /etc/rpm-ostreed.conf # AutomaticUpdatePolicy=stage ``` +## Setup NixOS + +Boot from NixOS iso image, then run + +```sh +nix --extra-experimental-features 'nix-command flakes' shell nixpkgs#gh +gh auth login +gh clone sandangel/nixos-config ~/.nix-config +cd ~/.nix-config +gh clone sandangel/artifacts + +cp artifacts/comic-code.tar.gz pkgs/comic-code/ +vim pkgs/comic-code/default.nix # change /home/sand to /home/nixos + +# Format disk +sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount ./machines/parallels/disko-config.nix + +# Install NixOS +cd /mnt +sudo nixos-install --flake '/home/nixos/.nix-config#parallels-desktop' --impure +``` + ## Setup Arch Linux ```sh @@ -324,4 +346,9 @@ mount /dev/nvme0n2p1 /mnt btrfs filesystem resize max /mnt ``` + +To sync data from VM and Host + +```sh rsync -ahr --no-links --exclude=".Trash-1000" --exclude=".pnpm-store" --exclude=".devenv" --exclude="node_modules" --exclude=".venv" --exclude=".cache" --exclude=".pdm-build" --exclude=".mypy_cache" --exclude=".ruff_cache" --exclude="dist" --exclude=".pytest_cache" --exclude="target" --exclude=".terraform" ~/Work /host/Downloads/ +``` diff --git a/flake.lock b/flake.lock index 568f043a..d9208537 100644 --- a/flake.lock +++ b/flake.lock @@ -1,24 +1,97 @@ { "nodes": { + "base16": { + "inputs": { + "fromYaml": "fromYaml" + }, + "locked": { + "lastModified": 1755819240, + "narHash": "sha256-qcMhnL7aGAuFuutH4rq9fvAhCpJWVHLcHVZLtPctPlo=", + "owner": "SenchoPens", + "repo": "base16.nix", + "rev": "75ed5e5e3fce37df22e49125181fa37899c3ccd6", + "type": "github" + }, + "original": { + "owner": "SenchoPens", + "repo": "base16.nix", + "type": "github" + } + }, + "base16-fish": { + "flake": false, + "locked": { + "lastModified": 1754405784, + "narHash": "sha256-l9xHIy+85FN+bEo6yquq2IjD1rSg9fjfjpyGP1W8YXo=", + "owner": "tomyun", + "repo": "base16-fish", + "rev": "23ae20a0093dca0d7b39d76ba2401af0ccf9c561", + "type": "github" + }, + "original": { + "owner": "tomyun", + "repo": "base16-fish", + "rev": "23ae20a0093dca0d7b39d76ba2401af0ccf9c561", + "type": "github" + } + }, + "base16-helix": { + "flake": false, + "locked": { + "lastModified": 1752979451, + "narHash": "sha256-0CQM+FkYy0fOO/sMGhOoNL80ftsAzYCg9VhIrodqusM=", + "owner": "tinted-theming", + "repo": "base16-helix", + "rev": "27cf1e66e50abc622fb76a3019012dc07c678fac", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-helix", + "type": "github" + } + }, + "base16-vim": { + "flake": false, + "locked": { + "lastModified": 1732806396, + "narHash": "sha256-e0bpPySdJf0F68Ndanwm+KWHgQiZ0s7liLhvJSWDNsA=", + "owner": "tinted-theming", + "repo": "base16-vim", + "rev": "577fe8125d74ff456cf942c733a85d769afe58b7", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-vim", + "rev": "577fe8125d74ff456cf942c733a85d769afe58b7", + "type": "github" + } + }, "cachix": { "inputs": { "devenv": [ "devenv" ], "flake-compat": [ - "devenv" + "devenv", + "flake-compat" ], "git-hooks": [ - "devenv" + "devenv", + "git-hooks" ], - "nixpkgs": "nixpkgs" + "nixpkgs": [ + "devenv", + "nixpkgs" + ] }, "locked": { - "lastModified": 1742042642, - "narHash": "sha256-D0gP8srrX0qj+wNYNPdtVJsQuFzIng3q43thnHXQ/es=", + "lastModified": 1760971495, + "narHash": "sha256-IwnNtbNVrlZIHh7h4Wz6VP0Furxg9Hh0ycighvL5cZc=", "owner": "cachix", "repo": "cachix", - "rev": "a624d3eaf4b1d225f918de8543ed739f2f574203", + "rev": "c5bfd933d1033672f51a863c47303fc0e093c2d2", "type": "github" }, "original": { @@ -28,20 +101,101 @@ "type": "github" } }, + "dankshell": { + "inputs": { + "dgop": "dgop", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1763788986, + "narHash": "sha256-uYgLhTSxWs9IRpia5Hxd7AMCaE0plr0+QhWBf26h9V0=", + "owner": "AvengeMedia", + "repo": "DankMaterialShell", + "rev": "58bf1899410536c4244b9d44c243426dc1b2a2c9", + "type": "github" + }, + "original": { + "owner": "AvengeMedia", + "repo": "DankMaterialShell", + "type": "github" + } + }, + "determinate": { + "inputs": { + "determinate-nixd-aarch64-darwin": "determinate-nixd-aarch64-darwin", + "determinate-nixd-aarch64-linux": "determinate-nixd-aarch64-linux", + "determinate-nixd-x86_64-linux": "determinate-nixd-x86_64-linux", + "nix": "nix", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1763536872, + "narHash": "sha256-QCYGGghBya+qsY59f1zzgYzxEzz+N9S7YRkVWDIDbgo=", + "rev": "f4e598cbb10021c93f73dd4c0cf01ec791ea53f9", + "revCount": 315, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/determinate/3.13.2/019a9b01-c0c6-7e1c-959e-98ac5b7675de/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/determinate/%2A" + } + }, + "determinate-nixd-aarch64-darwin": { + "flake": false, + "locked": { + "narHash": "sha256-g1r0dPwlUi1h96c4BuHzv9M2lWDqRy9bPDW9tRSq35I=", + "type": "file", + "url": "https://install.determinate.systems/determinate-nixd/tag/v3.13.2/macOS" + }, + "original": { + "type": "file", + "url": "https://install.determinate.systems/determinate-nixd/tag/v3.13.2/macOS" + } + }, + "determinate-nixd-aarch64-linux": { + "flake": false, + "locked": { + "narHash": "sha256-xn324irXG/EpUdUfUGFrlJNg23JN2cVArd5LsFPjGKc=", + "type": "file", + "url": "https://install.determinate.systems/determinate-nixd/tag/v3.13.2/aarch64-linux" + }, + "original": { + "type": "file", + "url": "https://install.determinate.systems/determinate-nixd/tag/v3.13.2/aarch64-linux" + } + }, + "determinate-nixd-x86_64-linux": { + "flake": false, + "locked": { + "narHash": "sha256-VPM5FOGwEjl56b7Edvg3sduvauPHCyXZ11fN9hcUdTU=", + "type": "file", + "url": "https://install.determinate.systems/determinate-nixd/tag/v3.13.2/x86_64-linux" + }, + "original": { + "type": "file", + "url": "https://install.determinate.systems/determinate-nixd/tag/v3.13.2/x86_64-linux" + } + }, "devenv": { "inputs": { "cachix": "cachix", - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts_2", "git-hooks": "git-hooks", - "nix": "nix", - "nixpkgs": "nixpkgs_3" + "nix": "nix_2", + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1743783972, - "narHash": "sha256-5wPsNCnWmeLpLxavsftA9L7tnYgtlexV7FwLegxtpy4=", + "lastModified": 1763829850, + "narHash": "sha256-7dmfU7kGjyBwp1V01/1jH0uzcCs8s/rDcvy/eFJiCio=", "owner": "cachix", "repo": "devenv", - "rev": "2f53e2f867e0c2ba18b880e66169366e5f8ca554", + "rev": "cdb6a64787ab77d7ec37c68d19de483a76f08173", "type": "github" }, "original": { @@ -50,6 +204,27 @@ "type": "github" } }, + "dgop": { + "inputs": { + "nixpkgs": [ + "dankshell", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1762435535, + "narHash": "sha256-QhzRn7pYN35IFpKjjxJAj3GPJECuC+VLhoGem3ezycc=", + "owner": "AvengeMedia", + "repo": "dgop", + "rev": "6cf638dde818f9f8a2e26d0243179c43cb3458d7", + "type": "github" + }, + "original": { + "owner": "AvengeMedia", + "repo": "dgop", + "type": "github" + } + }, "disko": { "inputs": { "nixpkgs": [ @@ -57,11 +232,11 @@ ] }, "locked": { - "lastModified": 1743598667, - "narHash": "sha256-ViE7NoFWytYO2uJONTAX35eGsvTYXNHjWALeHAg8OQY=", + "lastModified": 1763651264, + "narHash": "sha256-8vvwZbw0s7YvBMJeyPVpWke6lg6ROgtts5N2/SMCcv4=", "owner": "nix-community", "repo": "disko", - "rev": "329d3d7e8bc63dd30c39e14e6076db590a6eabe6", + "rev": "e86a89079587497174ccab6d0d142a65811a4fd9", "type": "github" }, "original": { @@ -70,30 +245,30 @@ "type": "github" } }, - "flake-compat": { + "firefox-gnome-theme": { "flake": false, "locked": { - "lastModified": 1733328505, - "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "lastModified": 1758112371, + "narHash": "sha256-lizRM2pj6PHrR25yimjyFn04OS4wcdbc38DCdBVa2rk=", + "owner": "rafaelmardojai", + "repo": "firefox-gnome-theme", + "rev": "0909cfe4a2af8d358ad13b20246a350e14c2473d", "type": "github" }, "original": { - "owner": "edolstra", - "repo": "flake-compat", + "owner": "rafaelmardojai", + "repo": "firefox-gnome-theme", "type": "github" } }, - "flake-compat_2": { + "flake-compat": { "flake": false, "locked": { - "lastModified": 1733328505, - "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -102,14 +277,14 @@ "type": "github" } }, - "flake-compat_3": { + "flake-compat_2": { "flake": false, "locked": { - "lastModified": 1733328505, - "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "lastModified": 1761588595, + "narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=", "owner": "edolstra", "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5", "type": "github" }, "original": { @@ -121,56 +296,55 @@ "flake-parts": { "inputs": { "nixpkgs-lib": [ - "devenv", + "determinate", "nix", "nixpkgs" ] }, "locked": { - "lastModified": 1712014858, - "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", - "type": "github" + "lastModified": 1748821116, + "narHash": "sha256-F82+gS044J1APL0n4hH50GYdPRv/5JWm34oCJYmVKdE=", + "rev": "49f0870db23e8c1ca0b5259734a02cd9e1e371a1", + "revCount": 377, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/hercules-ci/flake-parts/0.1.377%2Brev-49f0870db23e8c1ca0b5259734a02cd9e1e371a1/01972f28-554a-73f8-91f4-d488cc502f08/source.tar.gz" }, "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" + "type": "tarball", + "url": "https://flakehub.com/f/hercules-ci/flake-parts/0.1" } }, "flake-parts_2": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib" + "nixpkgs-lib": [ + "devenv", + "nixpkgs" + ] }, "locked": { - "lastModified": 1743550720, - "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", + "lastModified": 1760948891, + "narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "c621e8422220273271f52058f618c94e405bb0f5", + "rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04", "type": "github" }, "original": { - "id": "flake-parts", - "type": "indirect" + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" } }, "flake-parts_3": { "inputs": { - "nixpkgs-lib": [ - "nix", - "nix", - "nixpkgs" - ] + "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1733312601, - "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "lastModified": 1763759067, + "narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0", "type": "github" }, "original": { @@ -179,51 +353,48 @@ "type": "github" } }, - "flake-utils": { + "flake-parts_4": { "inputs": { - "systems": "systems" + "nixpkgs-lib": [ + "stylix", + "nixpkgs" + ] }, "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "lastModified": 1756770412, + "narHash": "sha256-+uWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "4524271976b625a4a605beefd893f270620fd751", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, - "ghostty": { - "inputs": { - "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils", - "nixpkgs-stable": "nixpkgs-stable", - "nixpkgs-unstable": "nixpkgs-unstable", - "zig": "zig", - "zon2nix": "zon2nix" - }, + "fromYaml": { + "flake": false, "locked": { - "lastModified": 1743820100, - "narHash": "sha256-URg5DLo0IvpTLNGrWA9f6U4pl21JxsQWSJUpjvALyxs=", - "owner": "ghostty-org", - "repo": "ghostty", - "rev": "6f7977fef186faa9b9afe7707dc21a2eff59883b", + "lastModified": 1731966426, + "narHash": "sha256-lq95WydhbUTWig/JpqiB7oViTcHFP8Lv41IGtayokA8=", + "owner": "SenchoPens", + "repo": "fromYaml", + "rev": "106af9e2f715e2d828df706c386a685698f3223b", "type": "github" }, "original": { - "owner": "ghostty-org", - "repo": "ghostty", + "owner": "SenchoPens", + "repo": "fromYaml", "type": "github" } }, "git-hooks": { "inputs": { "flake-compat": [ - "devenv" + "devenv", + "flake-compat" ], "gitignore": "gitignore", "nixpkgs": [ @@ -232,11 +403,11 @@ ] }, "locked": { - "lastModified": 1742649964, - "narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=", + "lastModified": 1760663237, + "narHash": "sha256-BflA6U4AM1bzuRMR8QqzPXqh8sWVCNDzOdsxXEguJIc=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", + "rev": "ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37", "type": "github" }, "original": { @@ -247,37 +418,28 @@ }, "git-hooks-nix": { "inputs": { - "flake-compat": [ - "nix", - "nix" - ], + "flake-compat": "flake-compat", "gitignore": [ - "nix", + "determinate", "nix" ], "nixpkgs": [ - "nix", - "nix", - "nixpkgs" - ], - "nixpkgs-stable": [ - "nix", + "determinate", "nix", "nixpkgs" ] }, "locked": { - "lastModified": 1734279981, - "narHash": "sha256-NdaCraHPp8iYMWzdXAt5Nv6sA3MUzlCiGiR586TCwo0=", - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "aa9f40c906904ebd83da78e7f328cd8aeaeae785", - "type": "github" + "lastModified": 1747372754, + "narHash": "sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=", + "rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46", + "revCount": 1026, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/cachix/git-hooks.nix/0.1.1026%2Brev-80479b6ec16fefd9c1db3ea13aeb038c60530f46/0196d79a-1b35-7b8e-a021-c894fb62163d/source.tar.gz" }, "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" + "type": "tarball", + "url": "https://flakehub.com/f/cachix/git-hooks.nix/0.1.941" } }, "gitignore": { @@ -302,6 +464,25 @@ "type": "github" } }, + "gnome-shell": { + "flake": false, + "locked": { + "host": "gitlab.gnome.org", + "lastModified": 1762869044, + "narHash": "sha256-nwm/GJ2Syigf7VccLAZ66mFC8mZJFqpJmIxSGKl7+Ds=", + "owner": "GNOME", + "repo": "gnome-shell", + "rev": "680e3d195a92203f28d4bf8c6e8bb537cc3ed4ad", + "type": "gitlab" + }, + "original": { + "host": "gitlab.gnome.org", + "owner": "GNOME", + "ref": "gnome-49", + "repo": "gnome-shell", + "type": "gitlab" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -309,11 +490,11 @@ ] }, "locked": { - "lastModified": 1743869639, - "narHash": "sha256-Xhe3whfRW/Ay05z9m1EZ1/AkbV1yo0tm1CbgjtCi4rQ=", + "lastModified": 1763837297, + "narHash": "sha256-o60Q4UcjzYgF3BjC5moJEs7bPIYedHWPVcFjeRaH/JE=", "owner": "nix-community", "repo": "home-manager", - "rev": "d094c6763c6ddb860580e7d3b4201f8f496a6836", + "rev": "f07573df41506a0890ae8529fa51fe60cf563f4a", "type": "github" }, "original": { @@ -322,111 +503,155 @@ "type": "github" } }, - "libgit2": { - "flake": false, + "niri": { + "inputs": { + "niri-stable": "niri-stable", + "niri-unstable": "niri-unstable", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable", + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, "locked": { - "lastModified": 1697646580, - "narHash": "sha256-oX4Z3S9WtJlwvj0uH9HlYcWv+x1hqp8mhXl7HsLu2f0=", - "owner": "libgit2", - "repo": "libgit2", - "rev": "45fd9ed7ae1a9b74b957ef4f337bc3c8b3df01b5", + "lastModified": 1763835287, + "narHash": "sha256-8wPX0t4wM6uLVpbRnU8yBqV2e93eXiYPiAJYzS6HLNc=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "5e06972e46f11274ae3dcb5175c45dc5b9e85410", "type": "github" }, "original": { - "owner": "libgit2", - "repo": "libgit2", + "owner": "sodiboo", + "repo": "niri-flake", "type": "github" } }, - "nix": { - "inputs": { - "flake-compat": [ - "devenv" - ], - "flake-parts": "flake-parts", - "libgit2": "libgit2", - "nixpkgs": "nixpkgs_2", - "nixpkgs-23-11": [ - "devenv" - ], - "nixpkgs-regression": [ - "devenv" - ], - "pre-commit-hooks": [ - "devenv" - ] - }, + "niri-stable": { + "flake": false, "locked": { - "lastModified": 1741798497, - "narHash": "sha256-E3j+3MoY8Y96mG1dUIiLFm2tZmNbRvSiyN7CrSKuAVg=", - "owner": "domenkozar", - "repo": "nix", - "rev": "f3f44b2baaf6c4c6e179de8cbb1cc6db031083cd", + "lastModified": 1756556321, + "narHash": "sha256-RLD89dfjN0RVO86C/Mot0T7aduCygPGaYbog566F0Qo=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "01be0e65f4eb91a9cd624ac0b76aaeab765c7294", "type": "github" }, "original": { - "owner": "domenkozar", - "ref": "devenv-2.24", - "repo": "nix", + "owner": "YaLTeR", + "ref": "v25.08", + "repo": "niri", "type": "github" } }, - "nix_2": { - "inputs": { - "nix": "nix_3", - "nixpkgs": "nixpkgs_5" - }, + "niri-unstable": { + "flake": false, "locked": { - "lastModified": 1743102273, - "narHash": "sha256-psXrRgGjZfpEbUgn6tEoeTa8L97KFV4mYon9ZGAZwxE=", - "rev": "86b8996bd44189799c2c4862945698b2495c8ed3", - "revCount": 125, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nix/2.27.1/0195d93a-2d08-756f-907c-440f7aa4c901/source.tar.gz" + "lastModified": 1763799335, + "narHash": "sha256-b6hgDHjrLgTp4Y8DD5woGChg0R+yH16m0ZWVi9BhjrA=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "cfc01b895c0c7cbb9692852488675cc46693bd2a", + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/DeterminateSystems/nix/2.0" + "owner": "YaLTeR", + "repo": "niri", + "type": "github" } }, - "nix_3": { + "nix": { "inputs": { - "flake-compat": "flake-compat_3", - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts", "git-hooks-nix": "git-hooks-nix", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs", "nixpkgs-23-11": "nixpkgs-23-11", "nixpkgs-regression": "nixpkgs-regression" }, "locked": { - "lastModified": 1742824067, - "narHash": "sha256-rBPulEBpn4IiqkPsetuh7BRzT2iGCzZYnogTAsbrvhU=", - "rev": "9cb662df7442a1e2c4600fb8ecb2ad613ebc5a95", - "revCount": 19496, + "lastModified": 1763534330, + "narHash": "sha256-gTuB2qBdSKCKnZwENTqScs/pPBaZQOv6zZ1KJvV/ohk=", + "rev": "be871f9baf5366a220b5f25634eebab6f452a017", + "revCount": 23278, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nix/2.27.1/0195c8c5-1964-7a31-b025-ebf9bfeef991/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nix-src/3.13.2/019a9af6-3d7b-71bc-bccd-8b18e147ad77/source.tar.gz" }, "original": { "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nix/%3D2.27.1" + "url": "https://flakehub.com/f/DeterminateSystems/nix-src/%2A" } }, - "nixpkgs": { + "nix-flatpak": { "locked": { - "lastModified": 1733212471, - "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "55d15ad12a74eb7d4646254e13638ad0c4128776", + "lastModified": 1739444422, + "narHash": "sha256-iAVVHi7X3kWORftY+LVbRiStRnQEob2TULWyjMS6dWg=", + "owner": "gmodena", + "repo": "nix-flatpak", + "rev": "5e54c3ca05a7c7d968ae1ddeabe01d2a9bc1e177", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", + "owner": "gmodena", + "ref": "latest", + "repo": "nix-flatpak", + "type": "github" + } + }, + "nix_2": { + "inputs": { + "flake-compat": [ + "devenv", + "flake-compat" + ], + "flake-parts": [ + "devenv", + "flake-parts" + ], + "git-hooks-nix": [ + "devenv", + "git-hooks" + ], + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "nixpkgs-23-11": [ + "devenv" + ], + "nixpkgs-regression": [ + "devenv" + ] + }, + "locked": { + "lastModified": 1761648602, + "narHash": "sha256-H97KSB/luq/aGobKRuHahOvT1r7C03BgB6D5HBZsbN8=", + "owner": "cachix", + "repo": "nix", + "rev": "3e5644da6830ef65f0a2f7ec22830c46285bfff6", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "devenv-2.30.6", + "repo": "nix", "type": "github" } }, + "nixpkgs": { + "locked": { + "lastModified": 1761597516, + "narHash": "sha256-wxX7u6D2rpkJLWkZ2E932SIvDJW8+ON/0Yy8+a5vsDU=", + "rev": "daf6dc47aa4b44791372d6139ab7b25269184d55", + "revCount": 811874, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2505.811874%2Brev-daf6dc47aa4b44791372d6139ab7b25269184d55/019a3494-3498-707e-9086-1fb81badc7fe/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2505" + } + }, "nixpkgs-23-11": { "locked": { "lastModified": 1717159533, @@ -445,11 +670,11 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1743296961, - "narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=", + "lastModified": 1761765539, + "narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa", + "rev": "719359f4562934ae99f5443f20aa06c2ffff91fc", "type": "github" }, "original": { @@ -476,27 +701,41 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1741992157, - "narHash": "sha256-nlIfTsTrMSksEJc1f7YexXiPVuzD1gOfeN1ggwZyUoc=", - "owner": "nixos", + "lastModified": 1763622513, + "narHash": "sha256-1jQnuyu82FpiSxowrF/iFK6Toh9BYprfDqfs4BB+19M=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "da4b122f63095ca1199bd4d526f9e26426697689", + "rev": "c58bc7f5459328e4afac201c5c4feb7c818d604b", "type": "github" }, "original": { - "owner": "nixos", - "ref": "release-24.11", + "owner": "NixOS", + "ref": "nixos-25.05", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-unstable": { + "nixpkgs_2": { + "locked": { + "lastModified": 1763375004, + "narHash": "sha256-e81Xfa7xhRZfqGB4s3xEvrg4p1v+fToM6CIQlXUyaX0=", + "rev": "8b6600824693a9c706ef09bd86711ca393703466", + "revCount": 897465, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.897465%2Brev-8b6600824693a9c706ef09bd86711ca393703466/019a9577-b407-75dd-b18b-3308def1c215/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/nixpkgs-weekly/0.1" + } + }, + "nixpkgs_3": { "locked": { - "lastModified": 1741865919, - "narHash": "sha256-4thdbnP6dlbdq+qZWTsm4ffAwoS8Tiq1YResB+RP6WE=", + "lastModified": 1763618868, + "narHash": "sha256-v5afmLjn/uyD9EQuPBn7nZuaZVV9r+JerayK/4wvdWA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "573c650e8a14b2faa0041645ab18aed7e60f0c9a", + "rev": "a8d610af3f1a5fb71e23e08434d8d61a466fc942", "type": "github" }, "original": { @@ -506,161 +745,205 @@ "type": "github" } }, - "nixpkgs_2": { + "nur": { + "inputs": { + "flake-parts": [ + "stylix", + "flake-parts" + ], + "nixpkgs": [ + "stylix", + "nixpkgs" + ] + }, "locked": { - "lastModified": 1717432640, - "narHash": "sha256-+f9c4/ZX5MWDOuB1rKoWj+lBNm0z0rs4CK47HBLxy1o=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "88269ab3044128b7c2f4c7d68448b2fb50456870", + "lastModified": 1758998580, + "narHash": "sha256-VLx0z396gDCGSiowLMFz5XRO/XuNV+4EnDYjdJhHvUk=", + "owner": "nix-community", + "repo": "NUR", + "rev": "ba8d9c98f5f4630bcb0e815ab456afd90c930728", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "release-24.05", - "repo": "nixpkgs", + "owner": "nix-community", + "repo": "NUR", "type": "github" } }, - "nixpkgs_3": { + "root": { + "inputs": { + "dankshell": "dankshell", + "determinate": "determinate", + "devenv": "devenv", + "disko": "disko", + "flake-parts": "flake-parts_3", + "home-manager": "home-manager", + "niri": "niri", + "nix-flatpak": "nix-flatpak", + "nixpkgs": "nixpkgs_3", + "stylix": "stylix" + } + }, + "stylix": { + "inputs": { + "base16": "base16", + "base16-fish": "base16-fish", + "base16-helix": "base16-helix", + "base16-vim": "base16-vim", + "firefox-gnome-theme": "firefox-gnome-theme", + "flake-parts": "flake-parts_4", + "gnome-shell": "gnome-shell", + "nixpkgs": [ + "nixpkgs" + ], + "nur": "nur", + "systems": "systems", + "tinted-foot": "tinted-foot", + "tinted-kitty": "tinted-kitty", + "tinted-schemes": "tinted-schemes", + "tinted-tmux": "tinted-tmux", + "tinted-zed": "tinted-zed" + }, "locked": { - "lastModified": 1733477122, - "narHash": "sha256-qamMCz5mNpQmgBwc8SB5tVMlD5sbwVIToVZtSxMph9s=", - "owner": "cachix", - "repo": "devenv-nixpkgs", - "rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857", + "lastModified": 1763767967, + "narHash": "sha256-BMiqCHUxp2zoAjWCpvj5Scf0J+yTiXpkBlFuRo2nFIg=", + "owner": "nix-community", + "repo": "stylix", + "rev": "cd11c057b054609b8463c20e6065de424b30b89d", "type": "github" }, "original": { - "owner": "cachix", - "ref": "rolling", - "repo": "devenv-nixpkgs", + "owner": "nix-community", + "repo": "stylix", "type": "github" } }, - "nixpkgs_4": { + "systems": { "locked": { - "lastModified": 1734359947, - "narHash": "sha256-1Noao/H+N8nFB4Beoy8fgwrcOQLVm9o4zKW1ODaqK9E=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "48d12d5e70ee91fe8481378e540433a7303dbf6a", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "release-24.11", - "repo": "nixpkgs", + "owner": "nix-systems", + "repo": "default", "type": "github" } }, - "nixpkgs_5": { + "tinted-foot": { + "flake": false, "locked": { - "lastModified": 1742937945, - "narHash": "sha256-lWc+79eZRyvHp/SqMhHTMzZVhpxkRvthsP1Qx6UCq0E=", - "rev": "d02d88f8de5b882ccdde0465d8fa2db3aa1169f7", - "revCount": 716288, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.716288%2Brev-d02d88f8de5b882ccdde0465d8fa2db3aa1169f7/0195d574-d7fe-7866-9aa3-2e5ea0618cf6/source.tar.gz" + "lastModified": 1726913040, + "narHash": "sha256-+eDZPkw7efMNUf3/Pv0EmsidqdwNJ1TaOum6k7lngDQ=", + "owner": "tinted-theming", + "repo": "tinted-foot", + "rev": "fd1b924b6c45c3e4465e8a849e67ea82933fcbe4", + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/%2A" + "owner": "tinted-theming", + "repo": "tinted-foot", + "rev": "fd1b924b6c45c3e4465e8a849e67ea82933fcbe4", + "type": "github" } }, - "nixpkgs_6": { + "tinted-kitty": { + "flake": false, "locked": { - "lastModified": 1743689281, - "narHash": "sha256-y7Hg5lwWhEOgflEHRfzSH96BOt26LaYfrYWzZ+VoVdg=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "2bfc080955153be0be56724be6fa5477b4eefabb", + "lastModified": 1735730497, + "narHash": "sha256-4KtB+FiUzIeK/4aHCKce3V9HwRvYaxX+F1edUrfgzb8=", + "owner": "tinted-theming", + "repo": "tinted-kitty", + "rev": "de6f888497f2c6b2279361bfc790f164bfd0f3fa", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", + "owner": "tinted-theming", + "repo": "tinted-kitty", "type": "github" } }, - "root": { - "inputs": { - "devenv": "devenv", - "disko": "disko", - "flake-parts": "flake-parts_2", - "ghostty": "ghostty", - "home-manager": "home-manager", - "nix": "nix_2", - "nixpkgs": "nixpkgs_6" + "tinted-schemes": { + "flake": false, + "locked": { + "lastModified": 1757716333, + "narHash": "sha256-d4km8W7w2zCUEmPAPUoLk1NlYrGODuVa3P7St+UrqkM=", + "owner": "tinted-theming", + "repo": "schemes", + "rev": "317a5e10c35825a6c905d912e480dfe8e71c7559", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "schemes", + "type": "github" } }, - "systems": { + "tinted-tmux": { + "flake": false, "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1757811970, + "narHash": "sha256-n5ZJgmzGZXOD9pZdAl1OnBu3PIqD+X3vEBUGbTi4JiI=", + "owner": "tinted-theming", + "repo": "tinted-tmux", + "rev": "d217ba31c846006e9e0ae70775b0ee0f00aa6b1e", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "tinted-theming", + "repo": "tinted-tmux", "type": "github" } }, - "zig": { - "inputs": { - "flake-compat": [ - "ghostty" - ], - "flake-utils": [ - "ghostty", - "flake-utils" - ], - "nixpkgs": [ - "ghostty", - "nixpkgs-stable" - ] - }, + "tinted-zed": { + "flake": false, "locked": { - "lastModified": 1741825901, - "narHash": "sha256-aeopo+aXg5I2IksOPFN79usw7AeimH1+tjfuMzJHFdk=", - "owner": "mitchellh", - "repo": "zig-overlay", - "rev": "0b14285e283f5a747f372fb2931835dd937c4383", + "lastModified": 1757811247, + "narHash": "sha256-4EFOUyLj85NRL3OacHoLGEo0wjiRJzfsXtR4CZWAn6w=", + "owner": "tinted-theming", + "repo": "base16-zed", + "rev": "824fe0aacf82b3c26690d14e8d2cedd56e18404e", "type": "github" }, "original": { - "owner": "mitchellh", - "repo": "zig-overlay", + "owner": "tinted-theming", + "repo": "base16-zed", "type": "github" } }, - "zon2nix": { - "inputs": { - "flake-utils": [ - "ghostty", - "flake-utils" - ], - "nixpkgs": [ - "ghostty", - "nixpkgs-unstable" - ] + "xwayland-satellite-stable": { + "flake": false, + "locked": { + "lastModified": 1755491097, + "narHash": "sha256-m+9tUfsmBeF2Gn4HWa6vSITZ4Gz1eA1F5Kh62B0N4oE=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "388d291e82ffbc73be18169d39470f340707edaa", + "type": "github" }, + "original": { + "owner": "Supreeeme", + "ref": "v0.7", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "xwayland-satellite-unstable": { + "flake": false, "locked": { - "lastModified": 1742104771, - "narHash": "sha256-LhidlyEA9MP8jGe1rEnyjGFCzLLgCdDpYeWggibayr0=", - "owner": "jcollie", - "repo": "zon2nix", - "rev": "56c159be489cc6c0e73c3930bd908ddc6fe89613", + "lastModified": 1763704521, + "narHash": "sha256-ceYEV6PnvUN8Zixao4gpPuN+VT3B0SlAXKuPNHZhqUY=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "f379ff5722a821212eb59ada9cf8e51cb3654aad", "type": "github" }, "original": { - "owner": "jcollie", - "ref": "56c159be489cc6c0e73c3930bd908ddc6fe89613", - "repo": "zon2nix", + "owner": "Supreeeme", + "repo": "xwayland-satellite", "type": "github" } } diff --git a/flake.nix b/flake.nix index 1e076b4c..2899880b 100644 --- a/flake.nix +++ b/flake.nix @@ -2,20 +2,35 @@ inputs = { # Mirroring nixpkgs unstable nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - ghostty.url = "github:ghostty-org/ghostty"; - # ghostty.inputs.nixpkgs-stable.follows = "nixpkgs"; - # ghostty.inputs.nixpkgs-unstable.follows = "nixpkgs"; + determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/*"; + + flake-parts.url = "github:hercules-ci/flake-parts"; + + nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest"; + + # ghostty.url = "github:ghostty-org/ghostty"; + # ghostty.inputs.nixpkgs.follows = "nixpkgs"; + disko.url = "github:nix-community/disko"; disko.inputs.nixpkgs.follows = "nixpkgs"; - # Updating nix itself - nix.url = "https://flakehub.com/f/DeterminateSystems/nix/2.0"; + niri.url = "github:sodiboo/niri-flake"; + niri.inputs.nixpkgs.follows = "nixpkgs"; + + dankshell.url = "github:AvengeMedia/DankMaterialShell"; + dankshell.inputs.nixpkgs.follows = "nixpkgs"; + + stylix = { + url = "github:nix-community/stylix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; # For running GUI apps # nixGL.url = "github:nix-community/nixGL"; # nixGL.inputs.nixpkgs.follows = "nixpkgs"; devenv.url = "github:cachix/devenv"; + devenv.inputs.nixpkgs.follows = "nixpkgs"; # Fix static linking issues # flox.url = "github:flox/flox"; @@ -40,8 +55,13 @@ flake-parts, home-manager, nixpkgs, - ghostty, + determinate, + # ghostty, + stylix, + dankshell, + niri, disko, + nix-flatpak, # neovim, # devenv, # flox, @@ -54,6 +74,14 @@ linux-user = "sand"; mac-user = "san.nguyen"; + nix-options = { + nix.registry.nixpkgs.flake = nixpkgs; + nix.settings.auto-optimise-store = true; + nix.settings.warn-dirty = false; + nix.gc.automatic = true; + nix.gc.dates = "daily"; + nix.gc.options = "--delete-older-than +5"; + }; modules = { user }: [ @@ -71,7 +99,6 @@ ]; } ./users/${user}/home.nix - inputs.nix.homeManagerModules.default ]; in flake-parts.lib.mkFlake { inherit inputs; } ( @@ -83,12 +110,12 @@ imports = [ inputs.devenv.flakeModule ]; perSystem = - { system, ... }: + { ... }: { devenv.shells.default = { - languages.nix.enable = true; + # languages.nix.enable = true; }; - packages.default = ghostty.packages.${system}.ghostty; + # packages.default = ghostty.packages.${system}.ghostty; }; flake.overlays.default = final: prev: { @@ -105,36 +132,71 @@ # ld-floxlib = ld-floxlib.packages.${final.stdenv.system}.ld-floxlib; }; - flake.nixosConfigurations.parallels-desktop = nixpkgs.lib.nixosSystem rec { + flake.nixosConfigurations.parallels-desktop = nixpkgs.lib.nixosSystem { system = "aarch64-linux"; modules = [ ./machines/parallels/configuration.nix disko.nixosModules.disko + stylix.nixosModules.stylix + niri.nixosModules.niri + determinate.nixosModules.default + nix-flatpak.nixosModules.nix-flatpak + nix-options ./machines/parallels/disko-config.nix ./machines/common.nix { - disko.devices.disk.main.device = "/dev/sdc"; - disko.devices.disk.work.device = "/dev/sdb"; + nixpkgs.overlays = [ + self.overlays.default + self.overlays.linux + # fenix.overlays.default + niri.overlays.niri + ]; + nixpkgs.config.permittedInsecurePackages = [ + "beekeeper-studio-5.3.4" + ]; + } + ( + { pkgs, ... }: + { + stylix.enable = true; + stylix.image = ./images/wall.png; + stylix.polarity = "dark"; + stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/onedark.yaml"; + stylix.autoEnable = false; + } + ) + { + home-manager.users.${linux-user} = { + imports = [ + dankshell.homeModules.dankMaterialShell.default + dankshell.homeModules.dankMaterialShell.niri + ]; + }; + } + { + disko.devices.disk.primary.device = "/dev/sda"; + disko.devices.disk.secondary.device = "/dev/sdb"; environment.systemPackages = [ - ghostty.packages.${system}.ghostty + # ghostty.packages.${system}.ghostty # nixGL.packages.${system}.default ]; } home-manager.nixosModules.home-manager ]; }; - flake.nixosConfigurations.vmware-fusion = nixpkgs.lib.nixosSystem rec { + flake.nixosConfigurations.vmware-fusion = nixpkgs.lib.nixosSystem { system = "aarch64-linux"; modules = [ ./machines/vmware-fusion/configuration.nix disko.nixosModules.disko + stylix.nixosModules.stylix ./machines/vmware-fusion/disko-config.nix ./machines/common.nix { disko.devices.disk.main.device = "/dev/nvme0n3"; - disko.devices.disk.work.device = "/dev/nvme0n4"; + disko.devices.disk.home.device = "/dev/nvme0n4"; environment.systemPackages = [ - ghostty.packages.${system}.ghostty + # ghostty.packages.${system}.ghostty # nixGL.packages.${system}.default ]; } diff --git a/machines/common.nix b/machines/common.nix index e37534a8..442506ff 100644 --- a/machines/common.nix +++ b/machines/common.nix @@ -14,28 +14,23 @@ let in { boot.kernelParams = [ "video=Virtual-1:4112x2572" ]; - nix.package = pkgs.nixVersions.stable; - nix.extraOptions = '' - experimental-features = nix-command flakes - trusted-users = root ${username} - ''; nix.nixPath = [ "nixpkgs=flake:nixpkgs" "nixos-config=/etc/nixos/configuration.nix" ]; nix.settings = { - auto-optimise-store = true; + eval-cores = 2; substituters = [ - "https://hyprland.cachix.org" - "https://devenv.cachix.org" - "https://cache.flox.dev" - "https://ghostty.cachix.org" + # "https://hyprland.cachix.org" + # "https://devenv.cachix.org" + # "https://cache.flox.dev" + # "https://ghostty.cachix.org" ]; trusted-public-keys = [ - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" - "flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=" - "ghostty.cachix.org-1:QB389yTa6gTyneehvqG58y0WnHjQOqgnA+wBnpWWxns=" + # "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + # "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" + # "flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=" + # "ghostty.cachix.org-1:QB389yTa6gTyneehvqG58y0WnHjQOqgnA+wBnpWWxns=" ]; }; @@ -82,36 +77,89 @@ in LC_TIME = "en_US.UTF-8"; }; - # Enable the X11 windowing system. - services.xserver.enable = true; + services = { + # GTK theme config + dbus = { + enable = true; + packages = [ pkgs.dconf ]; + }; + }; + + # Disable Orca screen reader + services.orca.enable = false; # Enable the GNOME Desktop Environment. - services.xserver.displayManager.gdm.enable = true; - services.xserver.desktopManager.gnome.enable = true; + services.displayManager.gdm.enable = true; + # Gnome config + services.udev.packages = [ pkgs.gnome-settings-daemon ]; + + services.desktopManager.gnome.enable = true; services.xserver.excludePackages = [ pkgs.xterm ]; - programs.hyprland.enable = true; - programs.hyprland.withUWSM = true; - programs.hyprland.systemd.setPath.enable = true; - xdg.portal.config = { - common = { - default = [ - "xdph" - "gtk" - ]; - "org.freedesktop.impl.portal.Secret" = [ "gnome-keyring" ]; - "org.freedesktop.portal.FileChooser" = [ "xdg-desktop-portal-gtk" ]; + services.gnome.core-apps.enable = false; + services.gnome.core-developer-tools.enable = false; + services.gnome.games.enable = false; + environment.gnome.excludePackages = with pkgs; [ + gnome-tour + gnome-user-docs + ]; + + programs = { + dconf.enable = true; + niri = { + enable = true; + package = pkgs.niri-unstable; }; }; + + xdg.portal = { + enable = true; + config = { + common = { + default = [ + "gtk" + "gnome" + ]; + }; + niri = { + default = [ + "gtk" + "gnome" + ]; + }; + }; + extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk + xdg-desktop-portal-gnome + ]; + xdgOpenUsePortal = true; + }; + + programs.hyprland.enable = false; + programs.hyprland.withUWSM = false; + programs.hyprland.systemd.setPath.enable = false; + # For Hyprland + # xdg.portal.config = { + # common = { + # default = [ + # "xdph" + # "gtk" + # ]; + # "org.freedesktop.impl.portal.Secret" = [ "gnome-keyring" ]; + # "org.freedesktop.portal.FileChooser" = [ "xdg-desktop-portal-gtk" ]; + # }; + # }; + + # services.desktopManager.cosmic.enable = true; + # services.desktopManager.cosmic.xwayland.enable = true; + systemd.user.services = { prlcc = { - wantedBy = lib.mkForce [ ]; - }; - prldnd = { - wantedBy = lib.mkForce [ ]; - }; - prlsga = { - wantedBy = lib.mkForce [ ]; + serviceConfig = { + RestartSec = "1"; + Restart = "always"; + }; }; }; @@ -124,34 +172,38 @@ in variant = ""; }; - # Enable CUPS to print documents. services.printing.enable = false; + security.rtkit.enable = true; + services.openssh = { + enable = true; + ports = [ 22 ]; + settings = { + PasswordAuthentication = true; + AllowUsers = [ "sand" ]; + UseDns = true; + X11Forwarding = false; + PermitRootLogin = "no"; # "yes", "without-password", "prohibit-password", "forced-commands-only", "no" + }; + }; # Enable sound with pipewire. - # hardware.pulseaudio.enable = false; services.pulseaudio.enable = false; - security.rtkit.enable = true; services.pipewire = { enable = true; alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; + # Prerequisite for screensharing + wireplumber.enable = true; }; fonts.packages = [ comic-code - ] ++ builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts); - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; + ] + ++ builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts); programs.zsh.enable = true; + programs.bash.enable = true; programs.nix-ld.enable = true; # Define a user account. Don't forget to set a password with ‘passwd’. @@ -182,6 +234,9 @@ in # Install firefox. programs.firefox.enable = true; + programs.firefox.package = ( + pkgs.wrapFirefox (pkgs.firefox-unwrapped.override { pipewireSupport = true; }) { } + ); # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -194,14 +249,14 @@ in umount vim xdg-utils - glxinfo + mesa-demos gnumake gcc # Development alacritty git - kitty + # kitty wget neovim @@ -212,21 +267,69 @@ in xclip wl-clipboard clipnotify + + # Niri + wayland-utils + nautilus + chromium + xwayland-satellite ]; - services.flatpak.enable = true; + services.flatpak = { + enable = true; + update.onActivation = true; + packages = [ ]; + }; + + networking.firewall.allowedTCPPorts = [ + 22 # Port for SSH Tunnel + 8002 # ADK Web + 3000 # Livekit frontend + 7880 # Livekit RTC server + 5187 # UI + 8000 # Backend + 3005 # Backend with OAuth2 + ]; environment.sessionVariables = { NIXOS_OZONE_WL = "1"; LIBSEAT_BACKEND = "logind"; SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; EDITOR = "${pkgs.neovim}/bin/nvim"; + SHELL = "${pkgs.zsh}/bin/zsh"; + XDG_CURRENT_DESKTOP = "niri"; + XDG_SESSION_DESKTOP = "Wayland"; + XDG_SESSION_TYPE = "wayland"; + GDK_BACKEND = "wayland,x11"; + QT_QPA_PLATFORM = "wayland;xcb"; + + # GTK theme settings + GTK_THEME = "Fluent-Dark"; + + QT_AUTO_SCREEN_SCALE_FACTOR = "1"; + QT_QPA_PLATFORMTHEME = "qt6ct"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + + # Ensure icon themes are found + XCURSOR_THEME = "Fluent-dark-cursors"; + + MOZ_ENABLE_WAYLAND = "1"; + + ELECTRON_OZONE_PLATFORM_HINT = "auto"; + + CHROMIUM_USER_FLAGS = "--force-device-scale-factor=1"; }; hardware.graphics.enable = true; hardware.graphics.extraPackages = [ pkgs.mesa ]; - virtualisation.docker.enable = true; + virtualisation.docker = { + enable = true; + autoPrune = { + enable = true; + dates = "weekly"; + }; + }; # Allow apps to update firmware services.fwupd.enable = true; diff --git a/machines/parallels/disko-config.nix b/machines/parallels/disko-config.nix index 591a0803..c1b7183c 100644 --- a/machines/parallels/disko-config.nix +++ b/machines/parallels/disko-config.nix @@ -1,24 +1,30 @@ { disko.devices = { disk = { - main = { + primary = { type = "disk"; + device = "/dev/sda"; content = { type = "gpt"; partitions = { ESP = { - size = "1G"; + size = "2G"; type = "EF00"; content = { type = "filesystem"; format = "vfat"; + extraArgs = [ + "-n" + "boot" + ]; mountpoint = "/boot"; mountOptions = [ "defaults" + "umask=0077" ]; }; }; - ext4 = { + root = { size = "100%"; content = { type = "filesystem"; @@ -36,21 +42,22 @@ }; }; }; - work = { + secondary = { type = "disk"; + device = "/dev/sdb"; content = { type = "gpt"; partitions = { - ext4 = { + home = { size = "100%"; content = { type = "filesystem"; format = "ext4"; extraArgs = [ "-L" - "work" + "home" ]; - mountpoint = "/home/sand/Work"; + mountpoint = "/home"; mountOptions = [ "noatime" ]; diff --git a/machines/parallels/hardware-configuration.nix b/machines/parallels/hardware-configuration.nix index 162f520d..a8412859 100644 --- a/machines/parallels/hardware-configuration.nix +++ b/machines/parallels/hardware-configuration.nix @@ -28,5 +28,6 @@ nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; hardware.parallels.enable = true; + services.timesyncd.enable = lib.mkForce true; # Disable time sync from Mac nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "prl-tools" ]; } diff --git a/modules/aider/.aider.conf.yml b/modules/aider/.aider.conf.yml new file mode 100644 index 00000000..4a80ee4f --- /dev/null +++ b/modules/aider/.aider.conf.yml @@ -0,0 +1,16 @@ +--- +auto-commits: false +auto-lint: false +chat-mode: architect +auto-accept-architect: false +code-theme: github-dark +openai-api-base: http://localhost:5000/openai/v1 +stream: true +watch-files: true +pretty: true +model: vertex_ai/gemini-2.5-pro +editor-model: vertex_ai/gemini-2.5-flash +weak-model: vertex_ai/gemini-2.5-flash +edit-format: udiff +git: false +cache-prompts: true diff --git a/modules/aider/.aider.model.settings.yml b/modules/aider/.aider.model.settings.yml new file mode 100644 index 00000000..cceaa60e --- /dev/null +++ b/modules/aider/.aider.model.settings.yml @@ -0,0 +1,13 @@ +--- +- name: aider/extra_params + extra_params: + extra_headers: + openai-project: "288" +- name: bedrock/us.anthropic.claude-3-7-sonnet-20250219-v1:0 + edit_format: diff + use_temperature: false + extra_params: + max_tokens: 64000 + thinking: + type: enabled + budget_tokens: 32000 diff --git a/modules/aider/default.nix b/modules/aider/default.nix new file mode 100644 index 00000000..ce8facbe --- /dev/null +++ b/modules/aider/default.nix @@ -0,0 +1,5 @@ +{ ... }: +{ + home.file.".aider.conf.yml".source = ./.aider.conf.yml; + home.file.".aider.model.settings.yml".source = ./.aider.model.settings.yml; +} diff --git a/modules/alacritty/alacritty.toml b/modules/alacritty/alacritty.toml index d55a10c2..774be611 100644 --- a/modules/alacritty/alacritty.toml +++ b/modules/alacritty/alacritty.toml @@ -2,7 +2,7 @@ decorations = "None" opacity = 0.95 padding = { x = 10, y = 10 } -startup_mode = "Maximized" +# startup_mode = "Maximized" [scrolling] history = 100000 @@ -13,34 +13,32 @@ bold = { family = "Comic Code Ligatures", style = "Regular" } italic = { family = "Comic Code Ligatures", style = "Italic" } bold_italic = { family = "Comic Code Ligatures", style = "Italic" } -# Colors (Ayu Dark) - # Default colors [colors.primary] background = '#0A0E14' -foreground = '#B3B1AD' +foreground = '#d9e0ee' # Normal colors [colors.normal] -black = '#01060E' -red = '#EA6C73' -green = '#91B362' -yellow = '#F9AF4F' -blue = '#53BDFA' -magenta = '#FAE994' -cyan = '#90E1C6' -white = '#C7C7C7' +black = '#272734' +red = '#ec6a88' +green = '#3FDAA4' +yellow = '#e1c697' +blue = '#78a9ff' +magenta = '#be95ff' +cyan = '#09deda' +white = '#d9e0ee' # Bright colors [colors.bright] -black = '#686868' -red = '#F07178' -green = '#C2D94C' -yellow = '#FFB454' -blue = '#59C2FF' -magenta = '#FFEE99' -cyan = '#95E6CB' -white = '#FFFFFF' +black = '#67698a' +red = '#ff7eb6' +green = '#08bdba' +yellow = '#e8d4b0' +blue = '#3fc6de' +magenta = '#936fdc' +cyan = '#6be6e6' +white = '#ffffff' [selection] save_to_clipboard = true @@ -51,9 +49,10 @@ vi_mode_style = { shape = "Block", blinking = "Off" } [keyboard] bindings = [ + { key = "[", mods = "Control", action = "ToggleViMode" }, { key = "V", mods = "Control", mode = "~Vi", action = "Paste" }, { key = "Enter", mods = "Control|Shift", action = "CreateNewWindow" }, { key = "+", mods = "Control|Shift", action = "IncreaseFontSize" }, { key = "_", mods = "Control|Shift", action = "DecreaseFontSize" }, - { key = "0", mods = "Control|Shift", action = "ResetFontSize" }, + { key = ")", mods = "Control|Shift", action = "ResetFontSize" }, ] diff --git a/modules/cloud/default.nix b/modules/cloud/default.nix index 8051b82a..2e0b6e6a 100644 --- a/modules/cloud/default.nix +++ b/modules/cloud/default.nix @@ -3,7 +3,7 @@ { home.packages = with pkgs; [ # Cloud - azure-cli + # azure-cli google-cloud-sdk awscli2 ssm-session-manager-plugin diff --git a/modules/direnv/default.nix b/modules/direnv/default.nix index 774e0f4d..cc2ad2de 100644 --- a/modules/direnv/default.nix +++ b/modules/direnv/default.nix @@ -2,6 +2,12 @@ { programs.direnv.enable = true; programs.direnv.nix-direnv.enable = true; + programs.direnv.config = { + global = { + log_format = "-"; + log_filter = "^$"; + }; + }; programs.direnv.stdlib = '' : ''${XDG_CACHE_HOME:=$HOME/.cache} declare -A direnv_layout_dirs @@ -13,50 +19,5 @@ echo "$XDG_CACHE_HOME/direnv/layouts/$hash-$path" )}" } - - use_flake() { - watch_file flake.nix - watch_file flake.lock - eval "$(nix print-dev-env --profile "$(direnv_layout_dir)/flake-profile")" - } - - layout_poetry() { - if has poetry; then - if [[ ! -f pyproject.toml ]]; then - echo 'No pyproject.toml found. Use `poetry init` to create one first.' - poetry init - fi - - # create venv if it doesn't exist - poetry run true - - export VIRTUAL_ENV=$(poetry env info --path) - export POETRY_ACTIVE=1 - PATH_add "$VIRTUAL_ENV/bin" - fi - } - - layout_pdm() { - if has pdm; then - # create venv if it doesn't exist - if [[ ! -d .venv ]]; then - pdm venv create - fi - - if [[ ! -f pyproject.toml ]]; then - echo 'No pyproject.toml found. Use `pdm init` to create one first.' - pdm init - fi - - if [[ "$VIRTUAL_ENV" == "" ]]; then - pdm use -q --venv in-project - eval $(pdm venv activate in-project) - - export VIRTUAL_ENV=$(pwd)/.venv - export PYTHONPATH=$VIRTUAL_ENV/lib/$(command ls $VIRTUAL_ENV/lib | head -1)/site-packages:$PYTHONPATH - PATH_add "$VIRTUAL_ENV/bin" - fi - fi - } ''; } diff --git a/modules/ghostty/config b/modules/ghostty/config index 05ddc8e1..a8b7738b 100644 --- a/modules/ghostty/config +++ b/modules/ghostty/config @@ -56,6 +56,7 @@ macos-option-as-alt = right shell-integration = zsh shell-integration-features = sudo,cursor,title scrollback-limit = 1_000_000_000 +window-inherit-working-directory = true keybind = clear keybind = ctrl+v=paste_from_clipboard @@ -63,6 +64,7 @@ keybind = ctrl+v=paste_from_clipboard keybind = ctrl+shift+zero=reset_font_size keybind = ctrl+shift+plus=increase_font_size:1 keybind = ctrl+shift+minus=decrease_font_size:1 +keybind = ctrl+shift+enter=new_window background = #292A37 foreground = #ffffff diff --git a/modules/git/default.nix b/modules/git/default.nix index 3cd5a853..50f29c8e 100644 --- a/modules/git/default.nix +++ b/modules/git/default.nix @@ -1,8 +1,21 @@ { ... }: { + programs.delta = { + enable = true; + options = { + decorations = { + commit-decoration-style = "bold yellow box ul"; + file-decoration-style = "none"; + file-style = "bold yellow ul"; + }; + features = "side-by-side decorations"; + whitespace-error-style = "22 reverse"; + navigate = true; + }; + }; programs.git = { enable = true; - extraConfig = { + settings = { github.user = "sandangel"; push.default = "tracking"; pull.ff = "only"; @@ -17,9 +30,9 @@ reflog = "delta"; show = "delta"; }; + user.name = "San Nguyen"; + user.email = "vinhsannguyen91@gmail.com"; }; - userName = "San Nguyen"; - userEmail = "vinhsannguyen91@gmail.com"; includes = [ { condition = "gitdir:~/Work/Woven/**"; @@ -30,18 +43,5 @@ } ]; lfs.enable = true; - delta = { - enable = true; - options = { - decorations = { - commit-decoration-style = "bold yellow box ul"; - file-decoration-style = "none"; - file-style = "bold yellow ul"; - }; - features = "side-by-side decorations"; - whitespace-error-style = "22 reverse"; - navigate = true; - }; - }; }; } diff --git a/modules/gnome/default.nix b/modules/gnome/default.nix index c9c99209..fb426514 100644 --- a/modules/gnome/default.nix +++ b/modules/gnome/default.nix @@ -13,7 +13,7 @@ let owner = "vinceliuice"; repo = "Fluent-gtk-theme"; rev = "master"; - hash = "sha256-JW4ed7I1rxAlWj+hJEfWIRE7zaWvF7Ym3W3bqljwkMY="; + hash = "sha256-AaFj9lG9lWg0a0ksJ0ufoUpsunR3uDhcdb7oSrvAmPI="; }; }); gtk-theme = "Fluent-Dark"; @@ -25,27 +25,20 @@ in home.file.".icons".source = "${fluent-icon-theme}/share/icons"; - home.sessionVariables = { - XDG_SESSION_TYPE = "wayland"; + # Also symlink to .local/share for better compatibility + home.file.".local/share/themes".source = "${fluent-gtk-theme}/share/themes"; + home.file.".local/share/icons".source = "${fluent-icon-theme}/share/icons"; - GDK_BACKEND = "wayland,x11"; - GDK_SCALE = "1"; + # Qt theme configuration + home.file.".config/qt6ct/qt6ct.conf".source = ./qt6ct.conf; + home.file.".config/qt5ct/qt5ct.conf".source = ./qt5ct.conf; - QT_AUTO_SCREEN_SCALE_FACTOR = "1"; - QT_QPA_PLATFORM = "wayland;xcb"; - QT_QPA_PLATFORMTHEME = "qt6ct"; - QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; - - SDL_VIDEODRIVER = "wayland"; - CLUTTER_BACKEND = "wayland"; - - MOZ_ENABLE_WAYLAND = "1"; - MOZ_USE_XINPUT2 = "1"; - - CHROMIUM_USER_FLAGS = "--force-device-scale-factor=1"; - }; home.packages = with pkgs; [ gnome-tweaks + qt6Packages.qt6ct + libsForQt5.qt5ct + adwaita-qt + adwaita-qt6 ]; gtk = { enable = true; @@ -60,12 +53,22 @@ in package = fluent-gtk-theme; }; + gtk2.extraConfig = '' + gtk-theme-name="${gtk-theme}" + gtk-icon-theme-name="${icon-theme}" + gtk-application-prefer-dark-theme=1 + ''; + gtk3.extraConfig = { gtk-application-prefer-dark-theme = 1; + gtk-theme-name = gtk-theme; + gtk-icon-theme-name = icon-theme; }; gtk4.extraConfig = { gtk-application-prefer-dark-theme = 1; + gtk-theme-name = gtk-theme; + gtk-icon-theme-name = icon-theme; }; }; @@ -80,6 +83,8 @@ in clock-show-weekday = true; color-scheme = "prefer-dark"; enable-hot-corners = false; + icon-theme = icon-theme; + gtk-theme = gtk-theme; }; "org/gnome/desktop/peripherals/keyboard" = { @@ -88,7 +93,7 @@ in }; "org/gnome/desktop/peripherals/mouse" = { - natural-scroll = false; + natural-scroll = true; speed = 1.0; }; diff --git a/modules/gnome/qt5ct.conf b/modules/gnome/qt5ct.conf new file mode 100644 index 00000000..09602f77 --- /dev/null +++ b/modules/gnome/qt5ct.conf @@ -0,0 +1,28 @@ +[Appearance] +icon_theme=Fluent-dark +style=Fluent-dark + +[Fonts] +general="Adwaita Sans,11" + +[Interface] +activate_item_on_single_click=1 +buttonbox_layout=0 +cursor_flash_time=1000 +dialog_buttons_have_icons=1 +double_click_interval=400 +gui_effects=@Invalid() +keyboard_scheme=2 +menus_have_icons=true +show_shortcuts_in_context_menus=true +stylesheets=@Invalid() +toolbutton_style=4 +underline_shortcut=1 +wheel_scroll_lines=3 + +[SettingsWindow] +geometry=@ByteArray() + +[Troubleshooting] +force_raster_widgets=1 +ignored_applications=@Invalid() diff --git a/modules/gnome/qt6ct.conf b/modules/gnome/qt6ct.conf new file mode 100644 index 00000000..09602f77 --- /dev/null +++ b/modules/gnome/qt6ct.conf @@ -0,0 +1,28 @@ +[Appearance] +icon_theme=Fluent-dark +style=Fluent-dark + +[Fonts] +general="Adwaita Sans,11" + +[Interface] +activate_item_on_single_click=1 +buttonbox_layout=0 +cursor_flash_time=1000 +dialog_buttons_have_icons=1 +double_click_interval=400 +gui_effects=@Invalid() +keyboard_scheme=2 +menus_have_icons=true +show_shortcuts_in_context_menus=true +stylesheets=@Invalid() +toolbutton_style=4 +underline_shortcut=1 +wheel_scroll_lines=3 + +[SettingsWindow] +geometry=@ByteArray() + +[Troubleshooting] +force_raster_widgets=1 +ignored_applications=@Invalid() diff --git a/modules/hyprland/default.nix b/modules/hyprland/default.nix index 8782aa5d..74c03fc2 100644 --- a/modules/hyprland/default.nix +++ b/modules/hyprland/default.nix @@ -1,7 +1,4 @@ { pkgs, ... }: -let - clipsync = pkgs.writeShellScriptBin "clipsync" (builtins.readFile ./scripts/hypr-clipsync.sh); -in { home.packages = with pkgs; [ hyprpaper @@ -9,7 +6,6 @@ in lxqt.lxqt-policykit clipse socat - clipsync libnotify ]; xdg.configFile."hypr/hyprpaper.conf".source = ./hyprpaper.conf; @@ -19,14 +15,17 @@ in wayland.windowManager.hyprland.systemd.enable = true; wayland.windowManager.hyprland.systemd.variables = [ "--all" ]; programs.zsh = { - initExtra = '' - . $HOME/.nix-config/modules/hyprland/hyprland.zsh + initContent = '' + if [[ -n $HYPRLAND_INSTANCE_SIGNATURE ]]; then + . $HOME/.nix-config/modules/hyprland/hyprland.zsh + fi ''; }; + programs.clipsync.enable = true; imports = [ # ./dunst - ./waybar - ./wofi + ../waybar + ../wofi # ./swaync ]; } diff --git a/modules/hyprland/hyprland.conf b/modules/hyprland/hyprland.conf index 5b54601e..9b7be573 100644 --- a/modules/hyprland/hyprland.conf +++ b/modules/hyprland/hyprland.conf @@ -25,7 +25,7 @@ monitor=,4112x2572,auto,2 # See https://wiki.hyprland.org/Configuring/Keywords/ # Set programs that you use -$terminal = ghostty -e "cd $(~/.nix-config/modules/hyprland/scripts/hypr-cwd.sh) && zsh" +$terminal = alacritty $fileManager = nautilus $menu = wofi -p Search $nvim_nav = ~/.nix-config/modules/hyprland/scripts/hypr-nvim-nav.sh @@ -211,11 +211,6 @@ input { } } -# https://wiki.hyprland.org/Configuring/Variables/#gestures -gestures { - workspace_swipe = false -} - # Example per-device config # See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more device { @@ -242,7 +237,7 @@ $mainMod = SUPER bind = Alt_R, T, exec, $toggle_term bind = Alt_R, W, workspace, emptym # Open terminal on new empty workspace bind = Alt_R, W, exec, $terminal -bind = CTRL_SHIFT, Return, exec, $terminal +bind = CTRL_SHIFT, Return, execr, pid=$(hyprctl activewindow -j | jq '.pid'); [ "$(hyprctl activewindow -j | jq -r '.class')" == "neovide" ] && dir=$(readlink /proc/"$pid"/cwd); [ "$(hyprctl activewindow -j | jq -r '.class')" != "neovide" ] && ppid=$(pgrep --newest --parent "$pid") && dir=$(readlink /proc/"$ppid"/cwd); $terminal --working-directory $dir bind = Alt_R, Q, killactive, # bind = $mainMod, M, exit, bind = $mainMod, E, exec, $fileManager @@ -300,8 +295,8 @@ bind = Control_L, L, exec, $nvim_nav r bind = Control_L, K, exec, $nvim_nav u bind = Control_L, J, exec, $nvim_nav d -bind = CTRL_SHIFT, V, exec, [float] ghostty -e 'clipse' -bindn = CTRL_SHIFT, Return, execr, [ "$(hyprctl activeworkspace -j | jq -r '.hasfullscreen')" == "true" ] && hyprctl dispatch fullscreen 1 +bind = CTRL_SHIFT, V, exec, [float] $terminal -e 'clipse' +bind = CTRL_SHIFT, Return, execr, [ "$(hyprctl activeworkspace -j | jq -r '.hasfullscreen')" == "true" ] && hyprctl dispatch fullscreen 1 binde = CTRL_SHIFT, equal, execr, $set_font_size_all binde = CTRL_SHIFT, minus, execr, $set_font_size_all binde = CTRL_SHIFT, 0, execr, $set_font_size_all @@ -336,13 +331,6 @@ bind = $mainMod, B, workspace, -1 # windowrulev2 = suppressevent maximize, class:.* # You'll probably like this. -# Parallels Shared Clipboard will create a tile window when switching to Host -# So we set window rules to not showing. -# windowrulev2 = float, title:^(Parallels Shared Clipboard)$ -# windowrulev2 = size 0 0, title:^(Parallels Shared Clipboard)$ -# windowrulev2 = maxsize 0 0, title:^(Parallels Shared Clipboard)$ -# windowrulev2 = opacity 0, title:^(Parallels Shared Clipboard)$ - # Style fullscreen window differently windowrulev2 = bordercolor rgb(FA0DED) rgb(3292F3) 45deg, fullscreen:1 @@ -354,7 +342,8 @@ windowrulev2 = bordercolor rgb(FA0DED) rgb(3292F3) 45deg, fullscreen:1 bindn = Alt_L, BackSpace, sendshortcut, Control_L, BackSpace, ^(firefox)$ bindn = Alt_L, BackSpace, sendshortcut, Control_L, BackSpace, ^(floorp)$ -# Hide empty window of Parallels Shared Clipboard +# Parallels Shared Clipboard will create a tile window when switching to Host +# So we set window rules to not showing. windowrulev2 = float, title:(Parallels Shared Clipboard) windowrulev2 = size 0 0, title:(Parallels Shared Clipboard) windowrulev2 = opacity 0, title:(Parallels Shared Clipboard) diff --git a/modules/hyprland/scripts/hypr-cwd.sh b/modules/hyprland/scripts/hypr-cwd.sh index fe2d950f..d4a2b999 100755 --- a/modules/hyprland/scripts/hypr-cwd.sh +++ b/modules/hyprland/scripts/hypr-cwd.sh @@ -1,14 +1,19 @@ #!/bin/sh pid=$(hyprctl activewindow -j | jq '.pid') -cmdline=$(cat /proc/${pid}/cmdline | xargs -0 echo) +cmdline="" +if [[ "$pid" != "null" ]]; then + cmdline=$(cat /proc/${pid}/cmdline | xargs -0 echo) +fi -# change to if the cmdline not including zsh -if [[ "$cmdline" != *"zsh"* ]]; then +# change to if the cmdline not including ghostty +if [[ "$cmdline" != *"alacritty"* ]]; then dir=$(readlink /proc/"$pid"/cwd || echo "$HOME") else ppid=$(pgrep --newest --parent "$pid") dir=$(readlink /proc/"$ppid"/cwd || echo "$HOME") fi -[ -d "$dir" ] && echo "$dir" || echo "$HOME" +[ -d "$dir" ] && cd $dir + +zsh diff --git a/modules/hyprland/scripts/hypr-set-font-size-all.sh b/modules/hyprland/scripts/hypr-set-font-size-all.sh index dad5a9ef..c11090f7 100755 --- a/modules/hyprland/scripts/hypr-set-font-size-all.sh +++ b/modules/hyprland/scripts/hypr-set-font-size-all.sh @@ -1,7 +1,7 @@ #!/bin/sh active_workspace_id=$(hyprctl activeworkspace -j | jq -r '.id') -initialClass="com.mitchellh.ghostty" +initialClass="Alacritty" win_ids=$(hyprctl clients -j | jq -r ".[] | select(.workspace.id == $active_workspace_id) | .address") # for win_id in $win_ids; do diff --git a/modules/hyprland/scripts/hypr-toggle-term.sh b/modules/hyprland/scripts/hypr-toggle-term.sh index 3342ceb0..08f6e855 100755 --- a/modules/hyprland/scripts/hypr-toggle-term.sh +++ b/modules/hyprland/scripts/hypr-toggle-term.sh @@ -8,7 +8,9 @@ active_win_id=$(hyprctl activewindow -j | jq -r '.address') if [[ "$active_win_id" == "$nvim_win_id" ]]; then if [[ $win_count -eq 1 ]]; then - hyprctl dispatch -- exec "ghostty -e 'cd $(~/.nix-config/modules/hyprland/scripts/hypr-cwd.sh) && zsh'" + pid=$(hyprctl activewindow -j | jq '.pid') + dir=$(readlink /proc/"$pid"/cwd || echo "$HOME") + hyprctl dispatch -- exec "alacritty --working-directory $dir" else if [[ "$is_zoomed" == "true" ]]; then hyprctl dispatch fullscreen 1 diff --git a/modules/kitty/default.nix b/modules/kitty/default.nix index 9740e6ef..1afac49e 100644 --- a/modules/kitty/default.nix +++ b/modules/kitty/default.nix @@ -4,7 +4,7 @@ lib.mkMerge [ xdg.configFile."kitty".source = ./.; xdg.configFile."kitty".recursive = true; programs.zsh = { - initExtra = '' + initContent = '' . $HOME/.config/kitty/kitty.zsh ''; }; diff --git a/modules/kubernetes/default.nix b/modules/kubernetes/default.nix index df4f90b3..4eb6e442 100644 --- a/modules/kubernetes/default.nix +++ b/modules/kubernetes/default.nix @@ -3,18 +3,18 @@ { home.packages = with pkgs; [ k9s - # kind + kind kubectl kubectx stern kubernetes-helm kustomize pinniped - # skaffold + skaffold # vcluster ]; - imports = [ ../programs/kubeswitch.nix ]; + # imports = [ ../programs/kubeswitch.nix ]; programs.kubeswitch.enable = true; diff --git a/modules/kubernetes/switch-config.yaml b/modules/kubernetes/switch-config.yaml index a24bf317..850824e0 100644 --- a/modules/kubernetes/switch-config.yaml +++ b/modules/kubernetes/switch-config.yaml @@ -13,3 +13,8 @@ kubeconfigStores: showPrefix: false paths: - ~/.kube/mtfuji/ + - kind: filesystem + kubeconfigName: 'abctl.kubeconfig' + showPrefix: false + paths: + - ~/.airbyte/abctl/abctl.kubeconfig diff --git a/modules/litellm/config.yaml b/modules/litellm/config.yaml new file mode 100644 index 00000000..ad7a216f --- /dev/null +++ b/modules/litellm/config.yaml @@ -0,0 +1,11 @@ +model_list: + - model_name: gemini-2.5-pro + litellm_params: + model: vertex_ai/gemini-2.5-pro + vertex_project: wp-dev-wovey-yev1 + vertex_location: us-central1 + - model_name: gemini-2.5-flash + litellm_params: + model: vertex_ai/gemini-2.5-flash + vertex_project: wp-dev-wovey-yev1 + vertex_location: us-central1 diff --git a/modules/misc/default.nix b/modules/misc/default.nix index b7c4b754..ed7accdf 100644 --- a/modules/misc/default.nix +++ b/modules/misc/default.nix @@ -11,6 +11,7 @@ vim binutils bind + yq # Fonts # comic-code @@ -34,8 +35,12 @@ chafa # Python toolchain - rye + # rye # hatch + uv + + # DB + beekeeper-studio ] ); @@ -69,6 +74,8 @@ programs.zoxide.enable = true; programs.fzf.enable = true; + programs.vscode.enable = true; + programs.eza.enable = true; programs.eza.icons = "auto"; programs.eza.git = true; diff --git a/modules/niri/default.nix b/modules/niri/default.nix new file mode 100644 index 00000000..e2ecad10 --- /dev/null +++ b/modules/niri/default.nix @@ -0,0 +1,331 @@ +{ config, ... }: + +{ + programs.dankMaterialShell = { + enable = true; + systemd.enable = true; + enableBrightnessControl = false; + }; + + programs.niri = { + settings = { + # Enable xwayland-satellite integration + xwayland-satellite.enable = true; + + # Input configuration + input = { + keyboard = { + xkb = { + layout = "us"; + }; + repeat-delay = 220; + repeat-rate = 150; + track-layout = "global"; + }; + + mouse = { + accel-speed = 1.0; + accel-profile = "adaptive"; + scroll-factor = { + vertical = 1.0; + horizontal = 1.0; + }; + }; + + # Focus windows and outputs automatically when moving the mouse into them + focus-follows-mouse.max-scroll-amount = "0%"; + }; + + # Output configuration for Virtual-1 + outputs."Virtual-1" = { + scale = 2.0; + }; + + # Layout settings + layout = { + gaps = 8; + center-focused-column = "never"; + + preset-column-widths = [ + { proportion = 0.33333; } + { proportion = 0.5; } + { proportion = 0.66667; } + ]; + + # Default width of new windows + default-column-width = { + proportion = 0.66667; + }; + + # Disable focus ring + focus-ring.enable = false; + + # Border configuration + border = with config.lib.stylix.colors.withHashtag; { + # https://github.com/tinted-theming/schemes/blob/spec-0.11/base16/onedark.yaml + enable = true; + width = 2; + active.gradient = { + from = base08; + to = base0D; + angle = 45; + in' = "oklch longer hue"; + }; + inactive.gradient = { + from = base0D; + to = base0E; + angle = 45; + }; + }; + + struts = { }; + + tab-indicator = { + place-within-column = true; + corner-radius = 12; + gaps-between-tabs = 8; + }; + }; + + prefer-no-csd = true; + + spawn-at-startup = [ + { argv = [ "alacritty" ]; } + { argv = [ "prlcp" ]; } + ]; + + # Hotkey overlay + hotkey-overlay = { + skip-at-startup = true; + }; + + # Screenshot path + screenshot-path = "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"; + + # Animation settings + animations = { + enable = true; + + workspace-switch = { + kind.spring = { + damping-ratio = 1.0; + stiffness = 1000; + epsilon = 0.0001; + }; + }; + + window-open = { + kind.easing = { + duration-ms = 150; + curve = "ease-out-expo"; + }; + }; + + window-close = { + kind.easing = { + duration-ms = 150; + curve = "ease-out-quad"; + }; + }; + + horizontal-view-movement = { + kind.spring = { + damping-ratio = 1.0; + stiffness = 800; + epsilon = 0.0001; + }; + }; + + window-movement = { + kind.spring = { + damping-ratio = 1.0; + stiffness = 800; + epsilon = 0.0001; + }; + }; + + window-resize = { + kind.spring = { + damping-ratio = 1.0; + stiffness = 800; + epsilon = 0.0001; + }; + }; + + config-notification-open-close = { + kind.spring = { + damping-ratio = 0.6; + stiffness = 1000; + epsilon = 0.001; + }; + }; + + exit-confirmation-open-close = { + kind.spring = { + damping-ratio = 0.6; + stiffness = 500; + epsilon = 0.01; + }; + }; + + overview-open-close = { + kind.spring = { + damping-ratio = 1.0; + stiffness = 800; + epsilon = 0.0001; + }; + }; + }; + + # Window rules + window-rules = [ + # Work around WezTerm's initial configure bug + { + matches = [ + { + app-id = "^org\\.wezfurlong\\.wezterm$"; + } + ]; + default-column-width = { }; + } + # Open Firefox picture-in-picture as floating + { + matches = [ + { + app-id = "firefox$"; + title = "^Picture-in-Picture$"; + } + ]; + open-floating = true; + } + # Default window rule for all windows + { + geometry-corner-radius = { + top-left = 12.0; + top-right = 12.0; + bottom-left = 12.0; + bottom-right = 12.0; + }; + clip-to-geometry = true; + } + ]; + + overview = { + zoom = 1.0; + }; + + # Key bindings + binds = + with config.lib.niri.actions; + let + dms-ipc = spawn "dms" "ipc"; + in + { + # Terminal and app launcher + "Alt+W".action.spawn-sh = "niri msg action focus-workspace -- 255 && alacritty"; + "Alt+T".action.spawn-sh = "~/.nix-config/modules/niri/scripts/niri-toggle-term.sh"; + "Mod+G" = { + action = dms-ipc "spotlight" "toggle"; + hotkey-overlay.title = "Toggle Application Launcher"; + }; + "Ctrl+Shift+V" = { + action = dms-ipc "clipboard" "toggle"; + hotkey-overlay.title = "Toggle Clipboard Manager"; + }; + "Ctrl+Shift+Return".action.spawn-sh = "alacritty -e ~/.nix-config/modules/niri/scripts/niri-cwd.sh"; + + # Overview + "Alt+O" = { + action.toggle-overview = { }; + repeat = false; + }; + + # Window management + "Alt+Q" = { + action.close-window = { }; + repeat = false; + }; + + # Focus navigation + "Ctrl+H".action.spawn-sh = "~/.nix-config/modules/niri/scripts/niri-nvim-nav.sh column-left"; + "Ctrl+L".action.spawn-sh = "~/.nix-config/modules/niri/scripts/niri-nvim-nav.sh column-right"; + "Ctrl+J".action.spawn-sh = "~/.nix-config/modules/niri/scripts/niri-nvim-nav.sh window-down"; + "Ctrl+K".action.spawn-sh = "~/.nix-config/modules/niri/scripts/niri-nvim-nav.sh window-up"; + "Ctrl+Shift+K".action.move-window-up-or-to-workspace-up = { }; + "Ctrl+Shift+J".action.move-window-down-or-to-workspace-down = { }; + + "Mod+F".action.focus-workspace-down = { }; + "Mod+B".action.focus-workspace-up = { }; + + "Alt+9".action.focus-column = 9; + "Alt+8".action.focus-column = 8; + "Alt+7".action.focus-column = 7; + "Alt+6".action.focus-column = 6; + "Alt+5".action.focus-column = 5; + "Alt+4".action.focus-column = 4; + "Alt+3".action.focus-column = 3; + "Alt+2".action.focus-column = 2; + "Alt+1".action.focus-column-first = { }; + "Alt+0".action.focus-column-last = { }; + + # Workspace navigation with mouse wheel + "Mod+Alt+Ctrl+Shift+WheelScrollDown" = { + action.focus-workspace-down = { }; + cooldown-ms = 150; + }; + "Mod+Alt+Ctrl+Shift+WheelScrollUp" = { + action.focus-workspace-up = { }; + cooldown-ms = 150; + }; + + # Column navigation with mouse wheel + "Ctrl+Shift+WheelScrollRight" = { + action.focus-column-right = { }; + cooldown-ms = 150; + }; + "Ctrl+Shift+WheelScrollLeft" = { + action.focus-column-left = { }; + cooldown-ms = 150; + }; + + # Window in/out of column + "Alt+B" = { + action.consume-or-expel-window-left = { }; + cooldown-ms = 150; + }; + "Alt+F" = { + action.consume-or-expel-window-right = { }; + cooldown-ms = 150; + }; + "Shift+Right".action.swap-window-right = { }; + "Shift+Left".action.swap-window-left = { }; + "Shift+Up".action.move-window-up = { }; + "Shift+Down".action.move-window-down = { }; + + "Alt+Z".action.maximize-column = { }; + "Alt+D".action.move-window-to-workspace = 255; + + # Width adjustments + "Mod+Minus".action.set-column-width = "-10%"; + "Mod+Equal".action.set-column-width = "+10%"; + + # Height adjustments + "Mod+Shift+Minus".action.set-window-height = "-10%"; + "Mod+Shift+Equal".action.set-window-height = "+10%"; + + # Tabbed display + "Mod+W".action.toggle-column-tabbed-display = { }; + }; + }; + }; + + programs.zsh = { + initContent = '' + if [[ -n $NIRI_SOCKET ]]; then + . $HOME/.nix-config/modules/niri/niri.zsh + fi + ''; + }; + + programs.clipsync.enable = true; +} diff --git a/modules/niri/niri.zsh b/modules/niri/niri.zsh new file mode 100644 index 00000000..b2fdd9ce --- /dev/null +++ b/modules/niri/niri.zsh @@ -0,0 +1,61 @@ +function wait_for_nvim_server() { + local nvim_addr=$1 + local max_attempts=50 # 50 * 20ms = 1 second max + local attempt=0 + + # Much faster: just check if socket file exists and is a socket + while [[ $attempt -lt $max_attempts ]]; do + if [[ -S $nvim_addr ]]; then + return 0 + fi + sleep 0.02 # 20ms intervals + ((attempt++)) + done + + return 1 +} + +function nvim() { + if [[ -z $NIRI_SOCKET ]]; then + command nvim $@ + return 0 + fi + + workspace_id=$(niri msg -j focused-window | jq -r '.workspace_id') + nvim_addr=/tmp/nvim-niri-$workspace_id + neovide_window_id=$(niri msg -j windows | jq -r "first(.[] | select(.workspace_id == $workspace_id) | select(.app_id == \"neovide\")).id") + + [[ ! $neovide_window_id && -e $nvim_addr ]] && rm -rf $nvim_addr + + if [[ $# -eq 0 && ! -e $nvim_addr ]]; then + command nvim --listen $nvim_addr --headless > /dev/null 2>&1 0< /dev/null &! + if wait_for_nvim_server $nvim_addr; then + command neovide --server $nvim_addr + else + echo "Error: nvim server failed to start" >&2 + return 1 + fi + elif [[ $# -eq 0 && -e $nvim_addr ]]; then + niri msg action focus-window --id $neovide_window_id >/dev/null 2>&1 + elif [[ $# -gt 0 && ! -e $nvim_addr ]]; then + command nvim --listen $nvim_addr --headless > /dev/null 2>&1 0< /dev/null &! + if wait_for_nvim_server $nvim_addr; then + command neovide --server $nvim_addr + else + echo "Error: nvim server failed to start" >&2 + return 1 + fi + elif [[ $# -gt 0 && -e $nvim_addr ]]; then + niri msg action focus-window --id $neovide_window_id >/dev/null 2>&1 + command nvim --server $nvim_addr --remote $@ + else + command nvim --listen $nvim_addr --headless > /dev/null 2>&1 0< /dev/null &! + if wait_for_nvim_server $nvim_addr; then + command neovide --server $nvim_addr + else + echo "Error: nvim server failed to start" >&2 + return 1 + fi + fi +} + diff --git a/modules/niri/scripts/niri-cwd.sh b/modules/niri/scripts/niri-cwd.sh new file mode 100755 index 00000000..f265823b --- /dev/null +++ b/modules/niri/scripts/niri-cwd.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +pid=$(niri msg -j focused-window | jq -r '.pid') +cmdline="" +if [[ "$pid" != "null" ]]; then + cmdline=$(cat /proc/${pid}/cmdline | xargs -0 echo) +fi + +# change to if the cmdline not including ghostty +if [[ "$cmdline" != *"alacritty"* ]]; then + dir=$(readlink /proc/"$pid"/cwd || echo "$HOME") +else + ppid=$(pgrep --newest --parent "$pid") + dir=$(readlink /proc/"$ppid"/cwd || echo "$HOME") +fi + +[ -d "$dir" ] && cd $dir + +zsh diff --git a/modules/niri/scripts/niri-nvim-nav.sh b/modules/niri/scripts/niri-nvim-nav.sh new file mode 100755 index 00000000..18e33541 --- /dev/null +++ b/modules/niri/scripts/niri-nvim-nav.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +dir="$1" +NVIM_ADDR="/tmp/nvim-niri-$(niri msg -j focused-window | jq -r ".workspace_id")" + +case "$dir" in + "window-up") ;; + "column-right") ;; + "window-down") ;; + "column-left") ;; + *) + echo "USAGE: $0 window-up|column-right|window-down|column-left" + exit 1 +esac + +if [[ -e "$NVIM_ADDR" ]] && [[ "$(niri msg -j focused-window | jq -r '.app_id')" == "neovide" ]]; then + command nvim --server $NVIM_ADDR --remote-send "NiriNavigate $dir" >/dev/null 2>&1 && exit 0 +fi + +niri msg action focus-$dir diff --git a/modules/niri/scripts/niri-toggle-term.sh b/modules/niri/scripts/niri-toggle-term.sh new file mode 100755 index 00000000..ce76fec3 --- /dev/null +++ b/modules/niri/scripts/niri-toggle-term.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +active_workspace_id=$(niri msg -j focused-window | jq -r '.workspace_id') +win_count=$(niri msg -j windows | jq -r "map(select(.workspace_id == $active_workspace_id)) | length") +is_zoomed=$(niri msg -j windows | jq -r "any(.[] | select(.workspace_id == $active_workspace_id); .layout.window_size[0] > 2000)") +nvim_win_id=$(niri msg -j windows | jq -r "first(.[] | select(.workspace_id == $active_workspace_id) | select(.app_id == \"neovide\")).id") +active_win_id=$(niri msg -j focused-window | jq -r '.id') + +if [[ "$active_win_id" == "$nvim_win_id" ]]; then + if [[ $win_count -eq 1 ]]; then + pid=$(niri msg -j focused-window | jq -r '.pid') + dir=$(readlink /proc/"$pid"/cwd || echo "$HOME") + niri msg action spawn-sh -- "alacritty --working-directory $dir" + else + if [[ "$is_zoomed" == "true" ]]; then + niri msg action maximize-column + niri msg action focus-column-right + else + niri msg action maximize-column + fi + fi +elif [[ $win_count -gt 1 && "$active_win_id" != "$nvim_win_id" ]]; then + niri msg action focus-window --id $nvim_win_id + niri msg action maximize-column +fi diff --git a/modules/nvim/default.nix b/modules/nvim/default.nix index 4789d50a..6ba1c857 100644 --- a/modules/nvim/default.nix +++ b/modules/nvim/default.nix @@ -19,9 +19,10 @@ in tflint # tfsec trash-cli + scooter # yamlfmt yamllint - # helm-ls + helm-ls lua-language-server # prettierd # https://github.com/mantoni/eslint_d.js/issues/287 @@ -35,6 +36,7 @@ in nixd vscode-langservers-extracted yaml-language-server + vtsls # gopls # rust-analyzer terraform-ls @@ -43,8 +45,8 @@ in docker-compose-language-service ] ++ (with nodePackages; [ - typescript-language-server - dockerfile-language-server-nodejs + # typescript-language-server + dockerfile-language-server ]) ); diff --git a/modules/hyprland/waybar/config b/modules/waybar/config similarity index 100% rename from modules/hyprland/waybar/config rename to modules/waybar/config diff --git a/modules/hyprland/waybar/default.nix b/modules/waybar/default.nix similarity index 100% rename from modules/hyprland/waybar/default.nix rename to modules/waybar/default.nix diff --git a/modules/hyprland/waybar/scripts/check_battery.sh b/modules/waybar/scripts/check_battery.sh similarity index 100% rename from modules/hyprland/waybar/scripts/check_battery.sh rename to modules/waybar/scripts/check_battery.sh diff --git a/modules/hyprland/waybar/scripts/wttr.py b/modules/waybar/scripts/wttr.py similarity index 100% rename from modules/hyprland/waybar/scripts/wttr.py rename to modules/waybar/scripts/wttr.py diff --git a/modules/hyprland/waybar/style.css b/modules/waybar/style.css similarity index 100% rename from modules/hyprland/waybar/style.css rename to modules/waybar/style.css diff --git a/modules/hyprland/wofi/default.nix b/modules/wofi/default.nix similarity index 95% rename from modules/hyprland/wofi/default.nix rename to modules/wofi/default.nix index 2d2244a4..a130a7e7 100644 --- a/modules/hyprland/wofi/default.nix +++ b/modules/wofi/default.nix @@ -19,7 +19,7 @@ allow_images=true image_size=28 gtk_dark=true - term=ghostty + term=alacritty ''; "wofi/style.css".text = builtins.readFile ./style.css; diff --git a/modules/hyprland/wofi/style.css b/modules/wofi/style.css similarity index 100% rename from modules/hyprland/wofi/style.css rename to modules/wofi/style.css diff --git a/modules/zsh/default.nix b/modules/zsh/default.nix index 495d15b1..80cf8a09 100644 --- a/modules/zsh/default.nix +++ b/modules/zsh/default.nix @@ -3,14 +3,12 @@ programs.zsh = { enable = true; envExtra = builtins.readFile ./zshenv; - dotDir = ".config/zsh"; + dotDir = "${config.xdg.configHome}/zsh"; enableCompletion = true; defaultKeymap = "emacs"; history.path = "${config.xdg.configHome}/zsh/.zsh_history"; completionInit = ""; - initExtra = '' - export DIRENV_LOG_FORMAT= - + initContent = '' # Set fzf folder for z4h so it won't install another fzf __fzf_dir=${pkgs.fzf} . $HOME/.config/zsh/config/init.zsh @@ -20,9 +18,6 @@ . $HOME/.config/zsh/plugins/zsh-abbr/share/zsh/zsh-abbr/zsh-abbr.plugin.zsh . $HOME/.config/zsh/config/utils.zsh - export PATH=$HOME/.rye/shims:$PATH - source <(${pkgs.rye}/bin/rye self completion) - if [ -f /opt/homebrew/bin/brew ]; then eval "$(/opt/homebrew/bin/brew shellenv)" fi @@ -33,6 +28,8 @@ if command -v uvx &> /dev/null; then eval "$(uvx --generate-shell-completion zsh)" fi + + export PATH=$PATH:$HOME/.local/bin:$HOME/.cache/.bun/bin ''; zsh-abbr.enable = true; zsh-abbr.abbreviations = { diff --git a/modules/zsh/utils.zsh b/modules/zsh/utils.zsh index 21ec0759..551bcccf 100644 --- a/modules/zsh/utils.zsh +++ b/modules/zsh/utils.zsh @@ -2,7 +2,7 @@ function pbcopy() { if [[ $(uname -s) == *"Darwin"* ]]; then command pbcopy $1 else - cat - | xclip -selection clipboard + cat - | wl-copy fi } diff --git a/pkgs/nvchad/lua/configs/lspconfig.lua b/pkgs/nvchad/lua/configs/lspconfig.lua index e070e47f..53abdbfb 100644 --- a/pkgs/nvchad/lua/configs/lspconfig.lua +++ b/pkgs/nvchad/lua/configs/lspconfig.lua @@ -1,7 +1,6 @@ dofile(vim.g.base46_cache .. 'lsp') require 'nvchad.lsp' -local lspconfig = require 'lspconfig' local root_pattern = require 'lspconfig.util'.root_pattern local on_init = require 'nvchad.configs.lspconfig'.on_init @@ -12,42 +11,39 @@ local group = vim.api.nvim_create_augroup('LspFormatting', {}) ---@param client vim.lsp.Client ---@param bufnr integer local on_attach = function(client, bufnr) - if client.supports_method 'textDocument/formatting' then + if client:supports_method 'textDocument/formatting' then vim.api.nvim_clear_autocmds { group = group, buffer = bufnr, } vim.api.nvim_create_autocmd('BufWritePre', { group = group, buffer = bufnr, callback = function() - local prettier = require('null-ls.builtins.formatting.prettier') - local ft = vim.bo[bufnr].filetype - if vim.tbl_contains({ 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' }, ft) then - vim.cmd "EslintFixAll" - end - if vim.tbl_contains(prettier.filetypes, ft) then - vim.lsp.buf.format { async = false, filter = function() return client.name == 'null-ls' end } - else - vim.lsp.buf.format { async = false } - end + require("conform").format({ bufnr = bufnr }) + -- local prettier = require('null-ls.builtins.formatting.prettier') + -- local ft = vim.bo[bufnr].filetype + -- if vim.tbl_contains({ 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' }, ft) then + -- vim.cmd "EslintFixAll" + -- end + -- if vim.tbl_contains(prettier.filetypes, ft) then + -- vim.lsp.buf.format { async = false, filter = function() return client.name == 'null-ls' end } + -- else + -- vim.lsp.buf.format { async = false } + -- end end, }) end end local servers = { - cssls = {}, + -- cssls = {}, dockerls = {}, - eslint = {}, + -- eslint = {}, gopls = {}, golangci_lint_ls = {}, helm_ls = {}, nixd = {}, rust_analyzer = {}, - ruff = { - root_dir = root_pattern '.git', - }, - pyright = { - root_dir = root_pattern '.git', - }, + ruff = {}, + pyright = {}, yamlls = { filetypes = vim.tbl_filter(function(ft) -- Not start with Helm files @@ -55,7 +51,7 @@ local servers = { end, require 'lspconfig.configs.yamlls'.default_config.filetypes), settings = { yaml = { - format = { enable = true, printWidth = 120, singleQuote = true, proseWrap = 'always', }, + format = { enable = true }, keyOrdering = false, hover = true, completion = true, @@ -89,13 +85,18 @@ local servers = { }, }, }, - tflint = { - root_dir = root_pattern('.git', '.terraform', 'main.tf', '.terraform.lock.hcl'), - }, - terraformls = { - root_dir = root_pattern('.git', '.terraform', 'main.tf', '.terraform.lock.hcl'), + tflint = {}, + terraformls = {}, + ty = { + settings = { + ty = { + disableLanguageServices = true, + diagnosticMode = 'workspace', + }, + }, }, - ts_ls = {}, + vtsls = {}, + -- ts_ls = {}, tailwindcss = {}, lua_ls = { settings = { @@ -103,6 +104,18 @@ local servers = { runtime = { version = 'LuaJIT', }, + workspace = { + checkThirdParty = false, + library = { + vim.fn.expand "$VIMRUNTIME/lua", + vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types", + vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy", + vim.fn.stdpath "data" .. "/lazy/noice.nvim/lua/noice/types", + vim.fn.stdpath "data" .. "/lazy/snacks.nvim/lua/snacks", + vim.fn.stdpath "data" .. "/lazy/conform.nvim/lua/conform", + "${3rd}/luv/library", + } + }, telemetry = { enable = false }, }, }, @@ -114,35 +127,39 @@ for name, opts in pairs(servers) do opts.on_attach = on_attach opts.capabilities = capabilities - lspconfig[name].setup(opts) + if next(opts) ~= nil then + vim.lsp.config(name, opts) + end + + vim.lsp.enable(name) end -local null_ls = require 'null-ls' -local h = require 'null-ls.helpers' +-- local null_ls = require 'null-ls' +-- local h = require 'null-ls.helpers' -- Need to set root_dir to `.git` for pyproject because there might be -- multiple pyproject files in a python monorepo. So by default we only -- check the pyproject at root to avoid config duplication. -null_ls.setup { - on_attach = on_attach, - capabilities = capabilities, - root_dir = root_pattern '.git', - sources = { - null_ls.builtins.diagnostics.codespell.with { - cwd = h.cache.by_bufnr(function(params) - return (root_pattern '.git')(params.bufname) - end), - }, - null_ls.builtins.diagnostics.actionlint, - null_ls.builtins.diagnostics.stylelint, - null_ls.builtins.diagnostics.yamllint, - - null_ls.builtins.formatting.prettier, - null_ls.builtins.formatting.nixfmt, - null_ls.builtins.formatting.terraform_fmt, - - require 'none-ls.formatting.ruff', - require 'none-ls.formatting.ruff_format', - }, -} +-- null_ls.setup { +-- on_attach = on_attach, +-- capabilities = capabilities, +-- root_dir = root_pattern '.git', +-- sources = { +-- null_ls.builtins.diagnostics.codespell.with { +-- cwd = h.cache.by_bufnr(function(params) +-- return (root_pattern '.git')(params.bufname) +-- end), +-- }, +-- null_ls.builtins.diagnostics.actionlint, +-- null_ls.builtins.diagnostics.stylelint, +-- null_ls.builtins.diagnostics.yamllint, +-- +-- null_ls.builtins.formatting.prettier, +-- null_ls.builtins.formatting.nixfmt, +-- null_ls.builtins.formatting.terraform_fmt, +-- +-- require 'none-ls.formatting.ruff', +-- require 'none-ls.formatting.ruff_format', +-- }, +-- } diff --git a/pkgs/nvchad/lua/configs/nvim-tree.lua b/pkgs/nvchad/lua/configs/nvim-tree.lua index 5053c3ba..2d3f0af3 100644 --- a/pkgs/nvchad/lua/configs/nvim-tree.lua +++ b/pkgs/nvchad/lua/configs/nvim-tree.lua @@ -36,7 +36,7 @@ return vim.tbl_deep_extend('force', require 'nvchad.configs.nvimtree', { end, view = { width = {}, -- Adaptive size - side = 'right', + side = 'left', }, trash = { cmd = 'trash', diff --git a/pkgs/nvchad/lua/mappings.lua b/pkgs/nvchad/lua/mappings.lua index 0c41fbf3..cef974fd 100644 --- a/pkgs/nvchad/lua/mappings.lua +++ b/pkgs/nvchad/lua/mappings.lua @@ -37,10 +37,12 @@ M.General = { i = { [''] = { '', 'Move one word left', }, [''] = { '', 'Move one word right', }, + [''] = { 'norm! "+p', 'Paste from clipboard', }, }, t = { [''] = { '', 'Move one word left', }, [''] = { '', 'Move one word right', }, + [''] = { vim.api.nvim_replace_termcodes('', true, true, true) .. '"+pi', 'Paste from clipboard', }, [''] = { vim.api.nvim_replace_termcodes('', true, true, true), 'Escape terminal mode', }, }, } diff --git a/pkgs/nvchad/lua/options.lua b/pkgs/nvchad/lua/options.lua index df4206de..a3842608 100644 --- a/pkgs/nvchad/lua/options.lua +++ b/pkgs/nvchad/lua/options.lua @@ -1,6 +1,5 @@ vim.o.breakindent = true vim.o.clipboard = '' -vim.o.foldexpr = 'nvim_treesitter#foldexpr()' vim.o.linebreak = true vim.o.list = true vim.o.scrolloff = 5 @@ -13,7 +12,9 @@ vim.o.signcolumn = 'yes:2' vim.o.swapfile = false vim.o.virtualedit = 'all' vim.o.writebackup = false -vim.wo.foldenable = false +vim.o.foldexpr = 'nvim_treesitter#foldexpr()' +vim.o.foldlevelstart = 99 +vim.wo.foldenable = true vim.wo.foldmethod = 'expr' vim.opt.dictionary:append '/usr/share/dict/words' @@ -44,6 +45,16 @@ vim.api.nvim_create_autocmd('TextYankPost', { command = 'silent! lua vim.highlight.on_yank({ higroup="IncSearch", timeout=700 })', }) +vim.api.nvim_create_autocmd('BufEnter', { + group = 'NeoVimUser', + pattern = '*', + callback = function() + if vim.fn.filereadable(vim.fn.expand('%')) == 1 then + vim.cmd('checktime') + end + end, +}) + local enable_providers = { 'python3_provider', 'node_provider', @@ -101,6 +112,17 @@ vim.api.nvim_create_user_command("HyprNavigate", function(opts) end end, { nargs = '?' }) +vim.api.nvim_create_user_command("NiriNavigate", function(opts) + local direction = opts.args + local mappings = { ['column-left'] = 'h', ['window-down'] = 'j', ['window-up'] = 'k', ['column-right'] = 'l' } + local flag = mappings[direction] + if vim.fn.winnr() == vim.fn.winnr(flag) then + vim.fn.jobstart({ 'niri', 'msg', 'action', 'focus-' .. direction }) + else + vim.cmd('wincmd ' .. flag) + end +end, { nargs = '?' }) + -- Workaround for neovide when attaching to remote server -- https://github.com/neovide/neovide/issues/1868 vim.api.nvim_create_autocmd("UIEnter", { @@ -109,12 +131,6 @@ vim.api.nvim_create_autocmd("UIEnter", { callback = function() if vim.g.neovide then local map = vim.keymap.set - map( - { 'i', 'c', 't' }, - '', - function() vim.api.nvim_paste(vim.fn.getreg('+'), true, -1) end, - { silent = true, desc = "Neovide Paste in GUI" } - ) map({ 'n', 'i', 'x' }, '', 'lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor + 0.1', { silent = true, desc = 'Neovide Increase scale', @@ -131,22 +147,26 @@ vim.api.nvim_create_autocmd("UIEnter", { end }) ---Use FocusGained to make sure Neovide window is created +-- Use FocusGained to make sure Neovide window is created vim.api.nvim_create_autocmd("FocusGained", { group = "neovide", pattern = '*', callback = function() if vim.g.neovide then - local workspace_id = vim.fn.system('hyprctl activeworkspace -j | jq -r ".id"') - local neovide_window_id = vim.fn.system('hyprctl clients -j | jq -r "first(.[] | select(.workspace.id == ' .. - workspace_id .. ') | select(.class == \\"neovide\\")).address"') - local master_window_id = vim.fn.system('hyprctl clients -j | jq -r "[.[] | select (.workspace.id == ' .. - workspace_id .. ')] | min_by(.at[1]) | .address"') - if neovide_window_id ~= master_window_id then - vim.cmd('silent! !hyprctl dispatch swapwindow u') - end + vim.cmd('silent! !niri msg action move-column-to-first') + -- local workspace_id = vim.fn.system('hyprctl activeworkspace -j | jq -r ".id"') + -- local neovide_window_id = vim.fn.system('hyprctl clients -j | jq -r "first(.[] | select(.workspace.id == ' .. + -- workspace_id .. ') | select(.class == \\"neovide\\")).address"') + -- local master_window_id = vim.fn.system('hyprctl clients -j | jq -r "[.[] | select (.workspace.id == ' .. + -- workspace_id .. ')] | min_by(.at[1]) | .address"') + -- if neovide_window_id ~= master_window_id then + -- vim.cmd('silent! !hyprctl dispatch swapwindow u') + -- end end end }) vim.lsp.log.set_level(vim.log.levels.OFF) + +vim.g.neovide_opacity = 0.9 +vim.g.neovide_normal_opacity = 0.9 diff --git a/pkgs/nvchad/lua/plugins/init.lua b/pkgs/nvchad/lua/plugins/init.lua index f35ee92f..59888e5f 100644 --- a/pkgs/nvchad/lua/plugins/init.lua +++ b/pkgs/nvchad/lua/plugins/init.lua @@ -84,92 +84,157 @@ local plugins = { config = true, }, { - "GeorgesAlkhouri/nvim-aider", + 'Juksuu/worktrees.nvim', cmd = { - "AiderTerminalToggle", - "AiderTerminalSend", - "AiderQuickSendCommand", - "AiderQuickSendBuffer", - "AiderTreeAddFile", - "AiderTreeDropFiles", - }, - keys = { - { "a/", "AiderTerminalToggle", desc = "Aider Open" }, - { "as", "AiderTerminalSend", desc = "Aider Send", mode = { "n", "x" } }, - { "ac", "AiderQuickSendCommand", desc = "Aider Send Command" }, - { "ab", "AiderQuickSendBuffer", desc = "Aider Send Buffer" }, - { "=", "AiderTreeAddFile", desc = "Aider Add File in NvimTree", ft = "NvimTree" }, - { "-", "AiderTreeDropFile", desc = "Aider Drop File in NvimTree", ft = "NvimTree" }, + 'GitWorktreeCreate', + 'GitWorktreeSwitch', + 'GitWorktreeCreateExisting', + 'GitWorktreeRemove', }, dependencies = { - { - "folke/snacks.nvim", - ---@type snacks.Config - opts = { - ---@type table - styles = { - terminal = { - bo = { - filetype = "snacks_terminal", - }, - wo = {}, - keys = { - -- Override default keymap - term_normal = false, - }, - } - }, - }, - }, "nvim-telescope/telescope.nvim", }, config = function() - require("nvim_aider").setup({ - -- Command line arguments passed to aider - aider_cmd = "AWS_PROFILE=wovey-dev-admin aider", - args = { - "--no-auto-commits", - "--pretty", - "--stream", - "--watch-files", - }, - win = { - style = "nvim_aider", - position = "left", - }, - }) + require("worktrees").setup() + require("telescope").load_extension("worktrees") end, }, -- { - -- "olimorris/codecompanion.nvim", - -- event = 'VeryLazy', + -- "GeorgesAlkhouri/nvim-aider", + -- cmd = { + -- "Aider", + -- "AiderTreeAddFile", + -- "AiderTreeDropFile", + -- }, + -- keys = { + -- { "a/", "Aider toggle", desc = "Aider Open" }, + -- { "as", "Aider send", desc = "Aider Send", mode = { "n", "x" } }, + -- { "ab", "Aider buffer", desc = "Aider Send Buffer" }, + -- { "=", "AiderTreeAddFile", desc = "Aider Add File in NvimTree", ft = "NvimTree" }, + -- { "-", "AiderTreeDropFile", desc = "Aider Drop File in NvimTree", ft = "NvimTree" }, + -- }, -- dependencies = { - -- "nvim-lua/plenary.nvim", - -- "nvim-treesitter/nvim-treesitter", - -- { "MeanderingProgrammer/render-markdown.nvim", ft = { "markdown", "codecompanion" } }, + -- "nvim-telescope/telescope.nvim", -- }, - -- config = true, - -- }, - -- { - -- 'zbirenbaum/copilot.lua', - -- event = 'VeryLazy', - -- dependencies = { { 'zbirenbaum/copilot-cmp', config = true, }, 'hrsh7th/nvim-cmp', }, -- config = function() - -- require 'copilot'.setup { - -- panel = { - -- enabled = false, - -- }, - -- suggestion = { - -- enabled = false, - -- }, - -- filetypes = { - -- yaml = true, - -- markdown = true, - -- gitcommit = true, + -- require("nvim_aider").setup({ + -- -- Command line arguments passed to aider + -- aider_cmd = "AWS_PROFILE=genai-dev-admin aider", + -- win = { + -- style = "nvim_aider", + -- position = "left", -- }, - -- } + -- }) -- end, -- }, + { + "coder/claudecode.nvim", + dependencies = { + "folke/snacks.nvim", -- Optional dependency for enhanced terminal + }, + opts = { + -- Configuration for claudecode main + terminal_cmd = "claude --resume", + terminal = { + provider = "external", + provider_opts = { + external_terminal_cmd = "alacritty --working-directory %s -e %s", + }, + }, + + -- Configuration for the interactive terminal: + -- terminal = { + -- split_side = "left", + -- split_width_percentage = 0.4, + -- provider = "snacks", + -- show_native_term_exit_tip = true, + -- }, + }, + config = true, + keys = { + { "ac", "ClaudeCode", mode = { "n", "x" }, desc = "Toggle Claude Terminal" }, + { "ak", "ClaudeCodeSend", mode = { "x" }, desc = "Send to Claude Code" }, + }, + }, + { + 'stevearc/conform.nvim', + ---@type conform.setupOpts + opts = { + formatters_by_ft = { + -- Use the "*" filetype to run formatters on all filetypes. + python = { "ruff_format", "ruff_fix", "ruff_organize_imports", lsp_format = "fallback" }, + typescriptreact = { "prettier", lsp_format = "fallback" }, + ["*"] = { "trim_whitespace" }, + }, + format_on_save = { + -- These options will be passed to conform.format() + timeout_ms = 500, + lsp_format = "prefer", + }, + default_format_opts = { + lsp_format = "prefer", + } + }, + }, + { + "olimorris/codecompanion.nvim", + event = "VeryLazy", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + { "MeanderingProgrammer/render-markdown.nvim", ft = { "markdown", "codecompanion" } }, + }, + opts = { + display = { + chat = { + window = { + position = 'left', + width = 0.4, + }, + }, + }, + chat = { + strategies = { + chat = { + adapter = "gemini_cli", + } + }, + adapters = { + acp = { + gemini_cli = function() + return require("codecompanion.adapters").extend("gemini_cli", { + env = { + GOOGLE_CLOUD_PROJECT = "wp-dev-wovey-yev1", + GOOGLE_CLOUD_LOCATION = "us-central1", + GOOGLE_GENAI_USE_VERTEXAI = "true", + }, + }) + end, + }, + }, + }, + }, + }, + { + 'zbirenbaum/copilot.lua', + event = 'VeryLazy', + dependencies = { { 'zbirenbaum/copilot-cmp', config = true, }, 'hrsh7th/nvim-cmp', }, + config = function() + require 'copilot'.setup { + panel = { + enabled = false, + }, + suggestion = { + enabled = false, + }, + filetypes = { + yaml = true, + markdown = true, + gitcommit = true, + }, + } + end, + }, { 'rust-lang/rust.vim', ft = 'rust', diff --git a/programs/clipsync/default.nix b/programs/clipsync/default.nix new file mode 100644 index 00000000..37330333 --- /dev/null +++ b/programs/clipsync/default.nix @@ -0,0 +1,79 @@ +{ + config, + pkgs, + lib, + ... +}: +let + cfg = config.programs.clipsync; + clipsync = pkgs.writeShellScriptBin "clipsync" (builtins.readFile ./scripts/clipsync.sh); + deps = with pkgs; [ + xclip + wl-clipboard + clipnotify + ]; +in +{ + options = { + programs.clipsync = { + enable = lib.mkEnableOption "clipsync"; + enableClipboardManager = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Add Clipboard Manager sync"; + }; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = deps ++ [ clipsync ]; + + systemd.user.services = lib.mkMerge [ + (lib.mkIf cfg.enableClipboardManager { + clipboard-manager = { + Unit = { + Description = "Sync clipboard to Clipboard Manager"; + }; + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + Service = { + ExecStart = "${pkgs.wl-clipboard}/bin/wl-paste --watch ${pkgs.cliphist}/bin/cliphist store"; + }; + }; + }) + { + wl-x11-sync = { + Unit = { + Description = "Sync Wayland clipboard to X11"; + }; + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + Service = { + Environment = [ + "PATH=$PATH:${lib.makeBinPath (deps ++ [ clipsync ])}" + ]; + ExecStart = "${clipsync}/bin/clipsync start wl-clipboard"; + ExecStop = "${clipsync}/bin/clipsync stop"; + }; + }; + x11-wl-sync = { + Unit = { + Description = "Sync X11 clipboard to Wayland"; + }; + Install = { + WantedBy = [ "graphical-session.target" ]; + }; + Service = { + Environment = [ + "PATH=$PATH:${lib.makeBinPath (deps ++ [ clipsync ])}" + ]; + ExecStart = "${clipsync}/bin/clipsync start xclip"; + ExecStop = "${clipsync}/bin/clipsync stop"; + }; + }; + } + ]; + }; +} diff --git a/programs/clipsync/scripts/clipsync.sh b/programs/clipsync/scripts/clipsync.sh new file mode 100755 index 00000000..ba28a2a2 --- /dev/null +++ b/programs/clipsync/scripts/clipsync.sh @@ -0,0 +1,107 @@ +#!/usr/bin/env sh + +insert() { + value=$(cat) + if [ -z "$value" ]; then + exit 0 + fi + + wValue=$(wl-paste -n 2>/dev/null || echo "") + xValue=$(xclip -o -selection clipboard 2>/dev/null || echo "") + + if [ "$value" != "$wValue" ]; then + echo -n "$value" | wl-copy + fi + + if [ "$value" != "$xValue" ]; then + echo -n "$value" | xclip -i -selection clipboard + fi +} + +start() { + case "$2" in + "wl-clipboard") + wl-paste --watch bash -c "clipsync insert" + ;; + "xclip") + xhost +SI:localuser:root + while clipnotify; do + xclip -o -selection clipboard 2>/dev/null | clipsync insert + done + ;; + *) + echo "Usage: $1 {wl-clipboard|xclip}" + exit 1 + ;; + esac +} + +# Watch for clipboard changes and synchronize between Wayland and X11 +# Usage: clipsync watch +watch() { + # Add a small delay to ensure clipboard services are initialized + sleep 1 + + # Wayland -> X11 + wl-paste --watch bash -c "clipsync insert" & + + # X11 -> Wayland + while clipnotify; do + xclip -o -selection clipboard 2>/dev/null | clipsync insert + done & +} + +# Kill all background processes related to clipsync +stop() { + pkill -f "wl-paste --watch" + pkill clipnotify + pkill -f "xclip -selection clipboard" + pkill -f "clipsync insert" +} + +help() { + cat << EOF +clipsync - Two-way clipboard synchronization between Wayland and X11, with clipse support + +Usage: + clipsync watch + Run clipboard synchronization in the background. + + clipsync start + Run clipboard synchronization individually. + + clipsync stop + Stop all background processes related to clipsync. + + echo -n "text" | clipsync insert + Insert clipboard content from stdin. + + clipsync help + Display this help information. + +Requirements: wl-clipboard, xclip, clipnotify +EOF +} + +case "$1" in + watch) + watch + ;; + stop) + stop + ;; + insert) + insert + ;; + start) + start "$@" + ;; + help) + help + ;; + *) + echo "Usage: $0 {watch|insert|stop|help}" + echo "Run '$0 help' for more information." + exit 1 + ;; +esac diff --git a/modules/programs/kubeswitch.nix b/programs/kubeswitch.nix similarity index 97% rename from modules/programs/kubeswitch.nix rename to programs/kubeswitch.nix index 7a879034..5a7bb687 100644 --- a/modules/programs/kubeswitch.nix +++ b/programs/kubeswitch.nix @@ -45,7 +45,7 @@ in source ${shell_files}/share/${cfg.command}_completion.bash ''; - programs.zsh.initExtra = '' + programs.zsh.initContent = '' autoload -U +X compinit && compinit source ${shell_files}/share/${cfg.command}_init.zsh diff --git a/users/sand/home.nix b/users/sand/home.nix index a8a907ec..486beec5 100644 --- a/users/sand/home.nix +++ b/users/sand/home.nix @@ -47,21 +47,21 @@ ); }; }; - timezone-update = { - Unit = { - Description = "Update timezone on startup"; - }; - Service = { - Type = "oneshot"; - ExecStart = toString ( - pkgs.writeShellScript "timezone-update-sh" '' - set -eou pipefail - # Set timezone based on IP, since automatic timezone on gnome is not working - timedatectl set-timezone "$(curl --fail https://ipapi.co/timezone)" - '' - ); - }; - }; + # timezone-update = { + # Unit = { + # Description = "Update timezone on startup"; + # }; + # Service = { + # Type = "oneshot"; + # ExecStart = toString ( + # pkgs.writeShellScript "timezone-update-sh" '' + # set -eou pipefail + # # Set timezone based on IP, since automatic timezone on gnome is not working + # timedatectl set-timezone "$(curl --fail https://ipapi.co/timezone)" + # '' + # ); + # }; + # }; }; systemd.user.timers = { @@ -74,21 +74,23 @@ }; Install.WantedBy = [ "timers.target" ]; }; - timezone-update = { - Unit = { - Description = "Timer for timezone-update service"; - }; - Timer = { - OnBootSec = "1min"; - Unit = "timezone-update.service"; - OnCalendar = "hourly"; - }; - Install.WantedBy = [ "timers.target" ]; - }; + # timezone-update = { + # Unit = { + # Description = "Timer for timezone-update service"; + # }; + # Timer = { + # OnBootSec = "1min"; + # Unit = "timezone-update.service"; + # OnCalendar = "hourly"; + # }; + # Install.WantedBy = [ "timers.target" ]; + # }; }; imports = [ - ../../modules/hyprland + ../../programs/clipsync + ../../modules/aider + # ../../modules/hyprland ../../modules/alacritty ../../modules/cloud ../../modules/direnv @@ -96,7 +98,7 @@ ../../modules/ghostty ../../modules/git ../../modules/gnome - ../../modules/kitty + ../../modules/niri ../../modules/kubernetes ../../modules/misc ../../modules/nvim