final: prev: let isCross = final.stdenv.buildPlatform != final.stdenv.hostPlatform; crossOnly = pkg: amendFn: if isCross then (amendFn pkg) else pkg; extraPkgs = import ./pkgs/default.nix { inherit (final) lib callPackage; }; inherit (final) fetchpatch lib; luaHost = let l = prev.lua5_3.overrideAttrs (o: { name = "lua-tty"; preBuild = '' makeFlagsArray+=(PLAT="posix" SYSLIBS="-Wl,-E -ldl" CFLAGS="-O2 -fPIC -DLUA_USE_POSIX -DLUA_USE_DLOPEN") ''; # lua in nixpkgs has a postInstall stanza that assumes only # one output, we need to override that if we're going to # convert to multi-output # outputs = ["bin" "man" "out"]; makeFlags = builtins.filter (x: (builtins.match "(PLAT|MYLIBS).*" x) == null) o.makeFlags; }); in l.override { self = l; packageOverrides = lua-final: lua-prev: let openssl = final.opensslNoThreads; in { cqueues = lua-prev.cqueues.overrideAttrs (o: { externalDeps = [ { name = "CRYPTO"; dep = openssl; } { name = "OPENSSL"; dep = openssl; } ]; }); luaossl = lua-prev.luaossl.overrideAttrs (o: { externalDeps = [ { name = "CRYPTO"; dep = openssl; } { name = "OPENSSL"; dep = openssl; } ]; name = "${o.name}-218"; patches = [ (fetchpatch { url = "https://patch-diff.githubusercontent.com/raw/wahern/luaossl/pull/218.patch"; hash = "sha256-2GOliY4/RUzOgx3rqee3X3szCdUVxYDut7d+XFcUTJw="; }) ]; preInstall = "rm src/openssl.c.orig ; chmod +w src/openssl.c"; }); }; }; s6 = prev.s6.overrideAttrs ( o: let patch = fetchpatch { # add "p" directive in s6-log url = "https://github.com/skarnet/s6/commit/ddc76841398dfd5e18b22943727ad74b880236d3.patch"; hash = "sha256-fBtUinBdp5GqoxgF6fcR44Tu8hakxs/rOShhuZOgokc="; }; patch_needed = builtins.compareVersions o.version "2.11.1.2" <= 0; in { configureFlags = (builtins.filter (x: (builtins.match ".*shared.*" x) == null) o.configureFlags) ++ [ "--disable-allstatic" "--disable-static" "--enable-shared" ]; hardeningDisable = [ "all" ]; stripAllList = [ "sbin" "bin" ]; patches = (if o ? patches then o.patches else [ ]) ++ (if patch_needed then [ patch ] else [ ]); } ); in extraPkgs // { # liminix library functions lim = { parseInt = s: (builtins.fromTOML "r=${s}").r; orEmpty = x: if x != null then x else [ ]; }; # keep these alphabetical btrfs-progs = crossOnly prev.btrfs-progs ( d: d.override { udevSupport = false; udev = null; } ); chrony = let chrony' = prev.chrony.overrideAttrs (o: { configureFlags = [ "--chronyvardir=$(out)/var/lib/chrony" "--sbindir=$(out)/bin" "--chronyrundir=/run/chrony" "--disable-readline" "--disable-editline" ]; }); in chrony'.override { gnutls = null; libedit = null; libseccomp = null; libcap = null; } // lib.optionalAttrs (lib.versionOlder lib.version "24.10") { nss = null; nspr = null; readline = null; }; # clevis without luks/tpm clevis = crossOnly prev.clevis ( d: let c = d.overrideAttrs (o: { outputs = [ "out" ]; preConfigure = '' rm -rf src/luks sed -i -e '/luks/d' src/meson.build ''; }); in c.override { asciidoc = null; cryptsetup = null; luksmeta = null; tpm2-tools = null; } ); dnsmasq = let d = prev.dnsmasq.overrideAttrs (o: { preBuild = '' makeFlagsArray=("COPTS=") ''; }); in d.override { dbusSupport = false; nettle = null; }; dropbear = crossOnly prev.dropbear ( d: d.overrideAttrs (o: rec { patches = o.patches ++ [ ./pkgs/dropbear/add-authkeyfile-option.patch ]; postPatch = '' (echo '#define DSS_PRIV_FILENAME "/run/dropbear/dropbear_dss_host_key"' echo '#define RSA_PRIV_FILENAME "/run/dropbear/dropbear_rsa_host_key"' echo '#define ECDSA_PRIV_FILENAME "/run/dropbear/dropbear_ecdsa_host_key"' echo '#define ED25519_PRIV_FILENAME "/run/dropbear/dropbear_ed25519_host_key"') > localoptions.h ''; }) ); elfutils = crossOnly prev.elfutils ( d: let e = d.overrideAttrs (o: { configureFlags = o.configureFlags ++ [ "ac_cv_has_stdatomic=no" ]; nativeBuildInputs = [ # upstream only includes this if enableDebuginfod is true, # but seems it's now needed unconditionally final.buildPackages.pkg-config final.buildPackages.m4 ]; }); in e.override { enableDebuginfod = false; } ); fennel = let version = "1.6.1"; in luaHost.pkgs.buildLuaPackage { pname= "fennel"; inherit version; src = final.fetchFromSourcehut { owner = "~technomancy"; repo = "fennel"; rev = version; hash = "sha256-MLXLkRKlxqvEOogM5I4uHxnlRLjK8Pbeq9b1+kAgqFg="; }; nativeBuildInputs = [ final.pkgsBuildBuild.lua5_3 ]; }; hostapd = let config = [ "CONFIG_DRIVER_NL80211=y" "CONFIG_IAPP=y" "CONFIG_IEEE80211AC=y" "CONFIG_IEEE80211AX=y" "CONFIG_IEEE80211N=y" "CONFIG_IEEE80211W=y" "CONFIG_INTERNAL_LIBTOMMATH=y" "CONFIG_INTERNAL_LIBTOMMATH_FAST=y" "CONFIG_IPV6=y" "CONFIG_LIBNL32=y" "CONFIG_PKCS12=y" "CONFIG_RSN_PREAUTH=y" "CONFIG_TLS=internal" ]; h = prev.hostapd.overrideAttrs (o: { extraConfig = ""; configurePhase = '' cat > hostapd/defconfig <