diff --git a/configurations/home-manager/leyla/default.nix b/configurations/home-manager/leyla/default.nix index 48d38db..8b41e3a 100644 --- a/configurations/home-manager/leyla/default.nix +++ b/configurations/home-manager/leyla/default.nix @@ -105,6 +105,10 @@ }; }; bash.enable = true; + + openssh.authorizedKeys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJHeItmt8TRW43uNcOC+eIurYC7Eunc0V3LGocQqLaYj leyla@horizon" + ]; }; dconf = { diff --git a/modules/home-manager-modules/default.nix b/modules/home-manager-modules/default.nix index 9fb37f2..ef9bf0a 100644 --- a/modules/home-manager-modules/default.nix +++ b/modules/home-manager-modules/default.nix @@ -3,5 +3,6 @@ imports = [ ./flipperzero.nix ./i18n.nix + ./openssh.nix ]; } diff --git a/modules/home-manager-modules/openssh.nix b/modules/home-manager-modules/openssh.nix new file mode 100644 index 0000000..ef4f11f --- /dev/null +++ b/modules/home-manager-modules/openssh.nix @@ -0,0 +1,8 @@ +{lib, ...}: { + options.programs = { + openssh.authorizedKeys = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = []; + }; + }; +} diff --git a/modules/nixos-modules/home-manager/default.nix b/modules/nixos-modules/home-manager/default.nix index 3848e1b..cab004b 100644 --- a/modules/nixos-modules/home-manager/default.nix +++ b/modules/nixos-modules/home-manager/default.nix @@ -3,5 +3,6 @@ imports = [ ./flipperzero.nix ./i18n.nix + ./openssh.nix ]; } diff --git a/modules/nixos-modules/home-manager/openssh.nix b/modules/nixos-modules/home-manager/openssh.nix new file mode 100644 index 0000000..31a785f --- /dev/null +++ b/modules/nixos-modules/home-manager/openssh.nix @@ -0,0 +1,11 @@ +{ + config, + lib, + ... +}: { + users.users = + lib.attrsets.mapAttrs (name: value: { + openssh.authorizedKeys.keys = value.programs.openssh.authorizedKeys; + }) + config.home-manager.users; +} diff --git a/modules/nixos-modules/ssh.nix b/modules/nixos-modules/ssh.nix index bda4e81..0360cfc 100644 --- a/modules/nixos-modules/ssh.nix +++ b/modules/nixos-modules/ssh.nix @@ -1,12 +1,4 @@ -{ - lib, - config, - ... -}: { - users.users.leyla.openssh.authorizedKeys.keys = lib.mkIf config.host.users.leyla.isTerminalUser [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJHeItmt8TRW43uNcOC+eIurYC7Eunc0V3LGocQqLaYj leyla@horizon" - ]; - +{...}: { services = { openssh = { enable = true;