Add basic theme config
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -18,42 +18,38 @@ in
|
||||
};
|
||||
|
||||
systemd.user = {
|
||||
services.gpg-agent-import = let
|
||||
init = pkgs.writeShellScriptBin "import-gpg-keys" ''
|
||||
export GNUPGHOME=${gpgPath}
|
||||
services.gpg-agent-import =
|
||||
let
|
||||
name = "import-gpg-keys";
|
||||
init = pkgs.writeShellApplication {
|
||||
inherit name;
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils-full
|
||||
gnugrep
|
||||
gnupg
|
||||
];
|
||||
runtimeEnv = {
|
||||
GNUPGHOME = gpgPath;
|
||||
HOME = user.home;
|
||||
};
|
||||
text = builtins.readFile ./import-gpg-keys.sh;
|
||||
};
|
||||
in
|
||||
{
|
||||
Unit = {
|
||||
Description = "Auto-import GPG keys";
|
||||
Requires = [ "sops-nix.service" "gpg-agent.socket" ];
|
||||
After = [ "sops-nix.service" "gpg-agent.socket" ];
|
||||
};
|
||||
|
||||
for keyfile in "${user.home}"/.config/sops-nix/secrets/gpg-agent/*.key; do
|
||||
passfile="''${keyfile%.key}.pass"
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${init}/bin/${name}";
|
||||
};
|
||||
|
||||
if [ -f "$passfile" ]; then
|
||||
${pkgs.gnupg}/bin/gpg2 --batch --yes --pinentry-mode loopback --passphrase-file "$passfile" --import "$keyfile"
|
||||
else
|
||||
${pkgs.gnupg}/bin/gpg2 --batch --yes --import "$keyfile"
|
||||
fi
|
||||
|
||||
${pkgs.gnupg}/bin/gpg2 --with-colons --import-options show-only --import "$keyfile" | grep '^fpr' | cut -d: -f10 | while read -r KEY_ID; do
|
||||
echo "$KEY_ID:6:" >> "${gpgPath}"/otrust.txt
|
||||
done
|
||||
done
|
||||
|
||||
${pkgs.gnupg}/bin/gpg2 --import-ownertrust "${gpgPath}"/otrust.txt
|
||||
rm "${gpgPath}"/otrust.txt
|
||||
'';
|
||||
in {
|
||||
Unit = {
|
||||
Description = "Auto-import GPG keys";
|
||||
Requires = [ "sops-nix.service" "gpg-agent.socket" ];
|
||||
After = [ "sops-nix.service" "gpg-agent.socket" ];
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${init}/bin/import-gpg-keys";
|
||||
};
|
||||
|
||||
Install = { WantedBy = [ "default.target" ]; };
|
||||
};
|
||||
|
||||
tmpfiles.rules = [ "d ${hmConfig.xdg.dataHome}/gnupg 0700 ${user.name} users -" ];
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user