diff --git a/modules/common.nix b/modules/common.nix new file mode 100644 index 0000000..a860eb3 --- /dev/null +++ b/modules/common.nix @@ -0,0 +1,11 @@ +{ + ... +}: { + defaultSSHKeys = [ + "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" + "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEd2N6QSpuAXOXmSN5p2MPKyWe+oT5ayMBoRN3rCz/FS6ZI8PG2tntEte8+hkW7X0vA2dtB3aj2jWbqUJoQ8wKs=" + ]; +} diff --git a/modules/darwin/user/default.nix b/modules/darwin/user/default.nix index 2dcf664..74c0596 100644 --- a/modules/darwin/user/default.nix +++ b/modules/darwin/user/default.nix @@ -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 = { diff --git a/modules/nixos/user/default.nix b/modules/nixos/user/default.nix index f0c531e..807cca4 100644 --- a/modules/nixos/user/default.nix +++ b/modules/nixos/user/default.nix @@ -8,6 +8,7 @@ with lib; with lib.metacfg; let + common = import ../../common.nix {}; cfg = config.metacfg.user; defaultIconFileName = "profile.jpg"; defaultIcon = pkgs.stdenvNoCC.mkDerivation { @@ -49,13 +50,7 @@ in icon = mkOpt (nullOr package) defaultIcon "The profile picture to use for the user."; prompt-init = mkBoolOpt true "Whether or not to show an initial message when opening a new shell."; extraGroups = mkOpt (listOf str) [ ] "Groups for the user to be assigned."; - sshKeys = mkOpt (listOf 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" - "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEd2N6QSpuAXOXmSN5p2MPKyWe+oT5ayMBoRN3rCz/FS6ZI8PG2tntEte8+hkW7X0vA2dtB3aj2jWbqUJoQ8wKs=" - ] "ssh keys"; + sshKeys = mkOpt (listOf str) common.defaultSSHKeys "ssh keys"; extraOptions = mkOpt attrs { } (mdDoc "Extra options passed to `users.users.`."); };