This commit is contained in:
2025-08-08 11:13:45 +08:00
parent fa3428c5dd
commit 133be5465d

View File

@@ -150,7 +150,7 @@ Nix 的优势:将 *编译/配置过程* 抽象成 *可复现、可版本管理
- 使用可读写的 store 目录。编译机上建立相同的目录,编译好再上传。 - 使用可读写的 store 目录。编译机上建立相同的目录,编译好再上传。
- 不能设置 `real` 参数指向 `/nix/store`,否则会破坏编译机的 Nix 数据库。 - 不能设置 `real` 参数指向 `/nix/store`,否则会破坏编译机的 Nix 数据库。
``` ```sh
# this will break the build machine's nix database # this will break the build machine's nix database
sudo nix build --store 'local?store=/data/gpfs01/jykang/.nix/store&real=/nix/store' .#jykang sudo nix build --store 'local?store=/data/gpfs01/jykang/.nix/store&real=/nix/store' .#jykang
# this is safe # this is safe
@@ -183,9 +183,10 @@ sudo nix build --store 'local?store=/data/gpfs01/jykang/.nix/store&state=/data/g
=== 一个例子(曾经的 NVIDIA HPC SDK 打包) === 一个例子(曾经的 NVIDIA HPC SDK 打包)
``` ```nix
let let
builder = buildFHSEnv { targetPkgs = _: []; extraBwrapArgs = [ "--bind" "$out" "$out" ]; }; builder = buildFHSEnv
{ extraBwrapArgs = [ "--bind" "$out" "$out" ]; };
buildScript = writeShellScript "build.sh" ''xxxxx''; buildScript = writeShellScript "build.sh" ''xxxxx'';
in stdenvNoCC.mkDerivation in stdenvNoCC.mkDerivation
{ {