web-01: refactor of network and ssh

This commit is contained in:
sinavir 2023-05-17 01:10:18 +02:00
parent fd95fe2c3c
commit 618f4900e0
3 changed files with 15 additions and 6 deletions

View file

@ -2,28 +2,26 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, lib, ... }: { name, config, pkgs, lib, ... }:
{ {
imports = imports =
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./networking.nix
./ssh.nix
]; ];
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "web-01";# Define your hostname. networking.hostName = name;
time.timeZone = "Europe/Paris"; time.timeZone = "Europe/Paris";
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.ens3.useDHCP = lib.mkDefault true;
users.users.root.openssh.authorizedKeys.keyFiles = [ ../../admin_keys/anon.keys ../../admin_keys/mdebray.keys ]; users.users.root.openssh.authorizedKeys.keyFiles = [ ../../admin_keys/anon.keys ../../admin_keys/mdebray.keys ];
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions

View file

@ -0,0 +1,4 @@
{ lib, ... }: {
# TODO: Switch to networkd
networking.useDHCP = lib.mkDefault true;
}

7
machines/web-01/ssh.nix Normal file
View file

@ -0,0 +1,7 @@
{ ... }:
{
services.openssh = {
passwordAuthentication = false;
enable = true;
};
}