{"id":16334503,"url":"https://github.com/dustinlyons/nix-secrets-example","last_synced_at":"2025-10-25T23:30:52.175Z","repository":{"id":207273399,"uuid":"718850791","full_name":"dustinlyons/nix-secrets-example","owner":"dustinlyons","description":"Example of using a nix-secrets repo","archived":false,"fork":false,"pushed_at":"2023-11-25T20:32:41.000Z","size":15,"stargazers_count":16,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-31T11:49:42.308Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dustinlyons.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-11-14T23:16:40.000Z","updated_at":"2025-01-19T16:12:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"3aa03129-44b0-4046-981a-0ec9b05a4cdf","html_url":"https://github.com/dustinlyons/nix-secrets-example","commit_stats":null,"previous_names":["dustinlyons/nix-secrets-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinlyons%2Fnix-secrets-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinlyons%2Fnix-secrets-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinlyons%2Fnix-secrets-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinlyons%2Fnix-secrets-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dustinlyons","download_url":"https://codeload.github.com/dustinlyons/nix-secrets-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238223629,"owners_count":19436717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T23:38:34.581Z","updated_at":"2025-10-25T23:30:51.844Z","avatar_url":"https://github.com/dustinlyons.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# secrets-nix-example\nThis is an example of my `nix-secrets` repository, used in [`nixos-config`](https://github.com/dustinlyons/nixos-config/). It uses [`agenix`](https://github.com/ryantm/agenix) to manage encrypting and decrypting your sensitive data.\n\nTo get started, you need a set of SSH keys that will persist between installations. \n\nYou'll want to keep them secure and available in the event you're forced to reinstall the OS.\n\n# How I manage keys\nI first created an EdDSA public/private key pair to use for `agenix`, and then I `age` encrypted them to a set of three Yubikeys I use in my daily life. In this way, they're backed up and the key to read them is stored away in something secure I'm already using.\n\nIf I wanted, I could also probably [store the encrypted keys as paper](https://www.jabberwocky.com/software/paperkey/). But I prefer the Yubikey approach.\n\nHere are the steps I took to create secrets from Yubikeys.\n\n## Yubikeys\n### Encrypt keys to multiple Yubikeys\nI used this to encrypt my \"bootstrap\" keys to a set of Yubikeys. From my `nixos-config` working directory:\n\nBring in `age` and `yubikey` related tools. This is currently defined [here](https://github.com/dustinlyons/nixos-config/blob/main/flake.nix#L44).\n```sh\nnix develop\n```\n\nExport `yubikey` identities.\n```sh\nage-plugin-yubikey --identity \u003e identities\n```\n\nThis cryptic shit makes the identities suitable for use in the next step. ChatGPT wrote it.\n```sh\nidentities=$(cat identities | grep Recipient | sed -e \"s/ //g\" | cut -d':' -f2 | sed -e 's/^age\\(.*\\)/ -r age\\1/g'  | tr -d '\\n')\n```\n\nEncrypt the key to an `age` file.\n```sh\nage $identities -o id_ed25519_agenix.age id_ed25519_agenix\n```\n\n### Decrypt using Yubikey\nI used this to read keys for the initial bootstrap. I delete the decrypted keys after use.\n```sh\nage-plugin-yubikey --identity \u003e identity 2\u003e/dev/null\n```\n```sh\ncat id_ed25519_agenix.age | age -d -i identity\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdustinlyons%2Fnix-secrets-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdustinlyons%2Fnix-secrets-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdustinlyons%2Fnix-secrets-example/lists"}