MCPcopy Index your code
hub / github.com/brizzbuzz/opnix

github.com/brizzbuzz/opnix @v0.10.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.10.1 ↗ · + Follow
237 symbols 745 edges 16 files 79 documented · 33%

Browse by type

Functions 198 Types & classes 39
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

OpNix

Secure 1Password secrets integration for NixOS, nix-darwin, and Home Manager.

Features

  • Declarative Secrets: Define secrets directly in Nix configuration
  • Service Integration: Automatic systemd/launchd service restarts on secret changes
  • Multi-Platform: Full support for NixOS, nix-darwin, and Home Manager
  • Secure: Uses 1Password service accounts with proper file permissions
  • Reliable: systemd services ensure secrets are available without breaking system boot
  • Developer Shells: Export 1Password secrets as environment variables inside flake devshells

Quick Start

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 opnix token set
sudo nixos-rebuild switch --flake .

Documentation

📚 Complete Documentation

Platform Support

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

Getting Help

License

MIT License

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Function 110
Method 88
Struct 31
Interface 7
TypeAlias 1

Languages

Go100%

Modules by API surface

cmd/opnix/main.go38 symbols
internal/errors/errors.go26 symbols
internal/validation/validator.go23 symbols
internal/systemd/integration.go21 symbols
internal/secrets/processor.go20 symbols
internal/validation/validator_test.go15 symbols
internal/systemd/integration_test.go15 symbols
internal/errors/errors_test.go13 symbols
internal/onepass/client.go12 symbols
cmd/opnix/secret.go11 symbols
internal/secrets/processor_test.go10 symbols
internal/config/config.go9 symbols

Datastores touched

myapp_productionDatabase · 1 repos

For agents

$ claude mcp add opnix \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page