1 { pkgs ? import ../../.. {} }:
3 inherit (pkgs) runCommand closureInfo;
4 # splicing doesn't seem to work right here
5 inherit (pkgs.buildPackages) dumpnar rsync;
7 packCmd: name: pkgs: fixups:
9 nativeBuildInputs = [ rsync dumpnar ];
12 requisites="$(cat ${closureInfo { rootPaths = pkgs; }}/store-paths)"
13 for f in $requisites; do
15 rsync --safe-links --chmod="+w" -av . $base
19 rm -rf nix nix-support
21 for dir in $requisites; do
22 cd "$dir/nix-support" 2>/dev/null || continue
23 for f in $(find . -type f); do
24 mkdir -p "$base/nix-support/$(dirname $f)"
25 cat $f >>"$base/nix-support/$f"
28 rm -f $base/nix-support/propagated-build-inputs
35 nar-all = pack-all "dumpnar . | xz -9 -e -T $NIX_BUILD_CORES >$out";
36 tar-all = pack-all "XZ_OPT=\"-9 -e -T $NIX_BUILD_CORES\" tar cJf $out --hard-dereference --sort=name --numeric-owner --owner=0 --group=0 --mtime=@1 .";
37 coreutils-big = pkgs.coreutils.override { singleBinary = false; };
38 mkdir = runCommand "mkdir" { coreutils = coreutils-big; } ''
40 cp $coreutils/bin/mkdir $out/bin
43 unpack = nar-all "unpack.nar.xz" (with pkgs; [bash mkdir xz gnutar]) ''
44 rm -rf include lib/*.a lib/i18n lib/bash share
46 bootstrap-tools = tar-all "bootstrap-tools.tar.xz" (
48 # SYNCME: this version number must be synced with the one in default.nix
49 let llvmPackages = llvmPackages_18; in
51 (runCommand "bsdcp" { } "mkdir -p $out/bin; cp ${freebsd.cp}/bin/cp $out/bin/bsdcp")
69 expand-response-params
73 llvmPackages.libcxx.dev
74 llvmPackages.compiler-rt
75 llvmPackages.compiler-rt.dev
76 llvmPackages.clang-unwrapped
77 (freebsd.locales.override { locales = [ "C.UTF-8" ]; })
79 # INSTRUCTIONS FOR GENERATING THE SPURIOUS LIST
81 # - rebuild bootstrap files and update their urls and hashes
82 # - turn on atime on your FreeBSD nix store filesystem
83 # - run nix-collect-garbage on FreeBSD to make it so we rebuild FODs
84 # - build the nixpkgs __bootstrapArchive attribute on FreeBSD
85 # - reboot your FreeBSD system. Otherwise the atimes will simply be wrong because of kernel caching
86 # - run a full build of stdenv on FreeBSD. with -j3, this takes 1h40 on my 20 cpu VM (AMD host)
87 # - use the following to generate a list with access times and filenames
88 # find /nix/store/###-bootstrap-archive -type f | xargs stat | grep -E 'Access: 2|File:' | paste -d ' ' - - | awk '{ print $4 " " $5 " " $6 " " $2 }' | sort -n > atimes
89 # - manually identify the point where files have no longer been accessed after the patching phase
90 # - use your favorite text editor to snip out the time column, the /nix/store/###-bootstrap-archive/ prefix, and the files that have not been used during bootstrap
91 # - turn off atime if it was off before since it will degrade performance
92 # - manually remove bin/strings from the list, since it will be used only during bootstrap
93 # - manually remove all files under include and lib/clang/*/include from the list in order to improve forward compatibility (and since they are very small)
95 ) "xargs rm -f <${./bootstrap-tools-spurious.txt}";
96 build = runCommand "build" { } ''
97 mkdir -p $out/on-server
98 ln -s ${unpack} $out/on-server/unpack.nar.xz
99 ln -s ${bootstrap-tools} $out/on-server/bootstrap-tools.tar.xz