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

40 lines
791 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
2013-05-14 09:10:14 -04:00
xzpat="\.xz\$"
gzpat="\.gz\$"
if [[ "$src" =~ $xzpat ]]; then
${xz} -d < $src | ${tar} xf - ${tarFlags}
2013-07-12 08:06:05 -04:00
elif [[ "$src" =~ $gzpat ]]; then
2013-05-14 09:10:14 -04:00
${gzip} -d < $src | ${tar} xf - ${tarFlags}
else
${bzip2} -d < $src | ${tar} xf - ${tarFlags}
fi
if [ * != $channelName ]; then
mv * $out/$channelName
fi
2012-08-01 16:34:17 -04:00
'';
in
{ name, channelName, src }:
derivation {
system = builtins.currentSystem;
builder = shell;
2012-08-01 16:34:17 -04:00
args = [ "-e" builder ];
inherit name channelName src;
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;
inherit chrootDeps;
}