diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index c2d78e1e079e..5caa3759a537 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -52,18 +52,18 @@ lib.makeScope gnutar = gnutar-musl; }; - coreutils = callPackage ./coreutils { tinycc = tinycc-mes; }; - coreutils-musl = callPackage ./coreutils/musl.nix { - bash = bash_2_05; - tinycc = tinycc-musl; - gnumake = gnumake-musl; - gnutar = gnutar-musl; - }; - coreutils-static = callPackage ./coreutils/static.nix { - gcc = gcc-latest; - gnumake = gnumake-musl; - gnutar = gnutar-latest; - }; + coreutils = callPackage ./coreutils { tinycc = tinycc-mes; }; + coreutils-musl = callPackage ./coreutils/musl.nix { + bash = bash_2_05; + tinycc = tinycc-musl; + gnumake = gnumake-musl; + gnutar = gnutar-musl; + }; + coreutils-static = callPackage ./coreutils/static.nix { + gcc = gcc-latest; + gnumake = gnumake-musl; + gnutar = gnutar-latest; + }; diffutils = callPackage ./diffutils { bash = bash_2_05; @@ -155,17 +155,23 @@ lib.makeScope gnused = gnused-mes; }; + # FIXME: better package naming scheme + gnutar-latest = callPackage ./gnutar/latest.nix { + gcc = gcc46; + gnumake = gnumake-musl; + gnutarBoot = gnutar-musl; + }; + gnutar-musl = callPackage ./gnutar/musl.nix { bash = bash_2_05; tinycc = tinycc-musl; gnused = gnused-mes; }; - # FIXME: better package naming scheme - gnutar-latest = callPackage ./gnutar/latest.nix { - gcc = gcc46; + gnutar-static = callPackage ./gnutar/static.nix { + gcc = gcc-latest; gnumake = gnumake-musl; - gnutarBoot = gnutar-musl; + gnutarBoot = gnutar-latest; }; gzip = callPackage ./gzip { @@ -239,34 +245,36 @@ lib.makeScope inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText; - test = kaem.runCommand "minimal-bootstrap-test" {} '' - echo ${bash.tests.get-version} - echo ${bash_2_05.tests.get-version} - echo ${binutils.tests.get-version} - echo ${bzip2.tests.get-version} - echo ${coreutils-musl.tests.get-version} - echo ${coreutils-static.tests.get-version} - echo ${diffutils.tests.get-version} - echo ${findutils.tests.get-version} - echo ${gawk-mes.tests.get-version} - echo ${gawk.tests.get-version} - echo ${gcc46.tests.get-version} - echo ${gcc46-cxx.tests.hello-world} - echo ${gcc8.tests.hello-world} - echo ${gcc-latest.tests.hello-world} - echo ${gnugrep.tests.get-version} - echo ${gnused.tests.get-version} - echo ${gnused-mes.tests.get-version} - echo ${gnutar.tests.get-version} - echo ${gnutar-musl.tests.get-version} - echo ${gnutar-latest.tests.get-version} - echo ${gzip.tests.get-version} - echo ${heirloom.tests.get-version} - echo ${mes.compiler.tests.get-version} - echo ${musl.tests.hello-world} - echo ${tinycc-mes.compiler.tests.chain} - echo ${tinycc-musl.compiler.tests.hello-world} - echo ${xz.tests.get-version} - mkdir ''${out} - ''; - }) + test = kaem.runCommand "minimal-bootstrap-test" { } '' + echo ${bash.tests.get-version} + echo ${bash_2_05.tests.get-version} + echo ${binutils.tests.get-version} + echo ${bzip2.tests.get-version} + echo ${coreutils-musl.tests.get-version} + echo ${coreutils-static.tests.get-version} + echo ${diffutils.tests.get-version} + echo ${findutils.tests.get-version} + echo ${gawk-mes.tests.get-version} + echo ${gawk.tests.get-version} + echo ${gcc46.tests.get-version} + echo ${gcc46-cxx.tests.hello-world} + echo ${gcc8.tests.hello-world} + echo ${gcc-latest.tests.hello-world} + echo ${gnugrep.tests.get-version} + echo ${gnused.tests.get-version} + echo ${gnused-mes.tests.get-version} + echo ${gnutar.tests.get-version} + echo ${gnutar-latest.tests.get-version} + echo ${gnutar-musl.tests.get-version} + echo ${gnutar-static.tests.get-version} + echo ${gzip.tests.get-version} + echo ${heirloom.tests.get-version} + echo ${mes.compiler.tests.get-version} + echo ${musl.tests.hello-world} + echo ${tinycc-mes.compiler.tests.chain} + echo ${tinycc-musl.compiler.tests.hello-world} + echo ${xz.tests.get-version} + mkdir ''${out} + ''; + } + ) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gnutar/common.nix b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/common.nix new file mode 100644 index 000000000000..7301d47a01de --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/common.nix @@ -0,0 +1,11 @@ +{ lib }: +{ + meta = { + description = "GNU implementation of the `tar' archiver"; + homepage = "https://www.gnu.org/software/tar"; + license = lib.licenses.gpl3Plus; + teams = [ lib.teams.minimal-bootstrap ]; + mainProgram = "tar"; + platforms = lib.platforms.unix; + }; +} diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gnutar/latest.nix b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/latest.nix index 094e1c1250d1..c52636ca0273 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gnutar/latest.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/latest.nix @@ -15,6 +15,7 @@ gnutarBoot, }: let + inherit (import ./common.nix { inherit lib; }) meta; pname = "gnutar"; version = "1.35"; @@ -25,7 +26,7 @@ let in bash.runCommand "${pname}-${version}" { - inherit pname version; + inherit pname version meta; nativeBuildInputs = [ gcc @@ -45,15 +46,6 @@ bash.runCommand "${pname}-${version}" ${result}/bin/tar --version mkdir $out ''; - - meta = { - description = "GNU implementation of the `tar' archiver"; - homepage = "https://www.gnu.org/software/tar"; - license = lib.licenses.gpl3Plus; - teams = [ lib.teams.minimal-bootstrap ]; - mainProgram = "tar"; - platforms = lib.platforms.unix; - }; } '' # Unpack diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gnutar/mes.nix b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/mes.nix index 96df8b509185..4cad3b1abf14 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gnutar/mes.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/mes.nix @@ -10,6 +10,7 @@ gnugrep, }: let + inherit (import ./common.nix { inherit lib; }) meta; pname = "gnutar"; # >= 1.13 is incompatible with mes-libc version = "1.12"; @@ -21,7 +22,7 @@ let in bash.runCommand "${pname}-${version}" { - inherit pname version; + inherit pname version meta; nativeBuildInputs = [ tinycc.compiler @@ -36,15 +37,6 @@ bash.runCommand "${pname}-${version}" ${result}/bin/tar --version mkdir $out ''; - - meta = { - description = "GNU implementation of the `tar' archiver"; - homepage = "https://www.gnu.org/software/tar"; - license = lib.licenses.gpl3Plus; - teams = [ lib.teams.minimal-bootstrap ]; - mainProgram = "tar"; - platforms = lib.platforms.unix; - }; } '' # Unpack diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gnutar/musl.nix b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/musl.nix index 97900363d6c7..08d77ab5d1ae 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gnutar/musl.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/musl.nix @@ -12,6 +12,7 @@ let # gnutar with musl preserves modify times, allowing make to not try # rebuilding pregenerated files + inherit (import ./common.nix { inherit lib; }) meta; pname = "gnutar-musl"; version = "1.12"; @@ -22,7 +23,7 @@ let in bash.runCommand "${pname}-${version}" { - inherit pname version; + inherit pname version meta; nativeBuildInputs = [ tinycc.compiler @@ -37,15 +38,6 @@ bash.runCommand "${pname}-${version}" ${result}/bin/tar --version mkdir $out ''; - - meta = { - description = "GNU implementation of the `tar' archiver"; - homepage = "https://www.gnu.org/software/tar"; - license = lib.licenses.gpl3Plus; - teams = [ lib.teams.minimal-bootstrap ]; - mainProgram = "tar"; - platforms = lib.platforms.unix; - }; } '' # Unpack diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gnutar/static.nix b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/static.nix new file mode 100644 index 000000000000..ec325ad8895d --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/static.nix @@ -0,0 +1,72 @@ +{ + lib, + buildPlatform, + hostPlatform, + fetchurl, + bash, + gcc, + musl, + binutils, + gnumake, + gnused, + gnugrep, + gawk, + diffutils, + findutils, + gnutarBoot, + gzip, +}: +let + inherit (import ./common.nix { inherit lib; }) meta; + pname = "gnutar-static"; + version = "1.35"; + + src = fetchurl { + url = "mirror://gnu/tar/tar-${version}.tar.gz"; + hash = "sha256-FNVeMgY+qVJuBX+/Nfyr1TN452l4fv95GcN1WwLStX4="; + }; +in +bash.runCommand "${pname}-${version}" + { + inherit pname version meta; + + nativeBuildInputs = [ + gcc + musl + binutils + gnumake + gnused + gnugrep + gawk + diffutils + findutils + gnutarBoot + gzip + ]; + + passthru.tests.get-version = + result: + bash.runCommand "${pname}-get-version-${version}" { } '' + ${result}/bin/tar --version + mkdir $out + ''; + } + '' + # Unpack + tar xzf ${src} + cd tar-${version} + + # Configure + bash ./configure \ + --prefix=$out \ + --build=${buildPlatform.config} \ + --host=${hostPlatform.config} \ + CC=musl-gcc \ + CFLAGS=-static + + # Build + make -j $NIX_BUILD_CORES + + # Install + make -j $NIX_BUILD_CORES install + ''