Agenix inspired tool enabling users to inject secrets from 1password into their Nix servers at build time
Go
189
52 commits
updated Aug 18, 2026
Secure 1Password secrets integration for NixOS, nix-darwin, and Home Manager.
Add OpNix to your flake:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
opnix.url = "github:brizzbuzz/opnix";
};
outputs = { nixpkgs, opnix, ... }: {
# NixOS
nixosConfigurations.yourhostname = nixpkgs.lib.nixosSystem {
modules = [
opnix.nixosModules.default
./configuration.nix
];
};
# nix-darwin
darwinConfigurations.yourhostname = nix-darwin.lib.darwinSystem {
modules = [
opnix.darwinModules.default
./configuration.nix
];
};
# Home Manager
homeConfigurations.yourusername = home-manager.lib.homeManagerConfiguration {
modules = [
opnix.homeManagerModules.default
./home.nix
];
};
};
}
Configure secrets:
# NixOS/nix-darwin
services.onepassword-secrets = {
enable = true;
tokenFile = "/etc/opnix-token";
secrets = {
databasePassword = {
reference = "op://Homelab/Database/password";
owner = "postgres";
services = ["postgresql"];
};
};
};
# Home Manager
programs.onepassword-secrets = {
enable = true;
secrets = {
sshPrivateKey = {
reference = "op://Personal/SSH/private-key";
path = ".ssh/id_rsa";
mode = "0600";
};
};
};
Set up your token:
sudo nixos-rebuild switch --flake .
sudo opnix token set
sudo systemctl restart opnix-secrets.service
Note: On NixOS,
opnixis automatically added toenvironment.systemPackagesonceservices.onepassword-secrets.enable = trueand you rebuild — no separate CLI install or overlay needed. If you previously addedopnixmanually on NixOS, that entry is now redundant and can be removed. (On nix-darwin and Home Manager, CLI installation is unchanged.)
| Platform | Module | Use Case |
|---|---|---|
| NixOS | nixosModules.default | System-wide secret management |
| nix-darwin | darwinModules.default | macOS system secrets |
| Home Manager | homeManagerModules.default | User-specific secrets |
2,273 followers · starred Apr 2026
153 followers · starred Aug 2025
594 followers · starred Jun 2025
426 followers · starred Nov 2025
Agenix inspired tool enabling users to inject secrets from 1password into their Nix servers at build time
Go
189
52 commits
updated Aug 18, 2026
Secure 1Password secrets integration for NixOS, nix-darwin, and Home Manager.
Add OpNix to your flake:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
opnix.url = "github:brizzbuzz/opnix";
};
outputs = { nixpkgs, opnix, ... }: {
# NixOS
nixosConfigurations.yourhostname = nixpkgs.lib.nixosSystem {
modules = [
opnix.nixosModules.default
./configuration.nix
];
};
# nix-darwin
darwinConfigurations.yourhostname = nix-darwin.lib.darwinSystem {
modules = [
opnix.darwinModules.default
./configuration.nix
];
};
# Home Manager
homeConfigurations.yourusername = home-manager.lib.homeManagerConfiguration {
modules = [
opnix.homeManagerModules.default
./home.nix
];
};
};
}
Configure secrets:
# NixOS/nix-darwin
services.onepassword-secrets = {
enable = true;
tokenFile = "/etc/opnix-token";
secrets = {
databasePassword = {
reference = "op://Homelab/Database/password";
owner = "postgres";
services = ["postgresql"];
};
};
};
# Home Manager
programs.onepassword-secrets = {
enable = true;
secrets = {
sshPrivateKey = {
reference = "op://Personal/SSH/private-key";
path = ".ssh/id_rsa";
mode = "0600";
};
};
};
Set up your token:
sudo nixos-rebuild switch --flake .
sudo opnix token set
sudo systemctl restart opnix-secrets.service
Note: On NixOS,
opnixis automatically added toenvironment.systemPackagesonceservices.onepassword-secrets.enable = trueand you rebuild — no separate CLI install or overlay needed. If you previously addedopnixmanually on NixOS, that entry is now redundant and can be removed. (On nix-darwin and Home Manager, CLI installation is unchanged.)
| Platform | Module | Use Case |
|---|---|---|
| NixOS | nixosModules.default | System-wide secret management |
| nix-darwin | darwinModules.default | macOS system secrets |
| Home Manager | homeManagerModules.default | User-specific secrets |
2,273 followers · starred Apr 2026
153 followers · starred Aug 2025
594 followers · starred Jun 2025
426 followers · starred Nov 2025