# Inject SOPS-managed secrets into NixOS and Home Manager configs with sops-nix

> Materialize age or PGP encrypted SOPS secrets inside declarative NixOS and Home Manager systems during activation without hand-copying values.

- Skill: `agentskillexchange/inject-sops-managed-secrets-into-nixos-and-home-manager-conf` (Agent Skill)
- Install (CLI): `npx skillmds@latest add agentskillexchange/inject-sops-managed-secrets-into-nixos-and-home-manager-conf`
- Raw SKILL.md: https://api.skillmd.com/api/skills/agentskillexchange/inject-sops-managed-secrets-into-nixos-and-home-manager-conf/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: agentskillexchange (https://skillmd.com/u/agentskillexchange)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/agentskillexchange/inject-sops-managed-secrets-into-nixos-and-home-manager-conf

---


# Inject SOPS-managed secrets into NixOS and Home Manager configs with sops-nix

Materialize age or PGP encrypted SOPS secrets inside declarative NixOS and Home Manager systems during activation without hand-copying values.

## Prerequisites

NixOS or Home Manager configuration, sops-nix module, SOPS-encrypted secret files, age or PGP keys, Nix build and activation access

## Installation

Requirements and caveats from upstream:
- This will otherwise cause sops to require multiple keys (shamir secret sharing)
- The easiest way to add new machines is by using SSH host keys (this requires OpenSSH to be enabled).
- The home-manager module requires systemd/user as it runs a service called sops-nix.service rather than an activation script.

Basic usage or getting-started notes:
- There is a configuration.nix example in the [deployment step](#deploy-example) of our usage example.
- If you prefer video over the textual description below, you can also checkout this [6min tutorial](https://www.youtube.com/watch?v=G5f6GC7SnhU) by [@vimjoyer](https://github.com/vimjoyer).
- <details>

- Source: https://github.com/Mic92/sops-nix
- Extracted from upstream docs: https://raw.githubusercontent.com/Mic92/sops-nix/HEAD/README.md

## Documentation

- https://github.com/Mic92/sops-nix#readme

## Source

- [Agent Skill Exchange](https://agentskillexchange.com/skills/inject-sops-managed-secrets-into-nixos-and-home-manager-configs-with-sops-nix/)

