diff --git a/os/nixos-amd/example-configuration.nix b/os/nixos-amd/example-configuration.nix new file mode 100644 index 0000000..5777a86 --- /dev/null +++ b/os/nixos-amd/example-configuration.nix @@ -0,0 +1,13 @@ +{ ... }: +{ + imports = + [ + ./hardware-configuration.nix + (import ./main.nix { + hostName = ""; + stateVersion = "23.05"; + dbConnectionStr = ""; + K3SToken = ""; + }) + ]; +} \ No newline at end of file diff --git a/os/nixos-amd/k3s.nix b/os/nixos-amd/k3s.nix new file mode 100644 index 0000000..fc2d3ec --- /dev/null +++ b/os/nixos-amd/k3s.nix @@ -0,0 +1,37 @@ +# 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’). +{ + hostName, + dbConnectionStr, + K3SToken +}: +{ 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; [ + k3s + nfs-utils + git + rocmPackages.rocm-smi + rocmPackages.rpp + ]; + services.k3s.enable = true; + services.k3s.role = "server"; + services.k3s.extraFlags = toString [ + "--tls-san" + hostName + "--datastore-endpoint" dbConnectionStr + "--token" K3SToken + ]; + networking.firewall.allowedTCPPorts = [ 22 80 443 ]; + networking.firewall.allowedUDPPorts = [ 80 443 ]; +} diff --git a/os/nixos-amd/main.nix b/os/nixos-amd/main.nix new file mode 100644 index 0000000..273058f --- /dev/null +++ b/os/nixos-amd/main.nix @@ -0,0 +1,23 @@ +{ + hostName, + stateVersion, + dbConnectionStr, + K3SToken +}: +{ config, pkgs, ... }: +{ + imports = + [ + (import ./k3s.nix { + hostName = hostName; + dbConnectionStr = dbConnectionStr; + K3SToken = K3SToken; + }) + ./users.nix + ./settings.nix + ]; + + # Bootloader. + networking.hostName = hostName; + system.stateVersion = stateVersion; +} diff --git a/os/nixos-amd/settings.nix b/os/nixos-amd/settings.nix new file mode 100644 index 0000000..7c83a2b --- /dev/null +++ b/os/nixos-amd/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/nixos-amd/users.nix b/os/nixos-amd/users.nix new file mode 100644 index 0000000..3e3d8ff --- /dev/null +++ b/os/nixos-amd/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 + ]; + +} diff --git a/os/nixos/k3s.nix b/os/nixos/k3s.nix index e1a8ed8..947dd5e 100644 --- a/os/nixos/k3s.nix +++ b/os/nixos/k3s.nix @@ -5,7 +5,6 @@ hostName, dbConnectionStr, K3SToken, - additionalPkgs = [], }: { config, pkgs, ... }: @@ -18,11 +17,11 @@ i18n.defaultLocale = "en_CA.UTF-8"; services.nfs.server.enable = true; services.rpcbind.enable = true; - environment.systemPackages = builtins.concat([ + environment.systemPackages = [ pkgs.k3s pkgs.nfs-utils pkgs.git - ], additionalPkgs); + ]; services.k3s.enable = true; services.k3s.role = "server"; services.k3s.extraFlags = toString [ diff --git a/os/nixos/main.nix b/os/nixos/main.nix index 58025db..8ca06b7 100644 --- a/os/nixos/main.nix +++ b/os/nixos/main.nix @@ -2,7 +2,7 @@ hostName, stateVersion, dbConnectionStr, - K3SToken + K3SToken, additionalPkgs = [], }: { config, pkgs, ... }: @@ -13,7 +13,6 @@ hostName = hostName; dbConnectionStr = dbConnectionStr; K3SToken = K3SToken; - additionalPkgs = additionalPkgs; }) ./users.nix ./settings.nix