This commit is contained in:
2026-05-30 23:37:40 +09:00
parent 394638638d
commit 3ff532f9e5
61 changed files with 708 additions and 36 deletions
+6
View File
@@ -0,0 +1,6 @@
{
imports = [
./fingerprint.nix
./ssh-default-key.nix
];
}
+13
View File
@@ -0,0 +1,13 @@
{ lib, config, ... }:
let
cfg = config.my.features.identity.fingerprint;
in
{
options.my.features.identity.fingerprint = {
enable = lib.mkEnableOption "Fingerprint authentication";
};
config = lib.mkIf cfg.enable {
my.system.fingerprint.enable = true;
};
}
@@ -0,0 +1,31 @@
{
pkgs,
lib,
config,
...
}:
let
cfg = config.my.features.identity.sshDefaultKey;
in
{
options.my.features.identity.sshDefaultKey = {
enable = lib.mkEnableOption "Generate default SSH key (ed25519)";
};
config.home-manager.sharedModules = [
{
config = lib.mkIf cfg.enable {
home.activation.generateSshKey = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
key="$HOME/.ssh/id_ed25519"
if [ ! -f "$key" ]; then
umask 077
mkdir -p "$HOME/.ssh"
${pkgs.openssh}/bin/ssh-keygen -t ed25519 -N "" -f "$key" \
-C "moons@$(${pkgs.hostname}/bin/hostname || echo host)"
echo "Generated SSH key at $key"
fi
'';
};
}
];
}