<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title>there was a fish in the calculator</title><id>https://fishinthecalculator.me/feeds/tags/sops.xml</id><subtitle>Tag: sops</subtitle><updated>2026-05-05T22:13:01Z</updated><link href="https://fishinthecalculator.me/feeds/tags/sops.xml" rel="self" /><link href="https://fishinthecalculator.me" /><entry><title>Secrets management with SOPS Guix</title><id>https://fishinthecalculator.me/blog/secrets-management-with-sops-guix.html</id><author><name>Giacomo Leidi</name><email>therewasa@fishinthecalculator.me</email></author><updated>2024-01-02T16:20:00Z</updated><link href="https://fishinthecalculator.me/blog/secrets-management-with-sops-guix.html" rel="alternate" /><content type="html">&lt;p&gt;Dealing with secrets in functional operating systems can range from pretty usable to complete hell. Nix has &lt;a href=&quot;https://nixos.wiki/wiki/Comparison_of_secret_managing_schemes&quot;&gt;several answers to this problem&lt;/a&gt;, the more integrated of which appears to be &lt;a href=&quot;https://github.com/Mic92/sops-nix&quot;&gt;&lt;code&gt;sops-nix&lt;/code&gt;&lt;/a&gt;. After spending some months envying our neighbors grass, I figured it was time for Guix to have its own (attempt at an) answer to the secrets problem.&lt;/p&gt;&lt;p&gt;This is how the &lt;a href=&quot;https://github.com/fishinthecalculator/sops-guix&quot;&gt;SOPS Guix&lt;/a&gt; channel was born, the first take I'm aware of at implementing secure deploying of secrets with Guix and &lt;a href=&quot;https://getsops.io&quot;&gt;SOPS&lt;/a&gt; and as the name shows is quite inspired from Nix's &lt;code&gt;sops-nix&lt;/code&gt;.&lt;/p&gt;&lt;h2 id=&quot;secure_secret_provisioning_with_guix&quot;&gt;Secure secret provisioning with Guix&lt;/h2&gt;&lt;p&gt;This channels exposes the &lt;code&gt;sops-secrets-service-type&lt;/code&gt; Guix service and the &lt;code&gt;sops-secret&lt;/code&gt; record to safely handle secrets with Guix. It works by putting encrypted secrets in the store and by adding a one-shot Shepherd service that decrypts them at startup in a ramfs/tmpfs filesystem. This means that clear text secrets never hit the disk and that you can (and actually are encouraged to) check in your SOPS secrets in the same version control system you use to track you Guix configurations.&lt;/p&gt;&lt;p&gt;Assuming that the right private keys are also provided, &lt;code&gt;sops-secret&lt;/code&gt;s can be included in Guix images, deployed with &lt;code&gt;guix deploy&lt;/code&gt; and included in Guix System/Home containers. Before starting, &lt;a href=&quot;https://github.com/fishinthecalculator/sops-guix/#configure&quot;&gt;make sure you add it to your &lt;code&gt;.config/guix/channels.scm&lt;/code&gt;&lt;/a&gt;, run &lt;code&gt;guix pull&lt;/code&gt; and make sure &lt;code&gt;sops-guix&lt;/code&gt; appears in your &lt;code&gt;guix describe&lt;/code&gt; output.&lt;/p&gt;&lt;h3 id=&quot;creating_secrets_with_sops&quot;&gt;Creating secrets with SOPS&lt;/h3&gt;&lt;p&gt;First of all you need to create encrypted secrets with SOPS. To do so I'm assuming you already have a GPG key for yourself and the machines you want to deploy secrets to. You should be able to list the private keys you have in your keyring with&lt;/p&gt;&lt;pre&gt;&lt;code&gt;user1@home:~ $ gpg --list-secret-keys
/home/user1/.gnupg/pubring.kbx
------------------------
sec   ed25519 2023-12-01 [SC] [expires: 2907-11-30]
      8D1060B96BB8B7249AED41CC193B701E2SODIJNS
uid           [ultimate] user1@example.org
ssb   cv25519 2023-12-01 [E]

pub   rsa3072 1970-01-01 [SCE]
      8C3E4F6EB38828939029AE7BE9B6AF0CD39DD935
uid           [ unknown] root (Imported from SSH) &amp;lt;root@localhost&amp;gt;

pub   rsa3072 1970-01-01 [SCE]
      ZZ3E4VREB38800039029AE7BE9B6AF0CD39AALH9
