Skip to content

feat(sops): bring up sops-nix, read fj fallback forge host from encrypted secret#86

Merged
emaiax merged 1 commit into
mainfrom
feat/sops-fj-host
Jul 11, 2026
Merged

feat(sops): bring up sops-nix, read fj fallback forge host from encrypted secret#86
emaiax merged 1 commit into
mainfrom
feat/sops-fj-host

Conversation

@emaiax

@emaiax emaiax commented Jul 11, 2026

Copy link
Copy Markdown
Owner

What

Brings SOPS-encrypted secrets to the dotfiles via sops-nix's home-manager module, and uses it for the first secret: the fj (forgejo-cli) fallback forge host.

Why

fj resolves its target instance from the cwd's git remote and, failing that, from the FJ_FALLBACK_HOST env var (resolution order, confirmed by the maintainer in forgejo-cli#444). Without the fallback, every command outside a repo with a forge remote needs -H <host>.

The forge host URL is private, so it can't be a plaintext literal in nix code (anything in home.sessionVariables lands world-readable in the nix store). It now lives only inside a SOPS-encrypted file.

How

  • flake.nix: sops-nix input (nixpkgs follows); ... added to the outputs destructure
  • .sops.yaml: personal age recipient (public key only)
  • secrets/secrets.enc.yaml: encrypted payload holding fj-fallback-host
  • modules/user/sops/: generic bring-up — imports the sops-nix HM module, points age.keyFile at the local age key; secrets decrypt once per login via launchd agent to a user-owned 0400 file
  • modules/user/git/: declares the secret next to pkgs.forgejo-cli and exports FJ_FALLBACK_HOST in zsh init by reading the decrypted file at runtime

Verified

  • darwin-rebuild build passes
  • After switch: launchd agent org.nix-community.home.sops-nix exits 0, secret decrypted with mode 0400
  • Fresh interactive zsh outside any git repo: fj whoami succeeds with no -H

Note: the export runs in .zshrc, so non-interactive shells don't get the var — acceptable for interactive CLI use; move to .zshenv later if scripts ever need it.

…pted secret

fj resolves its instance from the cwd git remote and, failing that, from
FJ_FALLBACK_HOST. The forge host URL is private, so instead of a
plaintext nix-store literal it now lives in a SOPS-encrypted secret:

- flake input sops-nix (nixpkgs follows)
- .sops.yaml with the personal age recipient (public key only)
- secrets/secrets.enc.yaml holding fj-fallback-host
- modules/user/sops: home-manager sops-nix bring-up (age keyFile,
  default sops file); secrets decrypt via launchd agent at login
- modules/user/git: declares the secret and exports FJ_FALLBACK_HOST
  in zsh init by reading the decrypted file at runtime
@emaiax
emaiax merged commit 299d5b2 into main Jul 11, 2026
3 checks passed
@emaiax
emaiax deleted the feat/sops-fj-host branch July 11, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant