minimal-bootstrap: remove most uses of builtins.fetchTarball

This commit is contained in:
Emily Trau 2023-04-25 18:24:17 +10:00
parent c8ecd8ed57
commit 71dcd60557
6 changed files with 39 additions and 15 deletions

View file

@ -10,7 +10,7 @@ lib.makeScope newScope (self: with self; {
inherit system;
};
inherit (callPackage ./stage0-posix { }) kaem m2libc mescc-tools mescc-tools-extra writeTextFile writeText runCommand;
inherit (callPackage ./stage0-posix { }) kaem m2libc mescc-tools mescc-tools-extra writeTextFile writeText runCommand fetchtarball;
mes = callPackage ./mes { };

View file

@ -1,5 +1,6 @@
{ runCommand
, fetchurl
, fetchtarball
, writeText
, m2libc
, mescc-tools
@ -14,10 +15,10 @@ let
};
nyaccVersion = "1.00.2";
nyaccModules = builtins.fetchTarball {
url = "http://download.savannah.nongnu.org/releases/nyacc/nyacc-${nyaccVersion}.tar.gz";
sha256 = "06rg6pn4k8smyydwls1abc9h702cri3z65ac9gvc4rxxklpynslk";
};
nyaccModules = (fetchtarball {
url = "mirror://savannah/nyacc/nyacc-${nyaccVersion}.tar.gz";
sha256 = "065ksalfllbdrzl12dz9d9dcxrv97wqxblslngsc6kajvnvlyvpk";
}) + "/nyacc-${nyaccVersion}";
in
# Adapted from https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/mes-0.24.2/mes-0.24.2.kaem
(runCommand "mes-${version}" {} ''

View file

@ -40,7 +40,7 @@ lib.makeScope newScope (self: with self; {
mescc-tools-extra = callPackage ./mescc-tools-extra { };
inherit (callPackage ./utils.nix { }) writeTextFile writeText runCommand;
inherit (callPackage ./utils.nix { }) writeTextFile writeText runCommand fetchtarball;
# Now that mescc-tools-extra is available we can install kaem at /bin/kaem
# to make it findable in environments

View file

@ -1,6 +1,7 @@
{ lib
, system
, mkKaemDerivation0
, fetchurl
, kaem
, mescc-tools
, mescc-tools-extra
@ -48,4 +49,25 @@ rec {
PATH = lib.makeBinPath ((env.nativeBuildInputs or []) ++ [ kaem mescc-tools mescc-tools-extra ]);
} // (builtins.removeAttrs env [ "nativeBuildInputs" ]));
# Fetch and unpack a .tar.gz file. Does not strip top-level directory
fetchtarball =
{ url
# Unlike fetchzip, this hash is of the tarball and not the decompressed output
, sha256
, name ? baseNameOf (toString url)
, postFetch ? ""
}:
let
tarball = fetchurl { inherit url sha256; };
in
runCommand name {} ''
cd ''${TMP}
ungz --file ${tarball} --output tmp.tar
mkdir ''${out}
cd ''${out}
untar --file ''${TMP}/tmp.tar
${postFetch}
'';
}

View file

@ -3,17 +3,18 @@
{ lib
, runCommand
, fetchurl
, fetchtarball
, mes
, buildTinyccN
, unified-libc
}:
let
version = "unstable-2023-04-20";
src = builtins.fetchTarball {
url = "https://gitlab.com/janneke/tinycc/-/archive/80114c4da6b17fbaabb399cc29f427e368309bc8/tinycc-80114c4da6b17fbaabb399cc29f427e368309bc8.tar.gz";
sha256 = "1xhn5qgph32dlxp3fkl4d78f21hvlb2r5dpxvh295x8spkbmbrwp";
};
rev = "80114c4da6b17fbaabb399cc29f427e368309bc8";
src = (fetchtarball {
url = "https://gitlab.com/janneke/tinycc/-/archive/${rev}/tinycc-${rev}.tar.gz";
sha256 = "1a0cw9a62qc76qqn5sjmp3xrbbvsz2dxrw21lrnx9q0s74mwaxbq";
}) + "/tinycc-${rev}";
mes-tcc = runCommand "mes-tcc-${version}" {} ''
# Create config.h

View file

@ -1,15 +1,15 @@
{ lib
, runCommand
, fetchurl
, fetchtarball
, callPackage
, mes
}:
let
version = "unstable-2023-04-20";
src = builtins.fetchTarball {
src = (fetchtarball {
url = "https://repo.or.cz/tinycc.git/snapshot/86f3d8e33105435946383aee52487b5ddf918140.tar.gz";
sha256 = "009xvbiskg2ims2xag8w78yksnrqpm33asq5arxaph05hd59yss0";
};
sha256 = "11idrvbwfgj1d03crv994mpbbbyg63j1k64lw1gjy7mkiifw2xap";
}) + "/tinycc-86f3d8e";
unified-libc = runCommand "mes-unified-libc.c" {} ''
cd ${mes}${mes.mesPrefix}/lib