uid           [ unknown] root (Imported from SSH) &amp;lt;root@localhost&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you don't have a suitable set of GPG keys it's pretty simple to find online how generate them. Once you have a suitable set of keys for yourself and your machines you are ready to create the only configuration you need for SOPS: a &lt;code&gt;.sops.yaml&lt;/code&gt; file that you will place in your project's root directory, or anyway in the same directory where you keep your system configuration. In this file you define which keys will be able to access your secrets files, it may very well be something like:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;keys:
    - &amp;amp;user_user1 8D1060B96BB8B7249AED41CC193B701E2SODIJNS
    - &amp;amp;host_host1 8C3E4F6EB38828939029AE7BE9B6AF0CD39DD935
    - &amp;amp;host_host2 ZZ3E4VREB38800039029AE7BE9B6AF0CD39AALH9

creation_rules:
    - path_regex: .*common\.yaml$
      key_groups:
          - pgp:
                - *user_user1
                - *host_host1
                - *host_host2
    - path_regex: .*host1\.yaml$
      key_groups:
          - pgp:
                - *user_user1
                - *host_host1&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this file we define three keys called &lt;code&gt;user_user1&lt;/code&gt;, &lt;code&gt;host_host1&lt;/code&gt; and &lt;code&gt;host_host2&lt;/code&gt; . The prefixes &lt;code&gt;host_&lt;/code&gt; and &lt;code&gt;user_&lt;/code&gt; are just a convention to indicate that some GPG keys belong to users and some belong to machines.&lt;/p&gt;&lt;p&gt;We now have defined two secrets file names patterns and we declared permissions for each key, it should be possible now to run the following in your projects root directory:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;sops common.yaml&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will open your default editor with an example content to define your secrets value. You can edit it or delete it and your own content for example:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;wireguard:
    private: MYPRIVATEKEY&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;after saving and closing the file you can see by &lt;code&gt;cat&lt;/code&gt;ting the secret file that &lt;code&gt;sops&lt;/code&gt; encrypted it before saving it, so you are free to check it in your VCS.&lt;/p&gt;&lt;h3 id=&quot;making_sure_the_right_host_keys_are_in_the_configured_gnupg_keyring&quot;&gt;Making sure the right host keys are in the configured GnuPG keyring&lt;/h3&gt;&lt;p&gt;For hosts to be able to decrypt secrets you need to provide in the &lt;code&gt;root&lt;/code&gt; user keyring (or anyway the keyring located at the configured &lt;code&gt;gnupg-homedir&lt;/code&gt;) the keys you defined in your &lt;code&gt;.sops.yaml&lt;/code&gt;. So based on the above example you'd need to provide &lt;code&gt;8C3E4F6EB38828939029AE7BE9B6AF0CD39DD935&lt;/code&gt;'s private key on &lt;code&gt;host1&lt;/code&gt; and &lt;code&gt;ZZ3E4VREB38800039029AE7BE9B6AF0CD39AALH9&lt;/code&gt;'s private key on &lt;code&gt;host2&lt;/code&gt; .&lt;/p&gt;&lt;p&gt;To check that your key is correctly imported into the keyring run:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;user1@host1:~ $ sudo gpg --list-secret-keys
/root/.gnupg/pubring.kbx
------------------------
pub   rsa3072 1970-01-01 [SCE]
      8C3E4F6EB38828939029AE7BE9B6AF0CD39DD935
uid           [ unknown] root (Imported from SSH) &amp;lt;root@localhost&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;By setting &lt;code&gt;generate-key?&lt;/code&gt; to &lt;code&gt;#t&lt;/code&gt; in &lt;code&gt;sops-service-configuration&lt;/code&gt; a GPG key will be automatically derived for you from your system's &lt;code&gt;/etc/ssh/ssh_host_rsa_key&lt;/code&gt; and added to the configured keyring. It is &lt;em&gt;discouraged&lt;/em&gt; to do so and you are more than encouraged to autonomally provide a key in your configured keyring.&lt;/p&gt;&lt;h3&gt;Adding secrets to your &lt;code&gt;operating-system&lt;/code&gt; record&lt;/h3&gt;&lt;p&gt;Now, supposing you have your &lt;code&gt;operating-system&lt;/code&gt; file in the same directory where you have your &lt;code&gt;.sops.yaml&lt;/code&gt; and &lt;code&gt;common.yaml&lt;/code&gt; files, you can simply add the following to your configuration:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;use-modules&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;sops&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;secrets&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;sops&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;services&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;sops&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;guix&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;utils&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;project-root&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;current-source-directory&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;sops.yaml&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;local-file&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string-append&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;project-root&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;/.sops.yaml&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;syntax-comment&quot;&gt;;; This is because paths on the store
&lt;/span&gt;              &lt;span class=&quot;syntax-comment&quot;&gt;;; can not start with dots.
&lt;/span&gt;              &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;sops.yaml&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;common.yaml&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;local-file&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string-append&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;project-root&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;/common.yaml&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;operating-system&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;services&lt;/span&gt;
    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;list&lt;/span&gt;
       &lt;span class=&quot;syntax-open&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;]&lt;/span&gt;
       &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;sops-secrets-service-type&lt;/span&gt;
                &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;sops-service-configuration&lt;/span&gt;
                  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;gnupg-homedir&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;/mnt/.gnupg&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;generate-key?&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#t&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;config&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;sops.yaml&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;secrets&lt;/span&gt;
                    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;list&lt;/span&gt;
                      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;sops-secret&lt;/span&gt;
                        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;wireguard&amp;quot;&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;private&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;common.yaml&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;user&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;user1&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;group&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;users&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;permissions&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#o400&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Upon reconfiguration, this will yield the following content at &lt;code&gt;/run/secrets&lt;/code&gt;:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;user1@host1:~ $ sudo ls -la /run/secrets/
