Skip to content

Commit

Permalink
add polaris
Browse files Browse the repository at this point in the history
  • Loading branch information
jpetrucciani committed Dec 31, 2024
1 parent a20ac6f commit dd92775
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 4 deletions.
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"milkyway"
"neptune"
"phobos"
"polaris"
"proteus"
"terra"
"titan"
Expand Down
4 changes: 4 additions & 0 deletions hosts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions hosts/constants.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
34 changes: 34 additions & 0 deletions hosts/polaris/README.md
Original file line number Diff line number Diff line change
@@ -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 [email protected]: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.
96 changes: 96 additions & 0 deletions hosts/polaris/configuration.nix
Original file line number Diff line number Diff line change
@@ -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;
};
};
}
37 changes: 37 additions & 0 deletions hosts/polaris/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -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.<interface>.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;
}
4 changes: 0 additions & 4 deletions hosts/titan/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ in
];
};

# fonts.packages = with pkgs; [
# nerdfonts
# ];

time.timeZone = common.timeZone;

networking = {
Expand Down

0 comments on commit dd92775

Please sign in to comment.