Here’s my config
{
config,
pkgs,
...
}: let
hostname = "nixos";
user = "user";
password = "password";
timeZone = "Mexico/Mexico_City";
defaultLocale = "en_US.UTF-8";
in {
imports = [<nixpkgs/nixos/modules/virtualisation/lxc-container.nix>];
boot.initrd = {
# Needed for NFS
supportedFilesystems = [ "nfs" ];
kernelModules = [ "nfs" ];
};
# Networking
networking.hostName = hostname;
networking.hosts = {
"10.0.0.10" = [ "nas" ];
};
networking.firewall.allowedTCPPorts = [ 22 ];
# File systems
# fileSystems."/mnt/data" = {
# device = "10.0.0.10:/volume1/data";
# fsType = "nfs";
#options = [ "nfsvers=4.2" ];
#};
systemd.services.nfs-client = {
enable = true;
};
# Packages
environment.systemPackages = with pkgs; [
firefox
vim
nfs-utils
openssh
];
services.openssh = {
enable = true;
ports = [22];
settings = {
PasswordAuthentication = true;
AllowUsers = null;
UseDns = true;
X11Forwarding = false;
PermitRootLogin = "prohibit-password";
};
};
time.timeZone = timeZone;
i18n = {
defaultLocale = defaultLocale;
extraLocaleSettings = {
LC_ADDRESS = defaultLocale;
LC_IDENTIFICATION = defaultLocale;
LC_MEASUREMENT = defaultLocale;
LC_MONETARY = defaultLocale;
LC_NAME = defaultLocale;
LC_NUMERIC = defaultLocale;
LC_PAPER = defaultLocale;
LC_TELEPHONE = defaultLocale;
LC_TIME = defaultLocale;
};
};
users = {
mutableUsers = false;
users."${user}" = {
isNormalUser = true;
password = password;
extraGroups = ["wheel"];
};
};
# Enable passwordless sudo.
security.sudo.extraRules = [
{
users = [user];
commands = [
{
command = "ALL";
options = ["NOPASSWD"];
}
];
}
];
# Supress systemd units that don't work because of LXC.
# https://blog.xirion.net/posts/nixos-proxmox-lxc/#configurationnix-tweak
systemd.suppressedSystemUnits = [
"dev-mqueue.mount"
"sys-kernel-debug.mount"
"sys-fs-fuse-connections.mount"
];
nix.settings.experimental-features = ["nix-command" "flakes"];
system.stateVersion = "23.11";
}
systemctl status sshd returns Unit sshd.service could not be found.
sudo journalctl -xe | grep ssh returns
░░ Subject: A start job for unit sshd.socket has finished successfully
.
░░ A start job for unit sshd.socket has finished successfully.
I’m able to ping my nas from the console.
No idea why this is happening, it should be simple.