From ebb5e20364290da7969c5bfaab3200de0fc16f7b Mon Sep 17 00:00:00 2001 From: Kat Huang Date: Wed, 23 Aug 2023 04:25:37 +0000 Subject: [PATCH] [NixOS] Fix environment variables in gpg import --- nixos/secrets.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nixos/secrets.nix b/nixos/secrets.nix index 31238340..75885772 100644 --- a/nixos/secrets.nix +++ b/nixos/secrets.nix @@ -23,8 +23,9 @@ RestartSec = 5; Restart = "onfailure"; ExecStart = - let path = config.age.secrets.gpg-keys.path; - passphrasePath = config.age.secrets.gpg-passphrase.path; + let replace = builtins.replaceStrings [ "$XDG_RUNTIME_DIR" ] [ "\${XDG_RUNTIME_DIR}" ]; + path = replace config.age.secrets.gpg-keys.path; + passphrasePath = replace config.age.secrets.gpg-passphrase.path; in "${pkgs.gnupg}/bin/gpg --pinentry-mode loopback --passphrase-file ${passphrasePath} --import ${path}"; }; };