1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00
nix/corepkgs/unpack-channel.nix

40 lines
884 B
Nix
Raw Normal View History

with import <nix/config.nix>;
2012-08-01 16:34:17 -04:00
let
builder = builtins.toFile "unpack-channel.sh"
''
mkdir $out
cd $out
pat="\.xz\$"
if [[ "$src" =~ $pat ]]; then
${xz} -d < $src | ${tar} xf - ${tarFlags}
else
${bzip2} -d < $src | ${tar} xf - ${tarFlags}
fi
2012-08-01 16:34:17 -04:00
mv * $out/$channelName
if [ -n "$binaryCacheURL" ]; then
mkdir $out/binary-caches
echo -n "$binaryCacheURL" > $out/binary-caches/$channelName
fi
2012-08-01 16:34:17 -04:00
'';
in
{ name, channelName, src, binaryCacheURL ? "" }:
derivation {
system = builtins.currentSystem;
builder = shell;
2012-08-01 16:34:17 -04:00
args = [ "-e" builder ];
inherit name channelName src binaryCacheURL;
2012-08-01 16:34:17 -04:00
PATH = "${nixBinDir}:${coreutils}";
2012-08-01 16:34:17 -04:00
# No point in doing this remotely.
preferLocalBuild = true;
# Don't build in a chroot because Nix's dependencies may not be there.
__noChroot = true;
}