nix-instantiate can be used to replace nix-instantiate + nix-build

This commit is contained in:
Solene Rapenne 2022-09-01 09:22:23 +02:00
parent 0ab366d1d6
commit 33bcb883bf
1 changed files with 5 additions and 8 deletions

View File

@ -14,20 +14,17 @@ my $return;
foreach my $val (@data) {
if ( ! -f "distfiles/$val->{name}" ) {
#print "Fetching $val->{name} from $val->{url} with patch=$val->{isPatch} $val->{type} $val->{hash}\n";
print Dumper $val;
if ($val->{isPatch} eq 1) {
$return = `nix-instantiate '<nixpkgs>' -A fetchpatch --argstr url "$val->{url}" --argstr name "$val->{name}" --argstr sha256 "$val->{hash}"`;
$return = `nix-build -o "distfiles/$val->{name}" $return`;
#print Dumper $val;
if (defined $val->{isPatch} && $val->{isPatch} eq 1) {
$return = `nix-build -o "distfiles/$val->{name}" '<nixpkgs>' -A fetchpatch --argstr url "$val->{url}" --argstr name "$val->{name}" --argstr sha256 "$val->{hash}"`;
print $return;
} else {
# we known the checksum we expect
if (defined $val->{type}) {
$return = `nix-instantiate '<nixpkgs>' -A fetchurl --argstr url "$val->{url}" --argstr "$val->{type}" "$val->{hash}"`;
$return = `nix-build -o "distfiles/$val->{name}" $return`;
$return = `nix-build -o "distfiles/$val->{name}" '<nixpkgs>' -A fetchurl --argstr url "$val->{url}" --argstr "$val->{type}" "$val->{hash}"`;
print $return;
} else {
$return = `nix-instantiate '<nixpkgs>' -A fetchurl --argstr url "$val->{url}" --argstr sha256 "$val->{hash}"`;
$return = `nix-build -o "distfiles/$val->{name}" $return`;
$return = `nix-build -o "distfiles/$val->{name}" '<nixpkgs>' -A fetchurl --argstr url "$val->{url}" --argstr sha256 "$val->{hash}"`;
print $return;
}
}