-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prefer GPG(GnuPG) rather than SSH key to sign commits (#311)
* Start to manage GPG config * Ignore backup files from git * Fix filename * Add gpg-agent workaround for macos * Fix nix syntax * macOS is Werther's Original * Add an empty commit * Prefer subkey * Add note and update new subkey * Improve note * Keep passphrase cache longtime * Prefer pinentry-tty rather than default gtk2 * Add how to get pubkey in global May relate to kachick/kachick.github.io#93 * Prefer nix syntax sugar * Sync same gpg-agent config with macOS * Add comment for why GPG
- Loading branch information
Showing
9 changed files
with
91 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,5 @@ tmp/ | |
.DS_Store | ||
|
||
winget-pkgs-*-raw.json | ||
|
||
*.bak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ config, pkgs, ... }: | ||
|
||
|
||
# ## FAQ - GPG | ||
# | ||
# - How to list keys? | ||
# - 1. `gpg --list-secret-keys --keyid-format=long` # The `sec` first section displays same text as `pub` by `gpg --list-keys --keyid-format=long` | ||
# - How to add subkey? | ||
# - 1. `gpg --edit-key PUBKEY` | ||
# - 2. `addkey` | ||
# - 3. `save` | ||
# - How to revoke subkey? | ||
# - 1. `gpg --edit-key PUBKEY` | ||
# - 2. `key n` n is the index of subkey | ||
# - 3. `revkey` | ||
# - 4. `save` | ||
# - 5. Replace uploaded pubkey with new one, see https://github.com/kachick/dotfiles/pull/311#issuecomment-1715812324 for detail | ||
# - How to get pubkey to upload? | ||
# - `gpg --armor --export PUBKEY | clip.exe` | ||
# - How to backup private key? | ||
# - `gpg --export-secret-keys --armor > gpg-private.keys.bak` | ||
{ | ||
# https://github.com/nix-community/home-manager/blob/master/modules/services/gpg-agent.nix | ||
services.gpg-agent = { | ||
enable = if pkgs.stdenv.isDarwin then false else true; | ||
|
||
# Update [darwin.nix](darwin.nix) if changed this section | ||
# | ||
# https://superuser.com/questions/624343/keep-gnupg-credentials-cached-for-entire-user-session | ||
defaultCacheTtl = 60480000; # 700 days | ||
maxCacheTtl = 60480000; # 700 days | ||
|
||
pinentryFlavor = "tty"; | ||
}; | ||
|
||
# https://github.com/nix-community/home-manager/blob/master/modules/programs/gpg.nix | ||
|
||
programs.gpg = { | ||
enable = true; | ||
|
||
# Preferring XDG_DATA_HOME rather than XDG_CONFIG_HOME from following examples | ||
# - https://wiki.archlinux.org/title/XDG_Base_Directory | ||
# - https://github.com/nix-community/home-manager/blob/5171f5ef654425e09d9c2100f856d887da595437/modules/programs/gpg.nix#L192 | ||
homedir = "${config.xdg.dataHome}/gnupg"; | ||
|
||
# - How to read `--list-keys` - https://unix.stackexchange.com/questions/613839/help-understanding-gpg-list-keys-output | ||
# - Ed448 in GitHub is not yet supported - https://github.com/orgs/community/discussions/45937 | ||
settings = { | ||
# https://unix.stackexchange.com/questions/339077/set-default-key-in-gpg-for-signing | ||
default-key = "9BE4016A38165CCB"; | ||
|
||
personal-digest-preferences = "SHA512"; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
./bash.nix | ||
./zsh.nix | ||
./fish.nix | ||
./gpg.nix | ||
./ssh.nix | ||
./git.nix | ||
./zellij.nix | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters