add nfss host
This commit is contained in:
parent
31aad1c384
commit
4e3c074114
5 changed files with 325 additions and 0 deletions
15
flake.nix
15
flake.nix
|
|
@ -62,6 +62,15 @@
|
|||
];
|
||||
};
|
||||
|
||||
nixosConfigurations."nfss" = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
disko.nixosModules.disko
|
||||
./hosts/nixos/nfss/system.nix
|
||||
./hosts/nixos/nfss/disk-config.nix
|
||||
];
|
||||
};
|
||||
|
||||
homeConfigurations = {
|
||||
"yanlin@macbook" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.aarch64-darwin;
|
||||
|
|
@ -92,6 +101,12 @@
|
|||
modules = [ ./hosts/nixos/thinkpad/home.nix ];
|
||||
extraSpecialArgs = { inherit claude-code nixvim firefox-addons; };
|
||||
};
|
||||
|
||||
"yanlin@nfss" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
modules = [ ./hosts/nixos/nfss/home.nix ];
|
||||
extraSpecialArgs = { inherit claude-code nixvim; };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
137
hosts/nixos/nfss/disk-config.nix
Normal file
137
hosts/nixos/nfss/disk-config.nix
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
# First drive of ZFS mirror pair (ZHITAI 1TB #1)
|
||||
main1 = {
|
||||
type = "disk";
|
||||
device = "/dev/disk/by-id/ata-ZHITAI_SC001_XT_1000GB_ZTB401TAB244431J4R";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
# GRUB BIOS boot partition
|
||||
boot = {
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
# EFI System Partition (mirrored manually)
|
||||
esp1 = {
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
# ZFS partition
|
||||
zfs = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
pool = "rpool";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Second drive of ZFS mirror pair (ZHITAI 1TB #2)
|
||||
main2 = {
|
||||
type = "disk";
|
||||
device = "/dev/disk/by-id/ata-ZHITAI_SC001_XT_1000GB_ZTB401TAB244431KEG";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
# GRUB BIOS boot partition
|
||||
boot = {
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
# EFI System Partition (backup)
|
||||
esp2 = {
|
||||
size = "500M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
};
|
||||
};
|
||||
# ZFS partition
|
||||
zfs = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
pool = "rpool";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
zpool = {
|
||||
rpool = {
|
||||
type = "zpool";
|
||||
mode = "mirror";
|
||||
rootFsOptions = {
|
||||
compression = "lz4";
|
||||
acltype = "posixacl";
|
||||
xattr = "sa";
|
||||
relatime = "on";
|
||||
normalization = "formD";
|
||||
canmount = "off";
|
||||
dnodesize = "auto";
|
||||
};
|
||||
mountpoint = "/";
|
||||
|
||||
datasets = {
|
||||
# Root dataset
|
||||
root = {
|
||||
type = "zfs_fs";
|
||||
options = {
|
||||
canmount = "off";
|
||||
mountpoint = "none";
|
||||
};
|
||||
};
|
||||
|
||||
# Root filesystem
|
||||
"root/nixos" = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/";
|
||||
options = {
|
||||
canmount = "noauto";
|
||||
mountpoint = "/";
|
||||
"com.sun:auto-snapshot" = "true";
|
||||
};
|
||||
};
|
||||
|
||||
# Home directory
|
||||
"root/home" = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/home";
|
||||
options = {
|
||||
canmount = "on";
|
||||
mountpoint = "/home";
|
||||
"com.sun:auto-snapshot" = "true";
|
||||
};
|
||||
};
|
||||
|
||||
# Nix store (no snapshots needed)
|
||||
"root/nix" = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/nix";
|
||||
options = {
|
||||
canmount = "on";
|
||||
mountpoint = "/nix";
|
||||
"com.sun:auto-snapshot" = "false";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
38
hosts/nixos/nfss/hardware-configuration.nix
Normal file
38
hosts/nixos/nfss/hardware-configuration.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# Hardware configuration for nfss (nix-based full ssd server)
|
||||
# Same hardware as hs - generated by nixos-generate-config
|
||||
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
|
||||
# Boot configuration - detected kernel modules for this hardware
|
||||
boot.initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"ahci"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
# ZFS filesystems are managed by disko configuration
|
||||
# No filesystem declarations needed here - disko handles all mounts
|
||||
|
||||
# No swap devices configured
|
||||
swapDevices = [ ];
|
||||
|
||||
# Networking hardware
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
|
||||
# Hardware-specific settings
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
|
||||
# CPU microcode updates
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
# Enable firmware updates
|
||||
hardware.enableRedistributableFirmware = lib.mkDefault true;
|
||||
}
|
||||
13
hosts/nixos/nfss/home.nix
Normal file
13
hosts/nixos/nfss/home.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../home-default.nix
|
||||
../../../modules/tex.nix
|
||||
../../../modules/schedule.nix
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
];
|
||||
|
||||
}
|
||||
122
hosts/nixos/nfss/system.nix
Normal file
122
hosts/nixos/nfss/system.nix
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
{ config, pkgs, ... }: {
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../system-default.nix
|
||||
../../../modules/login-display.nix
|
||||
];
|
||||
|
||||
# GRUB bootloader with ZFS support
|
||||
boot.loader.grub = {
|
||||
enable = true;
|
||||
devices = [
|
||||
"/dev/disk/by-id/ata-ZHITAI_SC001_XT_1000GB_ZTB401TAB244431J4R"
|
||||
"/dev/disk/by-id/ata-ZHITAI_SC001_XT_1000GB_ZTB401TAB244431KEG"
|
||||
]; # Install GRUB on both ZFS mirror drives
|
||||
efiSupport = true;
|
||||
efiInstallAsRemovable = true;
|
||||
zfsSupport = true;
|
||||
};
|
||||
|
||||
# Disable systemd stage-1 (use traditional initrd for ZFS compatibility)
|
||||
boot.initrd.systemd.enable = false;
|
||||
boot.supportedFilesystems = [ "zfs" ];
|
||||
boot.zfs.forceImportRoot = false;
|
||||
|
||||
# ZFS ARC memory configuration for 32GB system
|
||||
boot.kernelParams = [
|
||||
"zfs.zfs_arc_max=17179869184" # 16GB max ARC size
|
||||
"zfs.zfs_arc_min=2147483648" # 2GB min ARC size
|
||||
];
|
||||
|
||||
# Network configuration
|
||||
networking = {
|
||||
hostName = "nfss";
|
||||
hostId = "8425e349"; # Required for ZFS
|
||||
networkmanager.enable = true;
|
||||
firewall = { enable = false; };
|
||||
};
|
||||
|
||||
# Host-specific SSH configuration
|
||||
services.openssh = {
|
||||
settings = {
|
||||
PermitRootLogin = "yes";
|
||||
};
|
||||
openFirewall = true;
|
||||
};
|
||||
|
||||
# Define a user account
|
||||
users.users.root = {
|
||||
hashedPassword = null;
|
||||
hashedPasswordFile = null;
|
||||
password = null;
|
||||
initialHashedPassword = null;
|
||||
initialPassword = null;
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG35m0DgTrEOAM+1wAlYZ8mvLelNTcx65cFccGPQcxmo yanlin@imac"
|
||||
];
|
||||
};
|
||||
|
||||
# Host-specific user configuration
|
||||
users.users.yanlin = {
|
||||
extraGroups = [ "networkmanager" "wheel" ];
|
||||
hashedPassword = "$6$8NUV0JK33hs3XBYe$osnYKzENDLYHQEpj8Z5F6ECpLdc8Y3RZcVGxQ0bc/6DepTwugAkfX8h6ItI01dJyk8RstiGsWVVCKGwXaL.sN.";
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG35m0DgTrEOAM+1wAlYZ8mvLelNTcx65cFccGPQcxmo yanlin@imac"
|
||||
];
|
||||
};
|
||||
|
||||
# Intel graphics for hardware acceleration (QSV/VA-API)
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
intel-media-driver
|
||||
intel-vaapi-driver
|
||||
libva-vdpau-driver
|
||||
libvdpau-va-gl
|
||||
vpl-gpu-rt
|
||||
intel-compute-runtime
|
||||
];
|
||||
};
|
||||
|
||||
# Host-specific packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
smartmontools
|
||||
zfs
|
||||
intel-gpu-tools
|
||||
];
|
||||
|
||||
# ZFS services configuration
|
||||
services.zfs = {
|
||||
autoScrub = {
|
||||
enable = true;
|
||||
interval = "monthly";
|
||||
pools = [ "rpool" ];
|
||||
};
|
||||
autoSnapshot = {
|
||||
enable = true;
|
||||
frequent = 4;
|
||||
hourly = 24;
|
||||
daily = 7;
|
||||
weekly = 4;
|
||||
monthly = 12;
|
||||
};
|
||||
trim = {
|
||||
enable = true;
|
||||
interval = "weekly";
|
||||
};
|
||||
};
|
||||
|
||||
# Login display with SMART disk health status
|
||||
services.login-display = {
|
||||
enable = true;
|
||||
showSystemInfo = true;
|
||||
showSmartStatus = true;
|
||||
smartDrives = {
|
||||
"/dev/disk/by-id/ata-ZHITAI_SC001_XT_1000GB_ZTB401TAB244431J4R" = "ZFS_Mirror_1";
|
||||
"/dev/disk/by-id/ata-ZHITAI_SC001_XT_1000GB_ZTB401TAB244431KEG" = "ZFS_Mirror_2";
|
||||
};
|
||||
showDiskUsage = true;
|
||||
diskUsagePaths = [ "/" "/home/" ];
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue