Compare commits

..

7 Commits

5 changed files with 24 additions and 26 deletions
+9 -9
View File
@@ -2,7 +2,7 @@
## Overview ## Overview
Nix flake managing 3 devices: Mac Mini, MacBook Air (both aarch64-darwin via nix-darwin), and a Windows PC via NixOS-WSL (x86_64-linux). Single user `imbytecat` everywhere. Nix flake managing 3 devices: Mac Mini, MacBook Air (both aarch64-darwin via nix-darwin), and a Windows PC via NixOS-WSL (x86_64-linux). Single user `imbytecat` everywhere. Uses **Lix** (not stock Nix).
## Architecture ## Architecture
@@ -13,14 +13,13 @@ flake.nix
└── nixosConfigurations.wsl (x86_64-linux) └── nixosConfigurations.wsl (x86_64-linux)
``` ```
- `lib/default.nix` — builders: `mkDarwin`, `mkNixos`. All hosts get shared modules + home-manager + catppuccin + lazyvim-nix + sops-nix. - `lib/default.nix` — builders: `mkDarwin`, `mkNixos`. All hosts get shared modules + home-manager + lazyvim-nix (as HM sharedModule). NixOS also gets `catppuccin.nixosModules.catppuccin`; home-manager imports `catppuccin.homeModules.catppuccin` directly in `home/default.nix`.
- `modules/shared/` — both platforms: nixpkgs config, overlays, nix settings, Lix - `modules/shared/` — both platforms: nixpkgs config, overlays, nix settings, Lix
- `modules/darwin/` — macOS: system preferences, homebrew (casks/brews/masApps), fonts, fish shell, user - `modules/darwin/` — macOS: system preferences, homebrew (casks/brews/masApps), fonts, fish shell, user
- `modules/nixos/` — NixOS: base packages, docker, locale, user - `modules/nixos/` — NixOS: base packages, docker, locale, user
- `home/` — home-manager (shared across all hosts via `useGlobalPkgs`) - `home/` — home-manager (shared across all hosts via `useGlobalPkgs`)
- `hosts/*/` — per-host overrides (mac-mini: 24/7 server with sleep disabled; macbook-air: portable) - `hosts/*/` — per-host overrides (mac-mini: 24/7 server with sleep disabled; macbook-air: portable)
- `overlays/` + `pkgs/` — custom packages (comment-checker) - `overlays/` + `pkgs/` — custom packages (comment-checker)
- `secrets/` — sops-encrypted secrets (age key derived from `~/.ssh/id_ed25519`)
Config flows: `hosts/*` (host-specific) -> `modules/*` (platform) -> `home/*` (user-level, cross-platform) Config flows: `hosts/*` (host-specific) -> `modules/*` (platform) -> `home/*` (user-level, cross-platform)
@@ -63,13 +62,14 @@ sudo nix run nix-darwin -- switch --flake .#mac-mini
- **First-time bootstrap requires sudo**: `sudo nix run nix-darwin -- switch --flake .#mac-mini` (not `darwin-rebuild` which doesn't exist yet). - **First-time bootstrap requires sudo**: `sudo nix run nix-darwin -- switch --flake .#mac-mini` (not `darwin-rebuild` which doesn't exist yet).
- **mise for version management**: Activated in `home/shell/fish.nix` via `mise activate fish | source`. Config in `home/dev/languages.nix` trusts all config paths. - **mise for version management**: Activated in `home/shell/fish.nix` via `mise activate fish | source`. Config in `home/dev/languages.nix` trusts all config paths.
## Secrets (sops-nix) ## Secrets (1Password CLI)
- Encrypted with age, key derived from `~/.ssh/id_ed25519` (see `.sops.yaml`) - **Not sops-nix** — secrets are injected at shell startup via `op inject` (1Password CLI).
- Secrets file: `secrets/secrets.yaml` — edit with `just secrets` (runs `sops`) - Template: `home/shell/fish.nix` generates `~/.config/op-env/env.tpl` with `op://` references (safe to commit — contains no real secrets).
- Decrypted at runtime via `home/secrets.nix`, exposed as env vars in fish: `AI_GATEWAY_BASE_URL`, `AI_GATEWAY_API_KEY`, `EXA_API_KEY`, `CONTEXT7_API_KEY` - Fish function `op-env` runs on interactive shell init, calling `op inject --in-file` to set env vars: `AI_GATEWAY_BASE_URL`, `AI_GATEWAY_API_KEY`, `EXA_API_KEY`, `CONTEXT7_API_KEY`.
- sops-nix integrated via `home-manager` sharedModules in `lib/default.nix` - macOS: `programs._1password.enable = true` in `modules/darwin/default.nix`.
- Never commit `*.dec.yaml`, `*.dec.json`, `*.plaintext` (in `.gitignore`) - WSL: aliases `op` to `op.exe` (Windows interop) in `home/shell/fish.nix`.
- Never commit `*.dec.yaml`, `*.dec.json`, `*.plaintext` (in `.gitignore`).
## Shell ## Shell
-2
View File
@@ -1,6 +1,5 @@
{ {
inputs, inputs,
lib,
username, username,
pkgs, pkgs,
... ...
@@ -29,7 +28,6 @@
duf # df duf # df
procs # ps procs # ps
sd # sed sd # sed
xh # curl/httpie
jq # JSON jq # JSON
yq # YAML yq # YAML
wget wget
+10 -12
View File
@@ -18,25 +18,21 @@ in
enable = true; enable = true;
shellAbbrs = { shellAbbrs = {
# Navigation # Navigation (one-shot, no need to recall in history)
".." = "cd .."; ".." = "cd ..";
"..." = "cd ../.."; "..." = "cd ../..";
};
# File listing (eza) shellAliases = {
ls = "eza --icons --group-directories-first"; # File listing (eza) — base aliases (ls/la/lt) from programs.eza
ll = "eza -la --icons --git --group-directories-first"; ll = "eza -lh";
la = "eza -a --icons --group-directories-first"; lla = "eza -lah --time-style=long-iso";
lt = "eza --tree --level=2 --icons";
# Tools # Tools
cat = "bat --paging=never"; cat = "bat --paging=never";
rm = "gomi"; rm = "gomi";
lg = "lazygit"; lg = "lazygit";
vi = "nvim"; vi = "nvim";
# Network
http = "xh";
}; };
interactiveShellInit = '' interactiveShellInit = ''
@@ -64,12 +60,14 @@ in
source ~/.config/fish/local.fish source ~/.config/fish/local.fish
end end
# 1Password env vars (single op call, silent if locked) # 1Password env vars (single op call, silent on failure)
function op-env --description "Load secrets from 1Password" function op-env --description "Load secrets from 1Password"
if not type -q op; or not test -f ${envTpl} if not type -q op; or not test -f ${envTpl}
return 1 return 1
end end
for line in (op inject < ${envTpl} 2>/dev/null) set -l output (op inject --in-file ${envTpl} 2>/dev/null)
or return 1
for line in $output
string match -qr '^\s*(#|$)' -- $line; and continue string match -qr '^\s*(#|$)' -- $line; and continue
set -l kv (string split -m 1 '=' $line) set -l kv (string split -m 1 '=' $line)
if test (count $kv) -ge 2 if test (count $kv) -ge 2
+2 -3
View File
@@ -62,11 +62,10 @@
# ── Eza (ls replacement) ──────────────────────────── # ── Eza (ls replacement) ────────────────────────────
programs.eza = { programs.eza = {
enable = true; enable = true;
enableFishIntegration = false; # we use custom abbrs in fish.nix enableFishIntegration = true;
git = true; git = true;
icons = "auto"; icons = "auto";
extraOptions = [ extraOptions = [
"--color=always"
"--group-directories-first" "--group-directories-first"
]; ];
}; };
@@ -89,7 +88,7 @@
# ── Zellij (terminal multiplexer) ──────────────────── # ── Zellij (terminal multiplexer) ────────────────────
programs.zellij = { programs.zellij = {
enable = true; enable = true;
enableFishIntegration = true; enableFishIntegration = false;
settings = { settings = {
show_startup_tips = false; show_startup_tips = false;
}; };
+3
View File
@@ -35,6 +35,8 @@
LaunchServices.LSQuarantine = false; LaunchServices.LSQuarantine = false;
dock = { dock = {
autohide = true; autohide = true;
autohide-delay = 0.0;
autohide-time-modifier = 0.15;
show-recents = false; show-recents = false;
mru-spaces = false; mru-spaces = false;
wvous-tl-corner = 1; wvous-tl-corner = 1;
@@ -86,6 +88,7 @@
"raycast" "raycast"
"spotify" "spotify"
"telegram-desktop" "telegram-desktop"
"tencent-meeting"
"termius" "termius"
"visual-studio-code" "visual-studio-code"
"wechat" "wechat"