Skip to content

Instantly share code, notes, and snippets.

@nomaster
Last active April 7, 2024 09:14
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save nomaster/cf9fcf3cf917a1071a70cccefba08a15 to your computer and use it in GitHub Desktop.
Save nomaster/cf9fcf3cf917a1071a70cccefba08a15 to your computer and use it in GitHub Desktop.
NixOS Configuration for experimental K3S cluster node
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Hostname of the node
networking.hostName = "nuc6";
# Networking
systemd.network.enable = true;
systemd.network.networks."10-lan" = {
matchConfig.Name = "eno1";
networkConfig.DHCP = "ipv4";
};
# Nice font for the framebuffer console
console = {
earlySetup = true;
font = "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz";
packages = with pkgs; [ terminus_font ];
keyMap = "us";
};
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.alice = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
packages = with pkgs; [
dmidecode
tmux
asciiquarium
k9s
];
};
# Additional packages
environment.systemPackages = with pkgs; [
fluxcd
k3s
kubectl
kubernetes-helm
vim
];
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Firewall openings
networking.firewall.allowedTCPPorts = [
22 # SSH
2342 # random port
6443 # Kubernetes
];
# NixOS state version
system.stateVersion = "23.05";
# K3S Kubernetes
services.k3s.enable = true;
services.k3s.role = "server";
# Fix issue with "too many open files"
security.pam.loginLimits = [{
domain = "*";
type = "soft";
item = "nofile";
value = "8192";
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment