I am running NixOS within a VirtualBox VM.
If I create a user using home-manager in my configuration.nix file, how do I specify the OpenSSH authorizedKeys for that user?
before home-manager:
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.eve = {
isNormalUser = true;
description = "Guess whom";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
neovim
];
# Add ssh authorized key
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAA [...] id_ed25519"
];
};
using home-manager??
I can’t find any guidance on how to set-up openssh for a user created using home-manager.
The OpenSSH daemon is already running from global setup and an ssh login for a conventional user is active.
Where should I be looking up how to set these options in home manager?
P.S. I had to explicitly set home.stateVersion - which isn’t in the examples in the manual. Examples in the manual need automated testing. It’s hard on new users having the canonical examples break.
Alas, there is no authorizedKeys option, presumably because home-manager isn’t really targeted at machines which would have that file. I’d consider it an oversight.
You can easily make your own with home.file though:
Yeah, you can still use NixOS options like you were to begin with, but I thought the premise of this thread was that you wanted to set it with home-manager?