DragonOS/user/rootfs-tar.nix

48 lines
743 B
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
lib,
pkgs,
nixpkgs,
system,
target,
fenix,
testOpt,
}:
# 产物是一个可以生成 rootfs.tar 的脚本
let
apps = import ./apps {
inherit
lib
pkgs
nixpkgs
system
target
fenix
testOpt
;
};
sys-config =
pkgs.runCommand "sysconfig"
{
src = ./sysconfig;
}
''
mkdir -p $out $out/root
cp -r $src/* $out/
'';
# 使用 buildImage 创建 Docker 镜像(单层)
# 直接返回 dockerImage解压逻辑在 default.nix 中处理
dockerImage = pkgs.dockerTools.buildImage {
name = "busybox-rootfs";
copyToRoot = [
sys-config
]
++ apps;
keepContentsDirlinks = false;
};
in
dockerImage