diff --git a/pkgs/os-specific/linux/minimal-bootstrap/mes/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/mes/default.nix index 02d069b1ece9..d40014b8f70e 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/mes/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/mes/default.nix @@ -5,7 +5,8 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -{ runCommand +{ lib +, runCommand , fetchurl , fetchtarball , writeText @@ -27,7 +28,17 @@ let sha256 = "065ksalfllbdrzl12dz9d9dcxrv97wqxblslngsc6kajvnvlyvpk"; }) + "/nyacc-${nyaccVersion}"; in -(runCommand "mes-${version}" {} '' +(runCommand "mes-${version}" { + pname = "mes"; + inherit version; + meta = with lib; { + description = "Scheme interpreter and C compiler for bootstrapping"; + homepage = "https://www.gnu.org/software/mes"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ emilytrau ]; + platforms = [ "i686-linux" ]; + }; +} '' # Unpack source ungz --file ${src} --output mes.tar mkdir ''${out} ''${out}/bin ''${out}/share diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/default.nix index 99df9d706191..212e224c8b89 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/default.nix @@ -28,12 +28,11 @@ lib.makeScope newScope (self: with self; { inherit (callPackage ./stage0-posix-x86.nix { }) blood-elf-0 hex2 kaem-unwrapped M1 M2; mkKaemDerivation0 = args@{ - name, script, ... }: - derivation ({ - inherit system name; + derivationWithMeta ({ + inherit system; builder = kaem-unwrapped; args = [ "--verbose" @@ -47,24 +46,32 @@ lib.makeScope newScope (self: with self; { BLOOD_FLAG = " "; BASE_ADDRESS = "0x8048000"; ENDIAN_FLAG = "--little-endian"; - } // (builtins.removeAttrs args [ "name" "script" ])); + } // (builtins.removeAttrs args [ "script" ])); mescc-tools = callPackage ./mescc-tools { }; mescc-tools-extra = callPackage ./mescc-tools-extra { }; - inherit (callPackage ./utils.nix { }) writeTextFile writeText runCommand fetchtarball; + inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText runCommand fetchtarball; # Now that mescc-tools-extra is available we can install kaem at /bin/kaem # to make it findable in environments kaem = mkKaemDerivation0 { - name = "kaem-${version}"; + pname = "kaem"; script = builtins.toFile "kaem-wrapper.kaem" '' mkdir -p ''${out}/bin cp ''${kaem-unwrapped} ''${out}/bin/kaem chmod 555 ''${out}/bin/kaem ''; PATH = lib.makeBinPath [ mescc-tools-extra ]; - inherit kaem-unwrapped; + inherit version kaem-unwrapped; + + meta = with lib; { + description = "Minimal build tool for running scripts on systems that lack any shell"; + homepage = "https://github.com/oriansj/mescc-tools"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ emilytrau ]; + platforms = [ "i686-linux" ]; + }; }; }) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix index 37a387e26e89..84d4823a4afd 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix @@ -1,22 +1,23 @@ -{ system +{ lib +, derivationWithMeta +, system , src , version }: -let - throwSystem = throw "Unsupported system: ${system}"; - arch = { - i686-linux = "x86"; - }.${system} or throwSystem; - - seed = "${src}/bootstrap-seeds/POSIX/${arch}/hex0-seed"; - source = "${src}/bootstrap-seeds/POSIX/${arch}/hex0_${arch}.hex0"; -in -derivation { - inherit system; - name = "hex0-${version}"; - builder = seed; +derivationWithMeta { + inherit system version; + pname = "hex0"; + builder = "${src}/bootstrap-seeds/POSIX/x86/hex0-seed"; args = [ - source + "${src}/bootstrap-seeds/POSIX/x86/hex0_x86.hex0" (placeholder "out") ]; + + meta = with lib; { + description = "Minimal assembler for bootstrapping"; + homepage = "https://github.com/oriansj/stage0-posix"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ emilytrau ]; + platforms = [ "i686-linux" ]; + }; } diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/kaem-minimal.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/kaem-minimal.nix index 0e3fe9f6b819..9561226ea3f3 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/kaem-minimal.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/kaem-minimal.nix @@ -1,23 +1,25 @@ -{ system +{ lib +, derivationWithMeta +, system , src , hex0 , version }: -let - throwSystem = throw "Unsupported system: ${system}"; - arch = { - i686-linux = "x86"; - }.${system} or throwSystem; - - source = "${src}/bootstrap-seeds/POSIX/${arch}/kaem-minimal.hex0"; -in -derivation { - inherit system; - name = "kaem-minimal-${version}"; +derivationWithMeta { + inherit system version; + pname = "kaem-minimal"; builder = hex0; args = [ - source + "${src}/bootstrap-seeds/POSIX/x86/kaem-minimal.hex0" (placeholder "out") ]; + + meta = with lib; { + description = "First stage minimal scriptable build tool for bootstrapping"; + homepage = "https://github.com/oriansj/stage0-posix"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ emilytrau ]; + platforms = [ "i686-linux" ]; + }; } diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-extra/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-extra/default.nix index fdb080a33113..adde0428f238 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-extra/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-extra/default.nix @@ -1,11 +1,19 @@ -{ mkKaemDerivation0 +{ lib +, mkKaemDerivation0 , src , mescc-tools , version }: mkKaemDerivation0 { - name = "mescc-tools-extra-${version}"; + inherit version src mescc-tools; + pname = "mescc-tools-extra"; script = ./build.kaem; - inherit src mescc-tools; + meta = with lib; { + description = "Collection of tools written for use in bootstrapping"; + homepage = "https://github.com/oriansj/mescc-tools-extra"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ emilytrau ]; + platforms = [ "i686-linux" ]; + }; } diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/default.nix index d2b97bff862f..6ec55941890b 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/default.nix @@ -13,7 +13,7 @@ let # We need a few tools from mescc-tools-extra to assemble the output folder buildMesccToolsExtraUtil = name: mkKaemDerivation0 { - name = "mescc-tools-extra-${name}-${version}"; + pname = "mescc-tools-extra-${name}"; script = builtins.toFile "build-${name}.kaem" '' ''${M2} --architecture ''${ARCH} \ -f ''${m2libc}/sys/types.h \ @@ -48,7 +48,7 @@ let --base-address ''${BASE_ADDRESS} \ -o ''${out} ''; - inherit M1 M2 blood-elf-0 hex2 m2libc src; + inherit version M1 M2 blood-elf-0 hex2 m2libc src; }; mkdir = buildMesccToolsExtraUtil "mkdir"; cp = buildMesccToolsExtraUtil "cp"; @@ -56,8 +56,15 @@ let replace = buildMesccToolsExtraUtil "replace"; in mkKaemDerivation0 { - name = "mescc-tools-${version}"; + pname = "mescc-tools"; script = ./build.kaem; + inherit version M1 M2 blood-elf-0 hex2 mkdir cp chmod replace m2libc src; - inherit M1 M2 blood-elf-0 hex2 mkdir cp chmod replace m2libc src; + meta = with lib; { + description = "Collection of tools written for use in bootstrapping"; + homepage = "https://github.com/oriansj/mescc-tools"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ emilytrau ]; + platforms = [ "i686-linux" ]; + }; } diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/stage0-posix-x86.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/stage0-posix-x86.nix index 917518958f41..ab831cb5ac7e 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/stage0-posix-x86.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/stage0-posix-x86.nix @@ -27,7 +27,9 @@ # Warning all binaries prior to the use of blood-elf will not be readable by # Objdump, you may need to use ndism or gdb to view the assembly in the binary. -{ system +{ lib +, derivationWithMeta +, system , hex0 , m2libc , src @@ -36,10 +38,18 @@ rec { out = placeholder "out"; - run = pname: builder: args: derivation { - inherit system builder args; - name = "${pname}-${version}"; - }; + run = pname: builder: args: + derivationWithMeta { + inherit system pname version builder args; + + meta = with lib; { + description = "Collection of tools written for use in bootstrapping"; + homepage = "https://github.com/oriansj/stage0-posix"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ emilytrau ]; + platforms = [ "i686-linux" ]; + }; + }; ################################ # Phase-1 Build hex1 from hex0 # diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/utils.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/utils.nix index b24b8ffdf5c0..e66cd5b5ad46 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/utils.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/utils.nix @@ -1,5 +1,7 @@ { lib +, stdenv , system +, callPackage , mkKaemDerivation0 , fetchurl , kaem @@ -7,7 +9,24 @@ , mescc-tools-extra }: +let + checkMeta = callPackage ../../../../stdenv/generic/check-meta.nix { + inherit (stdenv) hostPlatform; + }; +in rec { + derivationWithMeta = attrs: + let + validity = checkMeta { inherit attrs; }; + inherit (validity) meta; + in + lib.extendDerivation + validity.handled + { inherit meta; } + (derivation ({ + inherit (meta) name; + } // (builtins.removeAttrs attrs [ "meta" ]))); + writeTextFile = { name # the name of the derivation , text @@ -36,7 +55,7 @@ rec { writeText = name: text: writeTextFile {inherit name text;}; runCommand = name: env: buildCommand: - derivation ({ + derivationWithMeta ({ inherit name system; builder = "${kaem}/bin/kaem"; diff --git a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/bootstrappable.nix b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/bootstrappable.nix index 6fca288148d2..c218e7432271 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/bootstrappable.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/bootstrappable.nix @@ -22,6 +22,14 @@ let sha256 = "1a0cw9a62qc76qqn5sjmp3xrbbvsz2dxrw21lrnx9q0s74mwaxbq"; }) + "/tinycc-${rev}"; + meta = with lib; { + description = "Tiny C Compiler's bootstrappable fork"; + homepage = "https://gitlab.com/janneke/tinycc"; + license = licenses.lgpl21Only; + maintainers = with maintainers; [ emilytrau ]; + platforms = [ "i686-linux" ]; + }; + mes-tcc = runCommand "mes-tcc-${version}" {} '' # Create config.h catm config.h @@ -89,7 +97,7 @@ let boot0-tcc = buildTinyccN { pname = "boot0-tcc"; - inherit src version; + inherit src version meta; prev = mes-tcc; buildOptions = [ "-D HAVE_LONG_LONG_STUB=1" @@ -102,7 +110,7 @@ let boot1-tcc = buildTinyccN { pname = "boot1-tcc"; - inherit src version; + inherit src version meta; prev = boot0-tcc; buildOptions = [ "-D HAVE_BITFIELD=1" @@ -116,7 +124,7 @@ let boot2-tcc = buildTinyccN { pname = "boot2-tcc"; - inherit src version; + inherit src version meta; prev = boot1-tcc; buildOptions = [ "-D HAVE_BITFIELD=1" @@ -132,7 +140,7 @@ let boot3-tcc = buildTinyccN { pname = "boot3-tcc"; - inherit src version; + inherit src version meta; prev = boot2-tcc; buildOptions = [ "-D HAVE_BITFIELD=1" @@ -148,7 +156,7 @@ let boot4-tcc = buildTinyccN { pname = "boot4-tcc"; - inherit src version; + inherit src version meta; prev = boot3-tcc; buildOptions = [ "-D HAVE_BITFIELD=1" diff --git a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/default.nix index 34af572db155..12e876ec4362 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/default.nix @@ -17,23 +17,34 @@ let sha256 = "11idrvbwfgj1d03crv994mpbbbyg63j1k64lw1gjy7mkiifw2xap"; }) + "/tinycc-86f3d8e"; + meta = with lib; { + description = "Small, fast, and embeddable C compiler and interpreter"; + homepage = "https://repo.or.cz/w/tinycc.git"; + license = licenses.lgpl21Only; + maintainers = with maintainers; [ emilytrau ]; + platforms = [ "i686-linux" ]; + }; + mes-libc = runCommand "mes-libc-${version}.c" { MES_PREFIX = "${mes}${mes.mesPrefix}"; } '' kaem --verbose --strict --file ${./mes-libc.kaem} ''; buildTinyccN = { pname, - src, version, + src, prev, buildOptions, libtccBuildOptions, + meta }: let options = lib.strings.concatStringsSep " " buildOptions; libtccOptions = lib.strings.concatStringsSep " " libtccBuildOptions; in - runCommand "${pname}-${version}" {} '' + runCommand "${pname}-${version}" { + inherit pname version meta; + } '' catm config.h mkdir -p ''${out}/bin ''${out}/lib ${prev}/bin/tcc \ @@ -87,7 +98,7 @@ let boot5-tcc = buildTinyccN { pname = "boot5-tcc"; - inherit src version; + inherit src version meta; prev = boot4-tcc; buildOptions = [ "-D HAVE_BITFIELD=1" @@ -109,7 +120,7 @@ let tinycc-with-mes-libc = buildTinyccN { pname = "tinycc-with-mes-libc"; - inherit src version; + inherit src version meta; prev = boot5-tcc; buildOptions = [ "-std=c99"