Skip to content

Commit caae41c

Browse files
committed
fix(sops): use universal sopsFallbackSecrets hook without hostPlatform.isAndroid condition
1 parent 87d0c77 commit caae41c

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

programs/sops.nix

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,18 @@ in
2424
};
2525
};
2626

27-
home.activation.sopsAndroidSecrets = lib.mkIf pkgs.stdenv.hostPlatform.isAndroid (
28-
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
29-
if [ -f "${cfg.age.keyFile}" ]; then
30-
${lib.concatStringsSep "\n" (lib.mapAttrsToList (name: secret: ''
31-
if [ -n "${secret.path or ""}" ]; then
32-
mkdir -p "$(dirname "${secret.path}")"
33-
$DRY_RUN_CMD ${pkgs.sops}/bin/sops --decrypt \
34-
--age-key-file "${cfg.age.keyFile}" \
35-
--extract '["${lib.replaceStrings ["/"] ["\"][\""] name}"]' \
36-
${secret.sopsFile} > "${secret.path}" 2>/dev/null || true
37-
chmod ${secret.mode or "0600"} "${secret.path}"
38-
fi
39-
'') (lib.filterAttrs (_: s: s.path != null && s.path != "") cfg.secrets))}
40-
fi
41-
''
42-
);
27+
home.activation.sopsFallbackSecrets = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
28+
if [ -f "${cfg.age.keyFile}" ]; then
29+
${lib.concatStringsSep "\n" (lib.mapAttrsToList (name: secret: ''
30+
if [ -n "${secret.path or ""}" ] && [ ! -e "${secret.path}" ]; then
31+
mkdir -p "$(dirname "${secret.path}")"
32+
$DRY_RUN_CMD ${pkgs.sops}/bin/sops --decrypt \
33+
--age-key-file "${cfg.age.keyFile}" \
34+
--extract '["${lib.replaceStrings ["/"] ["\"][\""] name}"]' \
35+
${secret.sopsFile} > "${secret.path}" 2>/dev/null || true
36+
chmod ${secret.mode or "0600"} "${secret.path}"
37+
fi
38+
'') (lib.filterAttrs (_: s: s.path != null && s.path != "") cfg.secrets))}
39+
fi
40+
'';
4341
}

0 commit comments

Comments
 (0)