From 3f63ea2c434ccf68bd3bd94745ea958a8403c212 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Tue, 28 Oct 2025 22:45:24 +0800 Subject: [PATCH] feat: add host c1 --- flake.nix | 15 +---------- hosts/c1/configuration.nix | 16 ++++++++++++ hosts/c1/hardware-configuration.nix | 40 +++++++++++++++++++++++++++++ modules/nasp/main.nix | 2 -- modules/nasp/scripts/dnew | 21 ++++++++------- 5 files changed, 69 insertions(+), 25 deletions(-) create mode 100644 hosts/c1/configuration.nix create mode 100644 hosts/c1/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index f8a1770..5857882 100644 --- a/flake.nix +++ b/flake.nix @@ -10,20 +10,7 @@ let nixos-x86_64-hosts = [ "g1" - "g2" - "g3" - "g5" - "g6" - "g7" - "g8" - "g10" - "g11" - "g12" - "g13" - "g14" - "g17" - "g18-next" - "web-server" + "c1" ]; nasp = (import ./modules/nasp { lib = nixpkgs.lib; diff --git a/hosts/c1/configuration.nix b/hosts/c1/configuration.nix new file mode 100644 index 0000000..fad24ee --- /dev/null +++ b/hosts/c1/configuration.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: + +{ + imports =[ + ./hardware-configuration.nix + ]; + nasp = { + enable = true; + cSeries = { + enable = true; + serial = 1; + ethLanName = "ens16f0"; + }; + }; + system.stateVersion = "25.05"; +} diff --git a/hosts/c1/hardware-configuration.nix b/hosts/c1/hardware-configuration.nix new file mode 100644 index 0000000..21912dd --- /dev/null +++ b/hosts/c1/hardware-configuration.nix @@ -0,0 +1,40 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "smartpqi" "nvme" "usbhid" "uas" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + networking.hostId = "3d7a3f3a"; + + fileSystems."/" = { + device = "root/system"; + fsType = "zfs"; + }; + + fileSystems."/home2" = { + device = "data/home2"; + fsType = "zfs"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/6907-0724"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/c4a9f9b2-cd67-49b6-94b6-50a1b91b05a2"; } + { device = "/dev/disk/by-uuid/05541d44-caf4-47a0-af99-6fc7a0de4f90"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/nasp/main.nix b/modules/nasp/main.nix index 8b59ca8..86706f5 100644 --- a/modules/nasp/main.nix +++ b/modules/nasp/main.nix @@ -165,8 +165,6 @@ in noto-fonts-cjk-sans noto-fonts-cjk-serif noto-fonts-color-emoji - vista-fonts - vista-fonts-chs roboto-mono ]; }; diff --git a/modules/nasp/scripts/dnew b/modules/nasp/scripts/dnew index 7d55f4a..97d5416 100755 --- a/modules/nasp/scripts/dnew +++ b/modules/nasp/scripts/dnew @@ -42,17 +42,20 @@ if [[ "$EUID" == "0" ]]; then exit 1 fi -ret=$(ask_for_yN "Use GPU?") -if [[ "$ret" == "1" ]]; then - base_command="$base_command \\ - --device nvidia.com/gpu=all" +if command -v nvidia-smi 1>/dev/null; then + ret=$(ask_for_yN "Use GPU?") + if [[ "$ret" == "1" ]]; then + base_command="$base_command \\ + --device nvidia.com/gpu=all" + fi fi -ret=$(ask_for_yN "Use RDMA?") -if [[ "$ret" == "1" ]]; then - base_command="$base_command \\ - --device=/dev/infiniband/uverbs0" +if command -v ibv_devinfo 1>/dev/null; then + ret=$(ask_for_yN "Use RDMA?") + if [[ "$ret" == "1" ]]; then + base_command="$base_command \\ + --device=/dev/infiniband/uverbs0" + fi fi - image_name="git.nasp.fit/nasp/nasp-ubuntu" base_command="$base_command \\ -it $image_name"