Compare commits
4
Commits
014922f406
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf6e2a1a48 | ||
|
|
b0ee60f7a2 | ||
|
|
12e5ec30af | ||
|
|
5a54a98c30 |
@@ -15,3 +15,4 @@ secrets.nix
|
|||||||
*.key
|
*.key
|
||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
|
gcm-diagnose.log
|
||||||
|
|||||||
@@ -14,9 +14,12 @@ modules/
|
|||||||
nvidia.nix # RTX 4060(12700F 无核显)
|
nvidia.nix # RTX 4060(12700F 无核显)
|
||||||
gaming.nix # Steam
|
gaming.nix # Steam
|
||||||
printing.nix # CUPS + HP ULD + 中文打印
|
printing.nix # CUPS + HP ULD + 中文打印
|
||||||
apps.nix # QQ/微信包装、开发工具等
|
apps.nix # QQ/微信包装、开发工具、KiCad、SPlayer、opencode 等
|
||||||
fpga.nix # 高云 FPGA(Gowin EDU IDE + 开源工具链)
|
fpga.nix # 高云 FPGA(Gowin EDU IDE + 开源工具链)
|
||||||
pkgs/hp-uld-driver.nix
|
pkgs/
|
||||||
|
hp-uld-driver.nix
|
||||||
|
gowin-eda-edu-ide/ # 高云教育版 IDE(FHS)
|
||||||
|
opencode-bin.nix # 官方 opencode 二进制(规避 nixpkgs 崩溃)
|
||||||
```
|
```
|
||||||
|
|
||||||
## 目标机安装(摘要)
|
## 目标机安装(摘要)
|
||||||
|
|||||||
@@ -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 = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
@@ -9,11 +9,17 @@
|
|||||||
{ self, nixpkgs, ... }:
|
{ self, nixpkgs, ... }:
|
||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
mkSystem = host: nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
modules = [ (./hosts + "/${host}") ];
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosConfigurations.desktop = nixpkgs.lib.nixosSystem {
|
nixosConfigurations = {
|
||||||
inherit system;
|
desktop = mkSystem "desktop";
|
||||||
modules = [ ./hosts/desktop ];
|
laptop = mkSystem "laptop";
|
||||||
|
# hostname 仍是 nixos:让不带 attr 的 `nixos-rebuild --flake .#` 也能命中
|
||||||
|
nixos = mkSystem "laptop";
|
||||||
};
|
};
|
||||||
|
|
||||||
# 无 flake 时也可:把本仓库拷到 /etc/nixos 后 nixos-rebuild switch
|
# 无 flake 时也可:把本仓库拷到 /etc/nixos 后 nixos-rebuild switch
|
||||||
|
|||||||
@@ -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";
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
+8
-1
@@ -142,7 +142,14 @@ in
|
|||||||
fzf
|
fzf
|
||||||
btop
|
btop
|
||||||
|
|
||||||
opencode
|
# EDA / 媒体
|
||||||
|
kicad
|
||||||
|
splayer-next
|
||||||
|
(writeShellScriptBin "splayer" ''exec ${splayer-next}/bin/SPlayer-Next "$@"'')
|
||||||
|
|
||||||
|
# 官方二进制:nixpkgs 版发 prompt 会崩(SystemPrompt.environment)
|
||||||
|
(callPackage ../pkgs/opencode-bin.nix { })
|
||||||
|
bun # opencode 插件安装需要
|
||||||
cursor-cli
|
cursor-cli
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
# 官方预编译二进制:nixpkgs 用新版 bun 构建的 opencode 会在发 prompt 时
|
||||||
|
# 触发 SystemPrompt.environment 崩溃(Unexpected server error / a.name)。
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
fetchurl,
|
||||||
|
autoPatchelfHook,
|
||||||
|
makeWrapper,
|
||||||
|
ripgrep,
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
|
pname = "opencode";
|
||||||
|
version = "1.18.31";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://github.com/anomalyco/opencode/releases/download/v${finalAttrs.version}/opencode-linux-x64.tar.gz";
|
||||||
|
hash = "sha256-6TEr517YA7dBX8Kuq9ofT+k4kSo5Zzdi3Aw4wOEeveQ=";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
autoPatchelfHook
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [ stdenv.cc.cc.lib ];
|
||||||
|
|
||||||
|
sourceRoot = ".";
|
||||||
|
|
||||||
|
dontStrip = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
install -Dm755 opencode $out/bin/.opencode-wrapped
|
||||||
|
makeWrapper $out/bin/.opencode-wrapped $out/bin/opencode \
|
||||||
|
--prefix PATH : ${lib.makeBinPath [ ripgrep ]} \
|
||||||
|
--set OPENCODE_DISABLE_AUTOUPDATE true
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "AI coding agent built for the terminal (official binary; nixpkgs build is broken)";
|
||||||
|
homepage = "https://github.com/anomalyco/opencode";
|
||||||
|
changelog = "https://github.com/anomalyco/opencode/releases/tag/v${finalAttrs.version}";
|
||||||
|
license = lib.licenses.mit;
|
||||||
|
platforms = [ "x86_64-linux" ];
|
||||||
|
mainProgram = "opencode";
|
||||||
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||||
|
};
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user