diff --git a/flake.nix b/flake.nix index f3dfd552..b11cd099 100644 --- a/flake.nix +++ b/flake.nix @@ -64,6 +64,7 @@ "milkyway" "neptune" "phobos" + "polaris" "proteus" "terra" "titan" diff --git a/hosts/README.md b/hosts/README.md index 99a1c41d..ee08d2c1 100644 --- a/hosts/README.md +++ b/hosts/README.md @@ -50,6 +50,10 @@ This is an experimental nixos install inside a VM. This is my personal M2 Max Macbook, running MacOS and using nix-darwin and home-manager to manage things. +### [polaris/](./polaris) + +This is a _large_ bare-metal nixos server with dual rtx a6000s! + ### [styx/](./styx) This is a M2 Ultra Mac Studio server diff --git a/hosts/constants.nix b/hosts/constants.nix index 5a20af0c..06d8add7 100644 --- a/hosts/constants.nix +++ b/hosts/constants.nix @@ -34,6 +34,7 @@ let charon = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIQf/+Cw19PwfLGRs7VyJR9rqwglDG/ZwBbwJY1Aagxo jacobi@charon"; mars = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBMW7fOdfDeI+9TwYHPUzApYDlNFOfLkl9NC06Du23mP jacobi@mars"; phobos = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID7CSn6s/Wuxa2sC4NXCIXGvX3oz8BN1vsyaZGd3wJED jacobi@phobos"; + polaris = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKkq80OeQLD7QBlE81EYUC+ZOgNZT1+Vc8oGP6y3mTFm jacobi@polaris"; luna = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINOoY9vE2hPcBtoI/sE9pmk4ocO+QWZv2lvtxcPs9oha jacobi@luna"; milkyway = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII2VPpmvMVt+5LHJfgmsTSdWy5SIM2gBvgpyuT3iMt1a jacobi@milkyway"; terra = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFWWDYzXHtB3hd/5sWeg+kz+COGxCEWalspwCNnZNOZz jacobi@terra"; diff --git a/hosts/polaris/README.md b/hosts/polaris/README.md new file mode 100644 index 00000000..c5c209bc --- /dev/null +++ b/hosts/polaris/README.md @@ -0,0 +1,34 @@ +# polaris + +This is a _large_ bare-metal nixos server with dual rtx a6000s! + +## bootstrap + +```bash +# load nixos iso +# nixos-up +sudo nix-shell https://nix.cobi.dev/os-up + +# generate ssh key, add to github +ssh-keygen -o -a 100 -t ed25519 -C "jacobi@polaris" + +# clone repo +nix-shell -p git +git clone git@github.com:jpetrucciani/nix.git ~/cfg +cd ~/cfg + +# initial switch. after this, you can use just `hms` to update! +$(nix build --no-link --print-out-paths --extra-experimental-features nix-command --extra-experimental-features flakes ~/cfg#hmx.polaris)/bin/switch +``` + +--- + +## In this directory + +### [configuration.nix](./configuration.nix) + +This file defines the OS configuration for the `polaris` machine. + +### [hardware-configuration.nix](./hardware-configuration.nix) + +This is an auto-generated file by [nixos-up](https://github.com/samuela/nixos-up) that configures disks and other plugins for nixos. diff --git a/hosts/polaris/configuration.nix b/hosts/polaris/configuration.nix new file mode 100644 index 00000000..aaae972f --- /dev/null +++ b/hosts/polaris/configuration.nix @@ -0,0 +1,96 @@ +{ config, flake, machine-name, pkgs, ... }: +let + inherit (flake.inputs) nixos-hardware; + hostname = "polaris"; + common = import ../common.nix { inherit config flake machine-name pkgs; }; +in +{ + imports = [ + "${common.home-manager}/nixos" + ./hardware-configuration.nix + ] ++ (with nixos-hardware.nixosModules; [ + common-pc + common-pc-ssd + ]); + + inherit (common) zramSwap swapDevices; + + nix = common.nix-cuda // { + nixPath = [ + "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos" + "nixos-config=/home/jacobi/cfg/hosts/${hostname}/configuration.nix" + "/nix/var/nix/profiles/per-user/root/channels" + ]; + }; + + home-manager.users.jacobi = common.jacobi; + + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + kernel.sysctl = { } // common.sysctl_opts; + tmp.useTmpfs = true; + }; + + environment = { + variables = { + NIX_HOST = hostname; + NIXOS_CONFIG = "/home/jacobi/cfg/hosts/${hostname}/configuration.nix"; + }; + systemPackages = with pkgs; [ + cudaPackages.cudatoolkit + cudaPackages.cudnn + nvidia-docker + nvtopPackages.nvidia + linuxPackages.nvidia_x11 + ]; + }; + + time.timeZone = common.timeZone; + + networking = { + hostName = hostname; + useDHCP = true; + interfaces.enp4s0f2.useDHCP = true; + firewall.enable = false; + }; + + users = { + mutableUsers = false; + users = { + root.hashedPassword = "!"; + jacobi = { + inherit (common) extraGroups; + isNormalUser = true; + hashedPasswordFile = "/etc/passwordFile-jacobi"; + openssh.authorizedKeys.keys = with common.pubkeys; usual; + }; + }; + }; + + services = { + xserver.videoDrivers = [ "nvidia" ]; + } // common.services; + + system.stateVersion = "24.05"; + security.sudo = common.security.sudo; + programs = { + command-not-found.enable = false; + nix-ld.enable = true; + }; + + virtualisation.docker.enable = true; + hardware = { + nvidia = { + open = false; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + nvidia-container-toolkit.enable = true; + graphics = { + enable = true; + enable32Bit = true; + }; + }; +} diff --git a/hosts/polaris/hardware-configuration.nix b/hosts/polaris/hardware-configuration.nix new file mode 100644 index 00000000..b0586c01 --- /dev/null +++ b/hosts/polaris/hardware-configuration.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/628eb25a-ec4f-4f73-84a7-8a96c335d47a"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/12CE-A600"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.eno1.useDHCP = lib.mkDefault true; + # networking.interfaces.enp4s0f2.useDHCP = lib.mkDefault true; + # networking.interfaces.tailscale0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/titan/configuration.nix b/hosts/titan/configuration.nix index eaf6cf3b..93bee8b3 100644 --- a/hosts/titan/configuration.nix +++ b/hosts/titan/configuration.nix @@ -50,10 +50,6 @@ in ]; }; - # fonts.packages = with pkgs; [ - # nerdfonts - # ]; - time.timeZone = common.timeZone; networking = {