From 70a388ce8537c9efb95c95b51b717cf9d74880c9 Mon Sep 17 00:00:00 2001 From: Ariel Sosnovsky Date: Fri, 10 Nov 2023 13:39:55 -0500 Subject: [PATCH] nix configs --- os/configuration.nix | 21 +++++++++++++++++++++ os/k3s.nix | 30 ++++++++++++++++++++++++++++++ os/settings.nix | 19 +++++++++++++++++++ os/users.nix | 21 +++++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 os/configuration.nix create mode 100644 os/k3s.nix create mode 100644 os/settings.nix create mode 100644 os/users.nix diff --git a/os/configuration.nix b/os/configuration.nix new file mode 100644 index 0000000..9867edd --- /dev/null +++ b/os/configuration.nix @@ -0,0 +1,21 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + "./k3s.nix" + "./users.nix" + "./settings.nix" + ]; + + # Bootloader. + boot.loader.grub.enable = true; + boot.loader.grub.device = "/dev/sda"; + networking.hostName = "changeme"; # Define your hostname. + system.stateVersion = "23.05"; +} diff --git a/os/k3s.nix b/os/k3s.nix new file mode 100644 index 0000000..363024f --- /dev/null +++ b/os/k3s.nix @@ -0,0 +1,30 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + # Bootloader. + boot.initrd = { + supportedFilesystems = [ "nfs" ]; + kernelModules = [ "nfs" ]; + }; + i18n.defaultLocale = "en_CA.UTF-8"; + services.nfs.server.enable = true; + services.rpcbind.enable = true; + environment.systemPackages = with pkgs; [ + pkgs.k3s + nfs-utils + ]; + services.k3s.enable = true; + services.k3s.role = "server"; + services.k3s.extraFlags = toString [ + "--tls-san" + "192.168.0.26" + "--datastore-endpoint" "postgres://postgres:3wtvrd5KdQYUXE@192.168.0.28:5432/k3sdb?sslmode=disable" + "--token" "Upi+DZa++9DiAc1po4LkPKPx6Ed1IRrg1VRsglGjp2ERhOssDXaKCWLY8Enk3GIOGyWHHlHKz1dIofXpgkRV2w==" + ]; + networking.firewall.allowedTCPPorts = [ 22 80 443 ]; + networking.firewall.allowedUDPPorts = [ 80 443 ]; +} diff --git a/os/settings.nix b/os/settings.nix new file mode 100644 index 0000000..7c83a2b --- /dev/null +++ b/os/settings.nix @@ -0,0 +1,19 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + # Bootloader. + networking.networkmanager.enable = true; + time.timeZone = "America/Toronto"; + i18n.defaultLocale = "en_CA.UTF-8"; + services.xserver = { + layout = "us"; + xkbVariant = ""; + }; + nixpkgs.config.allowUnfree = true; + services.openssh.enable = true; + networking.firewall.enable = false; +} diff --git a/os/users.nix b/os/users.nix new file mode 100644 index 0000000..3e3d8ff --- /dev/null +++ b/os/users.nix @@ -0,0 +1,21 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + users.users.ari = { + isNormalUser = true; + description = "Ari"; + extraGroups = [ "networkmanager" "wheel" "root" ]; + packages = with pkgs; []; + }; + + environment.systemPackages = with pkgs; [ + pciutils + usbutils + jq + ]; + +}