forked from lix-project/lix
5170c5691a
Channels can now advertise a binary cache by creating a file <channel-url>/binary-cache-url. The channel unpacker puts these in its "binary-caches" subdirectory. Thus, the URLS of the binary caches for the channels added by root appear in /nix/var/nix/profiles/per-user/eelco/channels/binary-caches/*. The binary cache substituter reads these and adds them to the list of binary caches.
35 lines
768 B
Nix
35 lines
768 B
Nix
with import <nix/config.nix>;
|
|
|
|
let
|
|
|
|
builder = builtins.toFile "unpack-channel.sh"
|
|
''
|
|
mkdir $out
|
|
cd $out
|
|
${bzip2} -d < $src | ${tar} xf - --warning=no-timestamp
|
|
mv * $out/$channelName
|
|
if [ -n "$binaryCacheURL" ]; then
|
|
mkdir $out/binary-caches
|
|
echo -n "$binaryCacheURL" > $out/binary-caches/$channelName
|
|
fi
|
|
'';
|
|
|
|
in
|
|
|
|
{ name, channelName, src, binaryCacheURL ? "" }:
|
|
|
|
derivation {
|
|
system = builtins.currentSystem;
|
|
builder = shell;
|
|
args = [ "-e" builder ];
|
|
inherit name channelName src binaryCacheURL;
|
|
|
|
PATH = "${nixBinDir}:${coreutils}";
|
|
|
|
# No point in doing this remotely.
|
|
preferLocalBuild = true;
|
|
|
|
# Don't build in a chroot because Nix's dependencies may not be there.
|
|
__noChroot = true;
|
|
}
|