feat: customizable gnu mirror, remove inputs for monorepo, potluck base

This commit is contained in:
Jake Hamilton 2024-06-11 04:39:26 -07:00
parent 284b8de0d5
commit f24f0876a9
Signed by: jakehamilton
GPG key ID: 9762169A1B35EA68
58 changed files with 561 additions and 106 deletions

View file

@ -1,22 +1,6 @@
{
"nodes": {
"lib": {
"locked": {
"lastModified": 1,
"narHash": "sha256-vaPypHCYtWP6e0APNsV3ttoW9D2PlL2WpMytd6LdOmk=",
"path": "../lib",
"type": "path"
},
"original": {
"path": "../lib",
"type": "path"
}
},
"root": {
"inputs": {
"lib": "lib"
}
}
"root": {}
},
"root": "root",
"version": 7

View file

@ -2,13 +2,16 @@
description = "A set of foundational packages required for bootstrapping a larger package set.";
inputs = {
lib = {
url = "path:../lib";
};
# TODO: When this project is moved to its own repository we will want to add
# inputs for the relevant dependencies.
# lib = {
# url = "path:../lib";
# };
};
outputs = inputs: let
inherit (inputs.lib) lib;
# inherit (inputs.lib) lib;
lib = import ./../lib;
modules = import ./src;

View file

@ -4,6 +4,7 @@ let
builderFileText = ./builders/file/text;
builderKaem = ./builders/kaem;
builderRaw = ./builders/raw;
mirrors = ./mirrors;
exports = ./exports;
platform = ./platform;
stage0 = ./stages/stage0;

View file

@ -0,0 +1,9 @@
{lib}: {
options.aux.mirrors = {
gnu = lib.options.create {
type = lib.types.string;
default.value = "https://ftp.gnu.org/gnu";
description = "The GNU mirror to use";
};
};
}

View file

@ -57,7 +57,7 @@ in {
version = "2.05b";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/bash/bash-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/bash/bash-${cfg.version}.tar.gz";
sha256 = "1r1z2qdw3rz668nxrzwa14vk2zcn00hw7mpjn384picck49d80xs";
};

View file

@ -68,7 +68,7 @@ in {
version = "5.2.15";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/bash/bash-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/bash/bash-${cfg.version}.tar.gz";
sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk";
};

View file

@ -58,7 +58,7 @@ in {
version = "2.41";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/binutils/binutils-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/binutils/binutils-${cfg.version}.tar.xz";
sha256 = "rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA=";
};

View file

@ -58,7 +58,7 @@ in {
version = "3.8.2";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/bison/bison-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/bison/bison-${cfg.version}.tar.xz";
sha256 = "m7oCFMz38QecXVkhAEUie89hlRmEDr+oDNOEnP9aW/I=";
};

View file

@ -30,7 +30,7 @@ in {
version = "5.0";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/coreutils/coreutils-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/coreutils/coreutils-${cfg.version}.tar.gz";
sha256 = "10wq6k66i8adr4k08p0xmg87ff4ypiazvwzlmi7myib27xgffz62";
};

View file

@ -62,7 +62,7 @@ in {
version = "9.4";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/coreutils/coreutils-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/coreutils/coreutils-${cfg.version}.tar.gz";
sha256 = "X2ANkJOXOwr+JTk9m8GMRPIjJlf0yg2V6jHHAutmtzk=";
};

View file

@ -58,7 +58,7 @@ in {
version = "3.8";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/diffutils/diffutils-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/diffutils/diffutils-${cfg.version}.tar.xz";
sha256 = "pr3X0bMSZtEcT03mwbdI1GB6sCMa9RiPwlM9CuJDj+w=";
};

View file

@ -58,7 +58,7 @@ in {
version = "4.9.0";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/findutils/findutils-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/findutils/findutils-${cfg.version}.tar.xz";
sha256 = "or+4wJ1DZ3DtxZ9Q+kg+eFsWGjt7nVR1c8sIBl/UYv4=";
};

View file

@ -31,7 +31,7 @@ in {
version = "3.0.6";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gawk/gawk-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/gawk/gawk-${cfg.version}.tar.gz";
sha256 = "1z4bibjm7ldvjwq3hmyifyb429rs2d9bdwkvs0r171vv1khpdwmb";
};

View file

@ -68,7 +68,7 @@ in {
version = "5.2.2";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gawk/gawk-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/gawk/gawk-${cfg.version}.tar.gz";
sha256 = "lFrvfM/xAfILIqEIArwAXplKsrjqPnJMwaGXxi9B9lA=";
};

View file

@ -118,14 +118,14 @@ in {
version = "13.2.0";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gcc/gcc-${cfg.version}/gcc-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/gcc/gcc-${cfg.version}/gcc-${cfg.version}.tar.xz";
sha256 = "4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o=";
};
gmp = {
version = "6.3.0";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gmp/gmp-${cfg.gmp.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/gmp/gmp-${cfg.gmp.version}.tar.xz";
sha256 = "o8K4AgG4nmhhb0rTC8Zq7kknw85Q4zkpyoGdXENTiJg=";
};
};
@ -133,7 +133,7 @@ in {
mpfr = {
version = "4.2.1";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/mpfr/mpfr-${cfg.mpfr.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/mpfr/mpfr-${cfg.mpfr.version}.tar.xz";
sha256 = "J3gHNTpnJpeJlpRa8T5Sgp46vXqaW3+yeTiU4Y8fy7I=";
};
};
@ -141,7 +141,7 @@ in {
mpc = {
version = "1.3.1";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/mpc/mpc-${cfg.mpc.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/mpc/mpc-${cfg.mpc.version}.tar.gz";
sha256 = "q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg=";
};
};

View file

@ -74,13 +74,13 @@ in {
version = "4.6.4";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gcc/gcc-${cfg.version}/gcc-core-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/gcc/gcc-${cfg.version}/gcc-core-${cfg.version}.tar.gz";
sha256 = "173kdb188qg79pcz073cj9967rs2vzanyjdjyxy9v0xb0p5sad75";
};
cc = {
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gcc/gcc-${cfg.version}/gcc-g++-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/gcc/gcc-${cfg.version}/gcc-g++-${cfg.version}.tar.gz";
sha256 = "1fqqk5zkmdg4vmqzdmip9i42q6b82i3f6yc0n86n9021cr7ms2k9";
};
};
@ -89,7 +89,7 @@ in {
version = "4.3.2";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gmp/gmp-${cfg.gmp.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/gmp/gmp-${cfg.gmp.version}.tar.gz";
sha256 = "15rwq54fi3s11izas6g985y9jklm3xprfsmym3v1g6xr84bavqvv";
};
};
@ -98,7 +98,7 @@ in {
version = "2.4.2";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/mpfr/mpfr-${cfg.mpfr.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/mpfr/mpfr-${cfg.mpfr.version}.tar.gz";
sha256 = "0dxn4904dra50xa22hi047lj8kkpr41d6vb9sd4grca880c7wv94";
};
};
@ -107,7 +107,7 @@ in {
version = "1.0.3";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/mpc/mpc-${cfg.mpc.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/mpc/mpc-${cfg.mpc.version}.tar.gz";
sha256 = "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1";
};
};

View file

@ -74,13 +74,13 @@ in {
version = "4.6.4";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gcc/gcc-${cfg.version}/gcc-core-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/gcc/gcc-${cfg.version}/gcc-core-${cfg.version}.tar.gz";
sha256 = "173kdb188qg79pcz073cj9967rs2vzanyjdjyxy9v0xb0p5sad75";
};
cc = {
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gcc/gcc-${cfg.version}/gcc-g++-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/gcc/gcc-${cfg.version}/gcc-g++-${cfg.version}.tar.gz";
sha256 = "1fqqk5zkmdg4vmqzdmip9i42q6b82i3f6yc0n86n9021cr7ms2k9";
};
};
@ -89,7 +89,7 @@ in {
version = "4.3.2";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gmp/gmp-${cfg.gmp.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/gmp/gmp-${cfg.gmp.version}.tar.gz";
sha256 = "15rwq54fi3s11izas6g985y9jklm3xprfsmym3v1g6xr84bavqvv";
};
};
@ -98,7 +98,7 @@ in {
version = "2.4.2";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/mpfr/mpfr-${cfg.mpfr.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/mpfr/mpfr-${cfg.mpfr.version}.tar.gz";
sha256 = "0dxn4904dra50xa22hi047lj8kkpr41d6vb9sd4grca880c7wv94";
};
};
@ -107,7 +107,7 @@ in {
version = "1.0.3";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/mpc/mpc-${cfg.mpc.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/mpc/mpc-${cfg.mpc.version}.tar.gz";
sha256 = "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1";
};
};

View file

@ -85,7 +85,7 @@ in {
version = "8.5.0";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gcc/gcc-${cfg.version}/gcc-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/gcc/gcc-${cfg.version}/gcc-${cfg.version}.tar.xz";
sha256 = "0wiEGlEbuDCmEAOXsAQtskzhH2Qtq26m7kSELlMl7VA=";
};
@ -93,7 +93,7 @@ in {
# last version to compile with gcc 4.6
version = "6.2.1";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gmp/gmp-${cfg.gmp.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/gmp/gmp-${cfg.gmp.version}.tar.xz";
sha256 = "/UgpkSzd0S+EGBw0Ucx1K+IkZD6H+sSXtp7d2txJtPI=";
};
};
@ -101,7 +101,7 @@ in {
mpfr = {
version = "4.2.1";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/mpfr/mpfr-${cfg.mpfr.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/mpfr/mpfr-${cfg.mpfr.version}.tar.xz";
sha256 = "J3gHNTpnJpeJlpRa8T5Sgp46vXqaW3+yeTiU4Y8fy7I=";
};
};
@ -109,7 +109,7 @@ in {
mpc = {
version = "1.3.1";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/mpc/mpc-${cfg.mpc.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/mpc/mpc-${cfg.mpc.version}.tar.gz";
sha256 = "q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg=";
};
};

View file

@ -63,7 +63,7 @@ in {
version = "2.4";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/grep/grep-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/grep/grep-${cfg.version}.tar.gz";
sha256 = "05iayw5sfclc476vpviz67hdy03na0pz2kb5csa50232nfx34853";
};

View file

@ -58,7 +58,7 @@ in {
version = "1.4.19";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/m4/m4-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/m4/m4-${cfg.version}.tar.xz";
sha256 = "Y67eXG0zttmxNRHNC+LKwEby5w/QoHqpVzoEqCeDr5Y=";
};

View file

@ -30,7 +30,7 @@ in {
version = "4.4.1";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/make/make-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/make/make-${cfg.version}.tar.gz";
sha256 = "1cwgcmwdn7gqn5da2ia91gkyiqs9birr10sy5ykpkaxzcwfzn5nx";
};

View file

@ -62,7 +62,7 @@ in {
version = "4.4.1";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/make/make-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/make/make-${cfg.version}.tar.gz";
sha256 = "3Rb7HWe/q3mnL16DkHNcSePo5wtJRaFasfgd23hlj7M=";
};

View file

@ -57,7 +57,7 @@ in {
version = "2.5.9";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/patch/patch-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/patch/patch-${cfg.version}.tar.gz";
sha256 = "12nv7jx3gxfp50y11nxzlnmqqrpicjggw6pcsq0wyavkkm3cddgc";
};

View file

@ -30,7 +30,7 @@ in {
version = "4.0.9";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/sed/sed-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/sed/sed-${cfg.version}.tar.gz";
sha256 = "0006gk1dw2582xsvgx6y6rzs9zw8b36rhafjwm288zqqji3qfrf3";
};

View file

@ -68,7 +68,7 @@ in {
version = "4.2";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/sed/sed-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/sed/sed-${cfg.version}.tar.gz";
sha256 = "20XNY/0BDmUFN9ZdXfznaJplJ0UjZgbl5ceCk3Jn2YM=";
};

View file

@ -31,7 +31,7 @@ in {
version = "1.12";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/tar/tar-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/tar/tar-${cfg.version}.tar.gz";
sha256 = "02m6gajm647n8l9a5bnld6fnbgdpyi4i3i83p7xcwv0kif47xhy6";
};

View file

@ -69,7 +69,7 @@ in {
version = "1.35";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/tar/tar-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/tar/tar-${cfg.version}.tar.gz";
sha256 = "FNVeMgY+qVJuBX+/Nfyr1TN452l4fv95GcN1WwLStX4=";
};

View file

@ -31,7 +31,7 @@ in {
version = "1.12";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/tar/tar-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/tar/tar-${cfg.version}.tar.gz";
sha256 = "xsN+iIsTbM76uQPFEUn0t71lnWnUrqISRfYQU6V6pgo=";
};

View file

@ -57,7 +57,7 @@ in {
version = "1.2.4";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gzip/gzip-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/gzip/gzip-${cfg.version}.tar.gz";
sha256 = "0ryr5b00qz3xcdcv03qwjdfji8pasp0007ay3ppmk71wl8c1i90w";
};

View file

@ -30,7 +30,7 @@ in {
version = "0.25";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/mes/mes-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/mes/mes-${cfg.version}.tar.gz";
sha256 = "MlJQs1Z+2SA7pwFhyDWvAQeec+vtl7S1u3fKUAuCiUA=";
};
};

View file

@ -64,7 +64,7 @@ in {
version = "5.2.15";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/bash/bash-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/bash/bash-${cfg.version}.tar.gz";
sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk";
};

View file

@ -58,7 +58,7 @@ in {
version = "2.41";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/binutils/binutils-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/binutils/binutils-${cfg.version}.tar.xz";
sha256 = "rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA=";
};

View file

@ -58,7 +58,7 @@ in {
version = "9.4";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/coreutils/coreutils-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/coreutils/coreutils-${cfg.version}.tar.gz";
sha256 = "X2ANkJOXOwr+JTk9m8GMRPIjJlf0yg2V6jHHAutmtzk=";
};

View file

@ -58,7 +58,7 @@ in {
version = "3.10";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/diffutils/diffutils-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/diffutils/diffutils-${cfg.version}.tar.xz";
sha256 = "kOXpPMck5OvhLt6A3xY0Bjx6hVaSaFkZv+YLVWyb0J4=";
};

View file

@ -58,7 +58,7 @@ in {
version = "4.9.0";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/findutils/findutils-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/findutils/findutils-${cfg.version}.tar.xz";
sha256 = "or+4wJ1DZ3DtxZ9Q+kg+eFsWGjt7nVR1c8sIBl/UYv4=";
};

View file

@ -64,7 +64,7 @@ in {
version = "5.2.2";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gawk/gawk-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/gawk/gawk-${cfg.version}.tar.gz";
sha256 = "lFrvfM/xAfILIqEIArwAXplKsrjqPnJMwaGXxi9B9lA=";
};

View file

@ -112,14 +112,14 @@ in {
version = "13.2.0";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gcc/gcc-${cfg.version}/gcc-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/gcc/gcc-${cfg.version}/gcc-${cfg.version}.tar.xz";
sha256 = "4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o=";
};
gmp = {
version = "6.3.0";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gmp/gmp-${cfg.gmp.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/gmp/gmp-${cfg.gmp.version}.tar.xz";
sha256 = "o8K4AgG4nmhhb0rTC8Zq7kknw85Q4zkpyoGdXENTiJg=";
};
};
@ -127,7 +127,7 @@ in {
mpfr = {
version = "4.2.1";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/mpfr/mpfr-${cfg.mpfr.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/mpfr/mpfr-${cfg.mpfr.version}.tar.xz";
sha256 = "J3gHNTpnJpeJlpRa8T5Sgp46vXqaW3+yeTiU4Y8fy7I=";
};
};
@ -135,7 +135,7 @@ in {
mpc = {
version = "1.3.1";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/mpc/mpc-${cfg.mpc.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/mpc/mpc-${cfg.mpc.version}.tar.gz";
sha256 = "q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg=";
};
};

View file

@ -59,7 +59,7 @@ in {
version = "2.38";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/libc/glibc-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/libc/glibc-${cfg.version}.tar.xz";
sha256 = "+4KZiZiyspllRnvBtp0VLpwwfSzzAcnq+0VVt3DvP9I=";
};

View file

@ -64,7 +64,7 @@ in {
version = "3.11";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/grep/grep-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/grep/grep-${cfg.version}.tar.xz";
sha256 = "HbKu3eidDepCsW2VKPiUyNFdrk4ZC1muzHj1qVEnbqs=";
};

View file

@ -59,7 +59,7 @@ in {
version = "4.4.1";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/make/make-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/make/make-${cfg.version}.tar.gz";
sha256 = "3Rb7HWe/q3mnL16DkHNcSePo5wtJRaFasfgd23hlj7M=";
};

View file

@ -58,7 +58,7 @@ in {
version = "2.7";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/patch/patch-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/patch/patch-${cfg.version}.tar.xz";
sha256 = "XCyR/kFUKWISbwvhUKpPo0lIXPLtwMfqfbwky4FxEa4=";
};

View file

@ -64,7 +64,7 @@ in {
version = "4.9";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/sed/sed-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/sed/sed-${cfg.version}.tar.xz";
sha256 = "biJrcy4c1zlGStaGK9Ghq6QteYKSLaelNRljHSSXUYE=";
};

View file

@ -64,7 +64,7 @@ in {
version = "1.35";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/tar/tar-${cfg.version}.tar.gz";
url = "${config.aux.mirrors.gnu}/tar/tar-${cfg.version}.tar.gz";
sha256 = "FNVeMgY+qVJuBX+/Nfyr1TN452l4fv95GcN1WwLStX4=";
};

View file

@ -58,7 +58,7 @@ in {
version = "1.13";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gzip/gzip-${cfg.version}.tar.xz";
url = "${config.aux.mirrors.gnu}/gzip/gzip-${cfg.version}.tar.xz";
sha256 = "dFTraTXbF8ZlVXbC4bD6vv04tNCTbg+H9IzQYs6RoFc=";
};

View file

@ -201,7 +201,14 @@ lib: {
name: value:
builtins.addErrorContext
"while evaluating the module argument `${name}` in `${key}`"
(args.${name} or args.config.__module__.args.dynamic.${name})
(
# The base case here is the set of static arguments supplied in the
# call to `lib.modules.run`.
args.${name}
# Then, any other arguments must be created dynamically from within
# the modules being evaluated.
or args.config.__module__.args.dynamic.${name}
)
)
(lib.fp.args module);
in
@ -577,7 +584,7 @@ lib: {
};
freeform = lib.options.create {
type = lib.types.nullish lib.types.option;
type = lib.types.nullish lib.types.type;
default.value = null;
internal = true;
description = "If set, all options that don't have a declared type will be merged using this type.";
@ -594,8 +601,6 @@ lib: {
meta = {
inherit extend type;
};
lib = lib.modules.overrides.default lib;
};
};
};
@ -607,7 +612,18 @@ lib: {
collect
(args.path or "")
(modules ++ [internal])
({inherit options config;} // args);
(
{
inherit options config;
# The library does not include `extend` out of the box to avoid infinite recursion
# in most cases. Instead, we supply an estensible version here for modules to consume.
# This is only something that affects internal use of `lib`, the properly exported
# `lib` is augmented with an `extend` method.
lib = lib.points.withExtend (lib.fp.const lib);
}
// args
);
in
lib.modules.combine prefix (lib.lists.reverse collected);

View file

@ -548,13 +548,13 @@ lib: {
else merged;
};
packages = {
## A type that allows a shell package. This is a package with an accompanying
derivations = {
## A type that allows a shell derivation. This is a derivation with an accompanying
## `shellPath` attribute.
##
## @type Attrs
shell =
lib.types.package
lib.types.derivation
// {
check = value: lib.packages.isDerivation && builtins.hasAttr "shellPath" value;
};
@ -762,10 +762,10 @@ lib: {
modules =
[
{
options.__module__.args.name = lib.options.create {
options.__module__.args.dynamic.name = lib.options.create {
type = lib.types.string;
};
config.__module__.args.name = lib.modules.overrides.default "<name>";
config.__module__.args.dynamic.name = lib.modules.overrides.default "<name>";
}
]
++ modules;
@ -785,7 +785,7 @@ lib: {
merge = location: definitions: let
result = base.extend {
modules =
[{config.__module__.args.name = lib.lists.last location;}]
[{config.__module__.args.dynamic.name = lib.lists.last location;}]
++ getModules definitions;
};
in
@ -882,7 +882,17 @@ lib: {
};
};
## Create a type that allows an Option.
## A type that allows a Type.
##
## @type Attrs
type = lib.types.create {
name = "Type";
description = "type";
check = lib.types.is "type";
merge = lib.options.merge.one;
};
## A type that allows an Option.
##
## @type Attrs
option = lib.types.create {

View file

@ -6,21 +6,22 @@
result = lib.modules.run {
modules =
modules
(builtins.attrValues modules)
++ [
./src/export.nix
{
__file__ = ./default.nix;
options.aux.packages.foundation = {
raw = lib.options.create {
options.packages.aux = {
foundation = lib.options.create {
type = lib.types.attrs.of lib.types.package;
internal = true;
description = "The foundational packages used to construct the larger package set.";
};
};
config.aux.packages.foundation = {
raw = foundation;
config.packages.aux = {
foundation = foundation;
};
}
];

41
potluck/flake.lock Normal file
View file

@ -0,0 +1,41 @@
{
"nodes": {
"foundation": {
"inputs": {
"lib": [
"lib"
]
},
"locked": {
"lastModified": 1,
"narHash": "sha256-CDfGWoJg+7i9z6quwh/WXuTkOhqKme73dUTvWCvJ8EA=",
"path": "../foundation",
"type": "path"
},
"original": {
"path": "../foundation",
"type": "path"
}
},
"lib": {
"locked": {
"lastModified": 1,
"narHash": "sha256-TtgysWL53BK3f3JrPFunjzJaXWaDG2RbuPMglCwATOY=",
"path": "../lib",
"type": "path"
},
"original": {
"path": "../lib",
"type": "path"
}
},
"root": {
"inputs": {
"foundation": "foundation",
"lib": "lib"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,19 +1,20 @@
{
inputs = {
lib = {
url = "path:../lib";
};
foundation = {
url = "path:../foundation";
inputs.lib.follows = "lib";
};
# TODO: When this project is moved to its own repository we will want to add
# inputs for the relevant dependencies.
# lib = {
# url = "path:../lib";
# };
# foundation = {
# url = "path:../foundation";
# inputs.lib.follows = "lib";
# };
};
outputs = inputs: let
exports = import ./default.nix {
lib = inputs.lib.lib;
foundation = inputs.foundation.packages.i686-linux;
# lib = inputs.lib.lib;
# foundation = inputs.foundation.packages.i686-linux;
};
in
exports;

13
potluck/src/export.nix Normal file
View file

@ -0,0 +1,13 @@
# This file handles creating all of the exports for this project and is not
# exported itself.
{
lib,
config,
}: let
in {
config = {
exports = {
modules = import ./modules.nix;
};
};
}

View file

@ -1,5 +1,6 @@
{
includes = [
./packages.nix
./modules.nix
];
}

View file

@ -0,0 +1,34 @@
{
lib,
config,
}: let
cfg = config.exports.modules;
type = lib.types.one [
lib.types.path
(lib.types.attrs.any)
(lib.types.function lib.types.attrs.any)
];
in {
options = {
exports = {
modules = lib.options.create {
type = lib.types.attrs.of type;
default.value = {};
description = "An attribute set of modules to export.";
};
};
exported = {
modules = lib.options.create {
type = lib.types.attrs.of type;
default.value = {};
description = "An attribute set of modules to export.";
};
};
};
config = {
exported.modules = cfg.modules;
};
}

View file

@ -12,4 +12,8 @@ in {
default.value = {};
};
};
config = {
exported.packages = {};
};
}

View file

@ -0,0 +1,22 @@
{
lib,
config,
}: let
cfg = config.lib;
in {
includes = [
./options.nix
./types.nix
];
freeform = lib.types.any;
options = {
lib = lib.options.create {
type = lib.types.attrs.any;
default.value = {};
description = "An attribute set of values to be added to `lib`.";
apply = value: lib.extend (final: prev: prev.attrs.mergeRecursive prev value);
};
};
}

View file

@ -0,0 +1,12 @@
{
lib,
config,
}: let
in {
lib.options = {
package = lib.options.create {
type = config.lib.types.package;
description = "A package definition.";
};
};
}

267
potluck/src/lib/types.nix Normal file
View file

@ -0,0 +1,267 @@
{
lib,
config,
}: let
lib' = config.lib;
in {
lib.types = {
license = let
type = lib.types.submodule ({config}: {
options = {
name = {
full = lib.options.create {
type = lib.types.string;
description = "The full name of the license.";
};
short = lib.options.create {
type = lib.types.string;
description = "The short name of the license.";
};
};
spdx = lib.options.create {
type = lib.types.nullish lib.types.string;
default.value = null;
description = "The SPDX identifier for the license.";
};
url = lib.options.create {
type = lib.types.nullish lib.types.string;
description = "The URL for the license.";
};
free = lib.options.create {
type = lib.types.bool;
default.value = true;
description = "Whether the license is free.";
};
redistributable = lib.options.create {
type = lib.types.bool;
default = {
text = "config.free";
value = config.free;
};
description = "Whether the license is allows redistribution.";
};
};
});
in
lib.types.either type (lib.types.list.of type);
meta = lib.types.submodule {
options = {
name = lib.options.create {
type = lib.types.string;
description = "The name of the package.";
};
description = lib.options.create {
type = lib.types.string;
description = "The description for the package.";
};
homepage = lib.options.create {
type = lib.types.nullish lib.types.string;
default.value = null;
description = "The homepage for the package.";
};
license = lib.options.create {
type = config.lib.types.license;
description = "The license for the package.";
};
free = lib.options.create {
type = lib.types.bool;
default.value = true;
description = "Whether the package is free.";
};
insecure = lib.options.create {
type = lib.types.bool;
default.value = false;
description = "Whether the package is insecure.";
};
broken = lib.options.create {
type = lib.types.bool;
default.value = false;
description = "Whether the package is broken.";
};
main = lib.options.create {
type = lib.types.nullish lib.types.string;
default.value = null;
description = "The main entry point for the package.";
};
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
default.value = [];
description = "The platforms the package supports.";
};
};
};
package = lib.types.submodule ({config}: {
freeform = lib.types.any;
options = {
name = lib.options.create {
type = lib.types.string;
default = {
value = "${config.pname}-${config.version}";
text = "\${config.pname}-\${config.version}";
};
description = "The name of the package.";
};
pname = lib.options.create {
type = lib.types.nullish lib.types.string;
default.value = null;
description = "The name of the package.";
};
version = lib.options.create {
type = lib.types.nullish lib.types.string;
default.value = null;
description = "The version of the package.";
};
meta = lib.options.create {
type = lib'.types.meta;
};
env = lib.options.create {
type = lib.types.attrs.of lib.types.string;
default.value = {};
description = "Environment variables for the package's builder to use.";
};
phases = lib.options.create {
type = lib.types.attrs.of lib.types.string;
default.value = {};
description = "Phases for the package's builder to use.";
};
platform = {
build = lib.options.create {
type = lib.types.string;
description = "The platform the package is built on.";
};
host = lib.options.create {
type = lib.types.string;
description = "The platform the package is run on.";
};
target = lib.options.create {
type = lib.types.string;
description = "The platform the package generates code for.";
};
};
builder = lib.options.create {
type = lib'.types.builder;
description = "The builder for the package.";
};
package = lib.options.create {
type = lib.types.derivation;
default = {
value = config.builder.build config.builder config;
text = "<derivation>";
};
description = "The package derivation.";
};
deps = {
build = {
only = lib.options.create {
type = lib'.types.dependencies;
default.value = {};
description = "Dependencies which are only used in the build environment.";
};
build = lib.options.create {
type = lib'.types.dependencies;
default.value = {};
description = "Dependencies which are created in the build environment and are run in the build environment.";
};
host = lib.options.create {
type = lib'.types.dependencies;
default.value = {};
description = "Dependencies which are created in the build environment and are run in the host environment.";
};
target = lib.options.create {
type = lib'.types.dependencies;
default.value = {};
description = "Dependencies which are created in the build environment and are run in the target environment.";
};
};
host = {
only = lib.options.create {
type = lib'.types.dependencies;
default.value = {};
description = "Dependencies which are only used in the host environment.";
};
host = lib.options.create {
type = lib'.types.dependencies;
default.value = {};
description = "Dependencies which are run in the host environment.";
};
target = lib.options.create {
type = lib'.types.dependencies;
default.value = {};
description = "Dependencies which are run in the host environment which produces code for the target environment.";
};
};
target = {
only = lib.options.create {
type = lib'.types.dependencies;
default.value = {};
description = "Dependencies which are only used in the target environment.";
};
target = lib.options.create {
type = lib'.types.dependencies;
default.value = {};
description = "Dependencies which are run in the target environment.";
};
};
};
versions = lib.options.create {
type = lib.types.attrs.of lib'.types.package;
default.value = {};
description = "Available versions of the package.";
};
};
});
dependencies = lib.types.attrs.of (lib.types.nullish lib'.types.package);
packages = lib.types.attrs.of (lib.types.submodule {
freeform = lib.types.nullish lib'.types.package;
});
builder = lib.types.submodule {
freeform = lib.types.any;
options = {
build = lib.options.create {
type = lib.types.function lib.types.derivation;
description = "The function that creates the package derivation.";
};
};
};
};
}

View file

@ -1 +1,4 @@
[]
{
exports = ./exports;
lib = ./lib;
}

View file

@ -0,0 +1,33 @@
{
lib,
config,
}: let
lib' = config.lib;
configure = namespace: packages:
builtins.mapAttrs
(key: package: let
name =
if package.pname != null && package.version != null
then "${package.pname}-${package.version}"
else key;
in {
name = lib.modules.overrides.default name;
package = lib.modules.overrides.default (package.builder package);
})
packages;
configs = builtins.mapAttrs configure config.packages;
in {
includes = [
./aux/foundation.nix
];
options = {
packages = lib.options.create {
type = lib'.types.packages;
};
};
config = lib.modules.merge configs;
}