ssh + services

This commit is contained in:
ari committed 2024-01-11 14:28:41 -05:00
1 parent 026cf2e0c1
commit 9dd196e5c9
4 files changed
+47 -20

No files matched your search

+5
View File
@@ -2,6 +2,7 @@
systemStateVersion ? "23.11",
hostName,
user,
enableSSHServer ? false,
}:
{ ... }:
let
@@ -17,6 +18,10 @@ in
(import ./modules/os/core.nix {
hostName = hostName;
})
(import ./modules/os/ssh.nix {
user = user;
enableSSHServer = enableSSHServer;
})
(import "${home-manager}/nixos")
./modules/os/services.nix
./modules/docker/core.nix
+24 -15
View File
@@ -5,10 +5,11 @@
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos"; # Define your hostname.
networking.hostName = hostName; # Define your hostname.
# Enable networking
networking.networkmanager.enable = true;
networking.firewall.enable = false;
# Set your time zone.
time.timeZone = "America/Toronto";
@@ -16,19 +17,27 @@
# Select internationalisation properties.
i18n.defaultLocale = "en_CA.UTF-8";
# Fonts
# fonts = {
# packages = with pkgs; [
# (nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; })
# ];
# System Packages
environment.systemPackages = with pkgs; [
git
vscode
nil
docker-compose
];
# fontconfig = {
# enable = true;
# defaultFonts = {
# serif = [ "FiraCode" "DroidSansMono" ];
# sansSerif = [ "FiraCode" "DroidSansMono" ];
# monospace = [ "FiraCode" ];
# };
# };
# };
# Fonts
fonts = {
packages = with pkgs; [
(nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; })
];
fontconfig = {
enable = true;
defaultFonts = {
serif = [ "FiraCode" "DroidSansMono" ];
sansSerif = [ "FiraCode" "DroidSansMono" ];
monospace = [ "FiraCode" ];
};
};
};
}
-5
View File
@@ -2,10 +2,5 @@
{ pkgs, ... }:
{
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
git
vscode
nil
];
system.stateVersion = systemStateVersion;
}
+18
View File
@@ -0,0 +1,18 @@
{ enableSSHServer, user }:
{ ... }:
{
services.openssh = if enableSSHServer then {
enable = true;
settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false;
settings.PermitRootLogin = "yes";
} else {
enable = false;
};
users.users.${user.name}.openssh.authorizedKeys.keys = if enableSSHServer then [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCuatskL9qXvgvS3E8zRwosFnpcN0f8PkKl8syAvpn297V2iPk6mi8yK3EE7xPpxaKKlwUuBHDj3BNUCoLgdRFKUgroRDzr3BMm+gZTHy6CuEZBY9zBRTmH+aOV6FZ96QPW4zba0BW5YPkPNy/FhYibjpXyZ3nX4/LWSbPKQJ7wTnUJZgq4VFmevBOttvhzUJUgTziMFsGXn6I38fAi6LI8qwI+zOOdsNjtKgr/TIlO/7VqcH7GYnQEwlthl577sDd1V6+XWz649qoiBYyq0Ahm09dwYx2iGQwLo8IYFbSy4aJRK/PI0+ytnPBoF5QCl+ILb5E8uV3e6Wb9WpXl9Hv2iLx91/9iq5hykHPnfVtkq3MK0C2vqkvX1qFOIkKM7vmxvXGbaDZDGK3G+/zkQ7GUw8ydbl9wGwE9cKbm9miqs4w2Ry/+3IZasE6G2TI97bSzSYInQd2RwoglqBOaJojbUqgI9wvNdKxGhADNFbZah2+s6SSe1ByQRN3b9wtmqu0= ari@shared"
] else [];
users.users.root.openssh.authorizedKeys.keys = if enableSSHServer then [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCuatskL9qXvgvS3E8zRwosFnpcN0f8PkKl8syAvpn297V2iPk6mi8yK3EE7xPpxaKKlwUuBHDj3BNUCoLgdRFKUgroRDzr3BMm+gZTHy6CuEZBY9zBRTmH+aOV6FZ96QPW4zba0BW5YPkPNy/FhYibjpXyZ3nX4/LWSbPKQJ7wTnUJZgq4VFmevBOttvhzUJUgTziMFsGXn6I38fAi6LI8qwI+zOOdsNjtKgr/TIlO/7VqcH7GYnQEwlthl577sDd1V6+XWz649qoiBYyq0Ahm09dwYx2iGQwLo8IYFbSy4aJRK/PI0+ytnPBoF5QCl+ILb5E8uV3e6Wb9WpXl9Hv2iLx91/9iq5hykHPnfVtkq3MK0C2vqkvX1qFOIkKM7vmxvXGbaDZDGK3G+/zkQ7GUw8ydbl9wGwE9cKbm9miqs4w2Ry/+3IZasE6G2TI97bSzSYInQd2RwoglqBOaJojbUqgI9wvNdKxGhADNFbZah2+s6SSe1ByQRN3b9wtmqu0= ari@shared"
] else [];
}