From 3cd8b9ea5781c1faf50d2c81fd0cac6bf7084991 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Fri, 17 Sep 2021 14:42:50 -0400 Subject: [PATCH] add new ryzen9 --- hosts/ryzen9.nix | 129 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 hosts/ryzen9.nix diff --git a/hosts/ryzen9.nix b/hosts/ryzen9.nix new file mode 100644 index 0000000..c276de0 --- /dev/null +++ b/hosts/ryzen9.nix @@ -0,0 +1,129 @@ +{ config, pkgs, lib, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "ahci" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { + device = "/dev/disk/by-uuid/5563081e-40b4-4295-99a0-b1c099d03b8f"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + + nix.maxJobs = lib.mkDefault 32; + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; + + # Use GRUB2 as the boot loader. + # We don't use systemd-boot because Hetzner uses BIOS legacy boot. + boot.loader.systemd-boot.enable = false; + boot.loader.grub = { + enable = true; + efiSupport = false; + devices = [ "/dev/nvme0n1" "/dev/nvme1n1" ]; + }; + + # The madm RAID was created with a certain hostname, which madm will consider + # the "home hostname". Changing the system hostname will result in the array + # being considered "foregin" as opposed to "local", and showing it as + # '/dev/md/:root0' instead of '/dev/md/root0'. + + # This is mdadm's protection against accidentally putting a RAID disk + # into the wrong machine and corrupting data by accidental sync, see + # https://bugzilla.redhat.com/show_bug.cgi?id=606481#c14 and onward. + # We set the HOMEHOST manually go get the short '/dev/md' names, + # and so that things look and are configured the same on all such + # machines irrespective of host names. + # We do not worry about plugging disks into the wrong machine because + # we will never exchange disks between machines. + environment.etc."mdadm.conf".text = '' + HOMEHOST ryzen9 + ''; + + # The RAIDs are assembled in stage1, so we need to make the config + # available there. + boot.initrd.mdadmConf = config.environment.etc."mdadm.conf".text; + + # Network (Hetzner uses static IP assignments, and we don't use DHCP here) + networking.useDHCP = false; + + networking.interfaces."enp35s0" = { + ipv4 = { + addresses = [{ + # Server main IPv4 address + address = "162.55.89.216"; + prefixLength = 24; + }]; + + routes = [ + # Default IPv4 gateway route + { + address = "0.0.0.0"; + prefixLength = 0; + via = "162.55.89.193"; + } + ]; + }; + + ipv6 = { + addresses = [{ + address = "2a01:4f8:271:1967::1"; + prefixLength = 64; + }]; + + # Default IPv6 route + routes = [{ + address = "::"; + prefixLength = 0; + via = "fe80::1"; + }]; + }; + }; + + networking = { + nameservers = [ "8.8.8.8" "8.8.4.4" ]; + hostName = "ryzen9"; + }; + + nixpkgs.config.allowUnfree = true; + nix = { + package = pkgs.nixUnstable; + extraOptions = '' + experimental-features = nix-command flakes + ''; + trustedUsers = [ "root" "srid" ]; + }; + + services.netdata.enable = true; + + programs = { + mosh.enable = true; + }; + + environment.systemPackages = with pkgs; [ + cryptsetup + ]; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.srid = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + }; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "20.03"; # Did you read the comment? + +}