refactor: centralize default SSH keys in common module

Moved default SSH keys to a shared `common.nix` module for better reusability and maintainability. Updated references in both NixOS and Darwin user modules to use the centralized keys. This reduces redundancy and improves consistency across modules.
This commit is contained in:
Harald Hoyer 2025-01-16 08:38:27 +01:00
parent d86db77250
commit 37277447d3
3 changed files with 18 additions and 17 deletions

View file

@ -4,29 +4,24 @@
pkgs,
...
}:
with lib;
with lib.metacfg;
let
inherit (lib) types mkIf mkDefault;
inherit (lib.metacfg) mkOpt;
common = import ../../common.nix {};
cfg = config.metacfg.user;
is-linux = pkgs.stdenv.isLinux;
is-darwin = pkgs.stdenv.isDarwin;
in
{
options.metacfg.user = {
options.metacfg.user = with types; {
name = mkOpt types.str "harald" "The user account.";
fullName = mkOpt types.str "Harald Hoyer" "The full name of the user.";
email = mkOpt types.str "harald@hoyer.xyz" "The email of the user.";
uid = mkOpt (types.nullOr types.int) 501 "The uid for the user account.";
sshKeys = mkOpt (types.listOf types.str) [
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIDsb/Tr69YN5MQLweWPuJaRGm+h2kOyxfD6sqKEDTIwoAAAABHNzaDo= harald@fedora.fritz.box"
"sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBACLgT81iB1iWWVuXq6PdQ5GAAGhaZhSKnveQCvcNnAOZ5WKH80bZShKHyAYzrzbp8IGwLWJcZQ7TqRK+qZdfagAAAAEc3NoOg== harald@hoyer.xyz"
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAYbUTKpy4QR3s944/hjJ1UK05asFEs/SmWeUbtS0cdA660sT4xHnRfals73FicOoz+uIucJCwn/SCM804j+wtM="
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMNsmP15vH8BVKo7bdvIiiEjiQboPGcRPqJK0+bH4jKD harald@lenovo.fritz.box"
] "ssh keys";
sshKeys = mkOpt (listOf str) common.defaultSSHKeys "ssh keys";
};
config = {