minimal-bootstrap: remove confusing fetchtarball abstraction

This commit is contained in:
Emily Trau 2023-04-30 11:46:22 +10:00
parent 760ab35487
commit a4caff6ea4
5 changed files with 20 additions and 28 deletions

View file

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

View file

@ -32,5 +32,5 @@ lib.makeScope newScope (self: with self; {
mescc-tools-extra = callPackage ./mescc-tools-extra { };
inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText runCommand fetchtarball;
inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText runCommand;
})

View file

@ -80,24 +80,4 @@ 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

@ -9,7 +9,7 @@
{ lib
, runCommand
, fetchtarball
, fetchurl
, mes
, buildTinyccN
, mes-libc
@ -17,10 +17,16 @@
let
version = "unstable-2023-04-20";
rev = "80114c4da6b17fbaabb399cc29f427e368309bc8";
src = (fetchtarball {
tarball = fetchurl {
url = "https://gitlab.com/janneke/tinycc/-/archive/${rev}/tinycc-${rev}.tar.gz";
sha256 = "1a0cw9a62qc76qqn5sjmp3xrbbvsz2dxrw21lrnx9q0s74mwaxbq";
}) + "/tinycc-${rev}";
};
src = (runCommand "tinycc-bootstrappable-${version}-source" {} ''
ungz --file ${tarball} --output tinycc.tar
mkdir -p ''${out}
cd ''${out}
untar --file ''${NIX_BUILD_TOP}/tinycc.tar
'') + "/tinycc-${rev}";
meta = with lib; {
description = "Tiny C Compiler's bootstrappable fork";

View file

@ -6,16 +6,22 @@
{ lib
, runCommand
, fetchtarball
, fetchurl
, callPackage
, mes
}:
let
version = "unstable-2023-04-20";
src = (fetchtarball {
tarball = fetchurl {
url = "https://repo.or.cz/tinycc.git/snapshot/86f3d8e33105435946383aee52487b5ddf918140.tar.gz";
sha256 = "11idrvbwfgj1d03crv994mpbbbyg63j1k64lw1gjy7mkiifw2xap";
}) + "/tinycc-86f3d8e";
};
src = (runCommand "tinycc-${version}-source" {} ''
ungz --file ${tarball} --output tinycc.tar
mkdir -p ''${out}
cd ''${out}
untar --file ''${NIX_BUILD_TOP}/tinycc.tar
'') + "/tinycc-86f3d8e";
meta = with lib; {
description = "Small, fast, and embeddable C compiler and interpreter";