From d0f891e144fafd7db797a064ea85da9c5c2db653 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Sun, 16 Nov 2025 13:33:13 +0100 Subject: [PATCH] add jetson host --- flake.nix | 20 +++++- hosts/nixos/jetson/disk-config.nix | 38 +++++++++++ hosts/nixos/jetson/hardware-configuration.nix | 26 ++++++++ hosts/nixos/jetson/home.nix | 7 ++ hosts/nixos/jetson/system.nix | 64 +++++++++++++++++++ 5 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 hosts/nixos/jetson/disk-config.nix create mode 100644 hosts/nixos/jetson/hardware-configuration.nix create mode 100644 hosts/nixos/jetson/home.nix create mode 100644 hosts/nixos/jetson/system.nix diff --git a/flake.nix b/flake.nix index 60171f8..81c0599 100644 --- a/flake.nix +++ b/flake.nix @@ -19,9 +19,11 @@ disko.inputs.nixpkgs.follows = "nixpkgs"; jovian-nixos.url = "github:Jovian-Experiments/Jovian-NixOS"; jovian-nixos.inputs.nixpkgs.follows = "nixpkgs"; + jetpack-nixos.url = "github:anduril/jetpack-nixos"; + jetpack-nixos.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager, nixvim, claude-code, firefox-addons, nix-homebrew, disko, jovian-nixos }: + outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager, nixvim, claude-code, firefox-addons, nix-homebrew, disko, jovian-nixos, jetpack-nixos }: { darwinConfigurations."macbook" = nix-darwin.lib.darwinSystem { modules = [ @@ -67,6 +69,16 @@ ]; }; + nixosConfigurations."jetson" = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + disko.nixosModules.disko + jetpack-nixos.nixosModules.default + ./hosts/nixos/jetson/system.nix + ./hosts/nixos/jetson/disk-config.nix + ]; + }; + homeConfigurations = { "yanlin@macbook" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.aarch64-darwin; @@ -97,6 +109,12 @@ modules = [ ./hosts/nixos/deck/home.nix ]; extraSpecialArgs = { inherit claude-code nixvim firefox-addons; }; }; + + "yanlin@jetson" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.aarch64-linux; + modules = [ ./hosts/nixos/jetson/home.nix ]; + extraSpecialArgs = { inherit claude-code nixvim; }; + }; }; }; } diff --git a/hosts/nixos/jetson/disk-config.nix b/hosts/nixos/jetson/disk-config.nix new file mode 100644 index 0000000..6c6d5b3 --- /dev/null +++ b/hosts/nixos/jetson/disk-config.nix @@ -0,0 +1,38 @@ +# Disko configuration for Jetson Orin Nano Super Developer Kit +# Simple NVMe configuration with systemd-boot +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + # EFI System Partition + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "fmask=0077" "dmask=0077" ]; + }; + }; + + # Root partition - takes remaining space + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/nixos/jetson/hardware-configuration.nix b/hosts/nixos/jetson/hardware-configuration.nix new file mode 100644 index 0000000..8651777 --- /dev/null +++ b/hosts/nixos/jetson/hardware-configuration.nix @@ -0,0 +1,26 @@ +# PLACEHOLDER hardware configuration for Jetson Orin Nano +# This file should be regenerated on the actual device by running: +# nixos-generate-config --root /mnt +# Then copy the generated hardware-configuration.nix to this location. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + # These are placeholder kernel modules - will be auto-detected by nixos-generate-config + boot.initrd.availableKernelModules = [ "nvme" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + # Filesystems are managed by disko configuration + # No filesystem declarations needed here + + # Enable DHCP on network interfaces + networking.useDHCP = lib.mkDefault true; + + # ARM64 platform for Jetson Orin Nano + nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; +} diff --git a/hosts/nixos/jetson/home.nix b/hosts/nixos/jetson/home.nix new file mode 100644 index 0000000..bdd9801 --- /dev/null +++ b/hosts/nixos/jetson/home.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../home-default.nix + ]; +} diff --git a/hosts/nixos/jetson/system.nix b/hosts/nixos/jetson/system.nix new file mode 100644 index 0000000..415b25a --- /dev/null +++ b/hosts/nixos/jetson/system.nix @@ -0,0 +1,64 @@ +{ config, pkgs, lib, ... }: + +{ + imports = [ + ./hardware-configuration.nix + ../system-default.nix # Common NixOS system configuration + ]; + + # Bootloader - UEFI setup for Jetson + boot.loader = { + systemd-boot.enable = true; + systemd-boot.configurationLimit = 50; + efi.canTouchEfiVariables = true; + timeout = 3; + }; + + # Use latest kernel for best hardware support + boot.kernelPackages = pkgs.linuxPackages_latest; + + # Hardware support for Jetson Orin Nano + hardware = { + enableRedistributableFirmware = true; + + # Graphics and CUDA configuration via jetpack-nixos + graphics.enable = true; + + nvidia-jetpack = { + enable = true; + som = "orin-nano"; + carrierBoard = "devkit"; + }; + }; + + # Network configuration + networking = { + hostName = "jetson"; + networkmanager.enable = true; + firewall.enable = false; + }; + + # Host-specific SSH configuration + services.openssh = { + settings = { + PermitRootLogin = "no"; + }; + }; + + # Host-specific user configuration + users.users.yanlin = { + extraGroups = [ "networkmanager" "wheel" "video" ]; + hashedPassword = "$6$kSyaRzAtj8VPcNeX$NsEP6zQAfp6O8YWcolfPRKnhIcJlKu5luZgWqozJAHtbE/gv90KoOOKU7Dt.FnbPB0Ej26jXoBH4X.7y/OLGB1"; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICp2goZiuSfwMA02GsHhYzUZHrQPPBgP5sWSNP9kQR3e yanlin@imac" + ]; + }; + + # Basic system packages + environment.systemPackages = with pkgs; [ + pciutils + usbutils + unzip + ]; + +}