total 12
drwxr-xr-x 1 root root    50 Jan  2 12:44 .
drwxr-xr-x 1 root root   254 Jan  2 12:44 ..
lrwxrwxrwx 1 root root    53 Jan  2 12:44 .sops.yaml -&amp;gt; /gnu/store/lyhyh91jw2n2asa1w0fc0zmv93yxkxip-sops.yaml
-r-------- 1 user1 users  44 Jan  2 12:44 wireguard
user1@host1:~ $ cat /run/secrets/wireguard/private
MYPRIVATEKEY&lt;/code&gt;&lt;/pre&gt;&lt;h3&gt;Adding secrets to your &lt;code&gt;home-environment&lt;/code&gt; record&lt;/h3&gt;&lt;p&gt;&lt;code&gt;sops-guix&lt;/code&gt; also provides a Guix Home service that is able to provide most feature of the system service. Most significant limitations are:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;AFAIK &lt;code&gt;home-environment&lt;/code&gt;s can't configure ramfs mount points hence the &lt;code&gt;secrets-directory&lt;/code&gt; option is not available. Secrets are stored in &lt;code&gt;/run/user/$UID/secrets&lt;/code&gt; which usually is mounted on tmpfs.&lt;/li&gt;&lt;li&gt;&lt;code&gt;sops-secret-user&lt;/code&gt; and &lt;code&gt;sops-secrets-group&lt;/code&gt; are ignored. All secrets belong to the user running the Guix comman line but you can still set permissions.&lt;/li&gt;&lt;li&gt;There's no option to automatically generate GPG keys since probably users can easily generate one.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Now, supposing you have your &lt;code&gt;home-environment&lt;/code&gt; file in the same directory where you have your &lt;code&gt;.sops.yaml&lt;/code&gt; and your secrets files, you can simply add the following to your configuration:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;use-modules&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;sops&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;secrets&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;sops&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;home&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;services&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;sops&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
             &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;guix&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;utils&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;project-root&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;current-source-directory&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;sops.yaml&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;local-file&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string-append&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;project-root&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;/.sops.yaml&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
              &lt;span class=&quot;syntax-comment&quot;&gt;;; This is because paths on the store
&lt;/span&gt;              &lt;span class=&quot;syntax-comment&quot;&gt;;; can not start with dots.
&lt;/span&gt;              &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;sops.yaml&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-special&quot;&gt;define&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;user1.yaml&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;local-file&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string-append&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;project-root&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;/user1.yaml&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;home-environment&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;services&lt;/span&gt;
    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;list&lt;/span&gt;
       &lt;span class=&quot;syntax-open&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;]&lt;/span&gt;
       &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;home-sops-secrets-service-type&lt;/span&gt;
                &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;home-sops-service-configuration&lt;/span&gt;
                  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;gnupg-homedir&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;string-append&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;getenv&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;HOME&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;/.gnupg&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;config&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;sops.yaml&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;secrets&lt;/span&gt;
                    &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;list&lt;/span&gt;
                      &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;sops-secret&lt;/span&gt;
                        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;key&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;wireguard&amp;quot;&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;private&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;user1.yaml&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                        &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;permissions&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;#o400&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Upon reconfiguration, this will yield the following content at &lt;code&gt;/run/secrets/$YOUR_UID/secrets&lt;/code&gt;:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;user1@host1:~ $ ls -la /run/user/$(id -u)/secrets
total 12
drwxr-xr-x 1 user1 users    50 Jan  2 12:44 .
drwxr-xr-x 1 user1 users   254 Jan  2 12:44 ..
lrwxrwxrwx 1 user1 users    53 Jan  2 12:44 .sops.yaml -&amp;gt; /gnu/store/lyhyh91jw2n2asa1w0fc0zmv93yxkxip-sops.yaml
-r-------- 1 user1 users    44 Jan  2 12:44 wireguard
user1@host1:~ $ cat /run/user/$(id -u)/secrets/wireguard/private
MYPRIVATEKEY&lt;/code&gt;&lt;/pre&gt;</content></entry></feed>