From cf6e2a1a485ed2a8a9c145c6f4274a6e28e94002 Mon Sep 17 00:00:00 2001 From: WHC Date: Mon, 21 Sep 2026 23:45:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20laptop=20=E4=B8=BB?= =?UTF-8?q?=E6=9C=BA=E9=85=8D=E7=BD=AE=EF=BC=88Ultra=209=20285H=20/=20Arc?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - hosts/laptop/hardware.nix: 本机真实硬件配置(btrfs 子卷 / NPU / 微码) - hosts/laptop/default.nix: 复用 common/desktop-plasma/chinese/gaming/printing/apps,跳过 nvidia 与 fpga;加 Intel Arc VA-API - flake.nix: 抽出 mkSystem,新增 nixosConfigurations.laptop / nixos --- flake.nix | 14 ++++++++---- hosts/laptop/default.nix | 26 ++++++++++++++++++++++ hosts/laptop/hardware.nix | 46 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 hosts/laptop/default.nix create mode 100644 hosts/laptop/hardware.nix diff --git a/flake.nix b/flake.nix index eb075c5..e8a3993 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "whc NixOS — desktop (i7-12700F + RTX 4060)"; + description = "whc NixOS — desktop (i7-12700F + RTX 4060) + laptop (Ultra 9 285H / Arc)"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; @@ -9,11 +9,17 @@ { self, nixpkgs, ... }: let system = "x86_64-linux"; + mkSystem = host: nixpkgs.lib.nixosSystem { + inherit system; + modules = [ (./hosts + "/${host}") ]; + }; in { - nixosConfigurations.desktop = nixpkgs.lib.nixosSystem { - inherit system; - modules = [ ./hosts/desktop ]; + nixosConfigurations = { + desktop = mkSystem "desktop"; + laptop = mkSystem "laptop"; + # hostname 仍是 nixos:让不带 attr 的 `nixos-rebuild --flake .#` 也能命中 + nixos = mkSystem "laptop"; }; # 无 flake 时也可:把本仓库拷到 /etc/nixos 后 nixos-rebuild switch diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix new file mode 100644 index 0000000..27318d9 --- /dev/null +++ b/hosts/laptop/default.nix @@ -0,0 +1,26 @@ +# 笔记本:Intel Core Ultra 9 285H + Intel Arc(Arrow Lake-P),无 NVIDIA +{ pkgs, ... }: + +{ + imports = [ + ./hardware.nix + ../../modules/common.nix + ../../modules/desktop-plasma.nix + ../../modules/chinese.nix + ../../modules/gaming.nix + ../../modules/printing.nix + ../../modules/apps.nix + # 本机无 NVIDIA:刻意不导入 ../../modules/nvidia.nix + # FPGA 工具链依赖 Qt5,在 unstable 上求值风险高,暂不导入 ../../modules/fpga.nix + ]; + + networking.hostName = "nixos"; + + # 笔记本不照抄 desktop 的 "performance",交给内核默认调度 + # powerManagement.cpuFreqGovernor = "powersave"; + + # Intel Arc 硬解(VA-API),可选 + hardware.graphics.extraPackages = [ pkgs.intel-media-driver ]; + + system.stateVersion = "26.05"; +} diff --git a/hosts/laptop/hardware.nix b/hosts/laptop/hardware.nix new file mode 100644 index 0000000..80916a7 --- /dev/null +++ b/hosts/laptop/hardware.nix @@ -0,0 +1,46 @@ +# 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" "thunderbolt" "nvme" "uas" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/cbcb5930-50a9-4ff8-92f9-4622bd869579"; + fsType = "btrfs"; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/cbcb5930-50a9-4ff8-92f9-4622bd869579"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/cbcb5930-50a9-4ff8-92f9-4622bd869579"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/84D8-EB50"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/d62e342b-271a-40e7-912d-3a748b5f55a1"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.npu.enable = true; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}