Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules/nixos/common: add initrd ssh #1383

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

modules/nixos/common: add initrd ssh #1383

wants to merge 1 commit into from

Conversation

zowoq
Copy link
Contributor

@zowoq zowoq commented Jul 25, 2024

No description provided.


boot.initrd.network.ssh = {
enable = true;
authorizedKeyFiles = pkgs.lib.filesystem.listFilesRecursive "${toString inputs.self}/users/keys";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we use systemd in the initrd, I believe we need to also configure networkd here:

    boot.initrd.systemd.network.networks."10-uplink" = config.systemd.network.networks."10-uplink";

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot that we'll need to set host keys for initrd as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge emergency access for now and I'll do ssh later. #1401

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we need to also configure networkd here

Looks like this is configured by default?

@zowoq zowoq changed the title modules/nixos/common: emergencyAccess, ssh modules/nixos/common: initrd ssh Aug 2, 2024
@zowoq zowoq changed the title modules/nixos/common: initrd ssh modules/nixos/common: add initrd ssh Aug 2, 2024
};

system.activationScripts.initrd-ssh-host-key = ''
[[ -f ${initrd_host_key} ]] || ${config.programs.ssh.package}/bin/ssh-keygen -q -t ed25519 -N "" -f ${initrd_host_key}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will fail on the first deployment, but than work on the second one. So probably fine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will fail on the first deployment

Could you explain please?

Copy link
Member

@Mic92 Mic92 Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

activation phase is run after the boot loader is installed in nixos-rebuild. So on the first deployment this will fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants