2020-10-22 19:58:10 +02:00
|
|
|
{ flake }:
|
|
|
|
final: prev:
|
2020-05-07 21:45:55 +02:00
|
|
|
with prev;
|
2020-10-22 19:58:10 +02:00
|
|
|
|
2020-05-07 21:45:55 +02:00
|
|
|
let
|
2020-11-26 12:11:29 +01:00
|
|
|
# Helper functions to override package dependant
|
|
|
|
# on whether the host or target system is Genode.
|
|
|
|
|
|
|
|
overrideHost = attrs: drv:
|
2020-10-19 23:04:41 +02:00
|
|
|
if hostPlatform.isGenode then drv.override attrs else drv;
|
|
|
|
|
2020-11-26 12:11:29 +01:00
|
|
|
overrideTarget = attrs: drv:
|
|
|
|
if targetPlatform.isGenode then drv.override attrs else drv;
|
2020-03-24 13:47:30 +01:00
|
|
|
|
2020-11-26 12:11:29 +01:00
|
|
|
overrideAttrsHost = f: drv:
|
|
|
|
if hostPlatform.isGenode then drv.overrideAttrs f else drv;
|
2020-11-01 20:12:04 +01:00
|
|
|
|
2020-11-26 12:11:29 +01:00
|
|
|
overrideAttrsTarget = f: drv:
|
2020-05-07 21:45:55 +02:00
|
|
|
if targetPlatform.isGenode then drv.overrideAttrs f else drv;
|
|
|
|
|
2020-11-26 12:11:29 +01:00
|
|
|
addPatches' = patches: attrs: { patches = attrs.patches or [ ] ++ patches; };
|
|
|
|
|
|
|
|
addPatchesHost = ps: overrideAttrsHost (addPatches' ps);
|
|
|
|
|
|
|
|
addPatchesTarget = ps: overrideAttrsTarget (addPatches' ps);
|
2020-05-07 21:45:55 +02:00
|
|
|
|
2020-11-26 12:11:29 +01:00
|
|
|
autoreconfHost = overrideAttrsHost
|
|
|
|
(attrs: { nativeBuildInputs = [ final.autoreconfHook ]; });
|
2020-11-25 21:06:52 +01:00
|
|
|
|
2021-01-05 15:11:42 +01:00
|
|
|
nullPkgs =
|
2021-03-09 21:43:23 +01:00
|
|
|
# Nullify these packages to find problems early.
|
2021-01-05 15:11:42 +01:00
|
|
|
if hostPlatform.isGenode then
|
|
|
|
builtins.listToAttrs (map (name: {
|
|
|
|
inherit name;
|
|
|
|
value = null;
|
|
|
|
}) [ "iproute2" ])
|
|
|
|
else
|
|
|
|
{ };
|
|
|
|
|
|
|
|
in nullPkgs // {
|
2020-03-24 13:47:30 +01:00
|
|
|
|
2020-11-26 12:11:29 +01:00
|
|
|
bash = overrideAttrsTarget (attrs: {
|
2020-05-07 21:45:55 +02:00
|
|
|
configureFlags = attrs.configureFlags
|
|
|
|
++ [ "--without-bash-malloc" ]; # no sbrk please
|
2020-06-08 08:55:57 +02:00
|
|
|
postPatch = "sed '/check_dev_tty/d' shell.c";
|
2020-11-26 12:11:29 +01:00
|
|
|
}) bash;
|
2020-03-24 13:47:30 +01:00
|
|
|
|
2020-11-26 12:11:29 +01:00
|
|
|
binutils-unwrapped = overrideAttrsTarget (attrs: {
|
2021-03-09 21:43:23 +01:00
|
|
|
patches = attrs.patches ++ [
|
|
|
|
./binutils/support-genode.patch
|
|
|
|
# Upstreamed, remove at next release.
|
|
|
|
];
|
2021-01-12 13:03:48 +01:00
|
|
|
nativeBuildInputs = attrs.nativeBuildInputs
|
|
|
|
++ [ final.updateAutotoolsGnuConfigScriptsHook ];
|
2020-11-26 12:11:29 +01:00
|
|
|
}) binutils-unwrapped;
|
2020-05-07 21:45:55 +02:00
|
|
|
|
2021-03-09 21:43:23 +01:00
|
|
|
cmake =
|
|
|
|
# TODO: upstream
|
|
|
|
overrideAttrsTarget (attrs: {
|
|
|
|
postInstall = with stdenv; ''
|
|
|
|
local MODULE="$out/share/cmake-${
|
|
|
|
lib.versions.majorMinor attrs.version
|
|
|
|
}/Modules/Platform/Genode.cmake"
|
|
|
|
if [ -e "$MODULE" ]; then
|
|
|
|
echo "Upstream provides $MODULE!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
cp ${./cmake/Genode.cmake} $MODULE
|
|
|
|
'';
|
|
|
|
}) cmake;
|
2020-11-26 12:11:29 +01:00
|
|
|
|
|
|
|
coreutils = overrideHost {
|
|
|
|
gmp = null;
|
|
|
|
libiconv = null;
|
|
|
|
} (overrideAttrsHost (attrs: {
|
|
|
|
configureFlags = [
|
|
|
|
"--disable-acl"
|
|
|
|
"--disable-largefile"
|
|
|
|
"--disable-xattr"
|
|
|
|
"--disable-libcap"
|
|
|
|
"--disable-nls"
|
|
|
|
];
|
|
|
|
LDFLAGS = [ "-Wl,--no-as-needed" ];
|
|
|
|
# keep libposix NEEDED
|
|
|
|
}) coreutils);
|
|
|
|
|
2021-02-08 11:37:04 +01:00
|
|
|
erisPatchHook = final.callPackage ./eris-patch-hook {
|
|
|
|
patchelf = prev.patchelf.overrideAttrs (attrs: {
|
2021-03-19 13:05:09 +01:00
|
|
|
patches = attrs.patched or [ ] ++ [
|
|
|
|
./patchelf/dynstr.patch
|
|
|
|
./patchelf/shiftFile.patch
|
|
|
|
./patchelf/disable-assert.patch
|
|
|
|
];
|
2021-02-08 11:37:04 +01:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2021-03-09 21:43:23 +01:00
|
|
|
gdb = addPatchesTarget [
|
|
|
|
./gdb/genode.patch
|
|
|
|
# Upstreamed, remove at next release.
|
|
|
|
] gdb;
|
2020-05-07 21:45:55 +02:00
|
|
|
|
2020-04-05 18:50:52 +02:00
|
|
|
genodeLibcCross = callPackage ./libc { };
|
2020-04-02 09:06:18 +02:00
|
|
|
|
2021-03-09 21:43:23 +01:00
|
|
|
genodePackages =
|
|
|
|
# The Genode-only packages.
|
|
|
|
import ../packages {
|
|
|
|
inherit flake;
|
|
|
|
pkgs = final;
|
|
|
|
};
|
2021-02-06 21:11:39 +01:00
|
|
|
|
2021-03-09 21:43:23 +01:00
|
|
|
grub2 =
|
|
|
|
# No need for a Genode build of GRUB.
|
|
|
|
if stdenv.targetPlatform.isGenode then
|
|
|
|
prev.buildPackages.grub2
|
|
|
|
else
|
|
|
|
prev.grub2;
|
2021-02-06 21:11:39 +01:00
|
|
|
|
2020-03-24 13:47:30 +01:00
|
|
|
libcCrossChooser = name:
|
|
|
|
if stdenv.targetPlatform.isGenode then
|
2020-05-30 20:50:44 +02:00
|
|
|
targetPackages.genodeLibcCross
|
2020-03-24 13:47:30 +01:00
|
|
|
else
|
|
|
|
prev.libcCrossChooser name;
|
|
|
|
|
2020-11-26 12:11:29 +01:00
|
|
|
libsodium = overrideAttrsHost (attrs: {
|
2021-03-09 21:43:23 +01:00
|
|
|
patches = (attrs.patches or [ ]) ++ [
|
|
|
|
./libsodium/genode.patch
|
|
|
|
# https://github.com/jedisct1/libsodium/pull/1006
|
|
|
|
];
|
2020-11-26 12:11:29 +01:00
|
|
|
}) libsodium;
|
|
|
|
|
2021-03-09 21:43:23 +01:00
|
|
|
libkrb5 =
|
|
|
|
# Do not want.
|
|
|
|
autoreconfHost libkrb5;
|
2020-11-01 20:23:01 +01:00
|
|
|
|
2021-03-09 21:43:23 +01:00
|
|
|
libtool =
|
|
|
|
# Autotools related nonesense. Better to compile
|
|
|
|
# everything static than to deal with this one.
|
|
|
|
overrideAttrsTarget (attrs: {
|
|
|
|
nativeBuildInputs = with final;
|
|
|
|
attrs.nativeBuildInputs ++ [ autoconf automake115x ];
|
|
|
|
patches = ./libtool/genode.patch;
|
|
|
|
}) libtool;
|
2020-11-01 20:12:04 +01:00
|
|
|
|
2020-11-26 12:11:29 +01:00
|
|
|
libtoxcore = overrideHost {
|
2020-11-01 20:23:01 +01:00
|
|
|
libopus = null;
|
|
|
|
libvpx = null;
|
2020-11-26 12:11:29 +01:00
|
|
|
} libtoxcore;
|
2020-11-01 20:23:01 +01:00
|
|
|
|
2021-03-09 21:43:23 +01:00
|
|
|
linuxPackages =
|
|
|
|
# Dummy package.
|
|
|
|
if hostPlatform.isGenode then {
|
|
|
|
extend = _: final.linuxPackages;
|
|
|
|
features = { };
|
|
|
|
kernel.config = {
|
|
|
|
isEnabled = _: false;
|
|
|
|
isYes = _: false;
|
|
|
|
};
|
|
|
|
} else
|
|
|
|
linuxPackages;
|
|
|
|
|
|
|
|
llvmPackages_11 =
|
|
|
|
# A copy of the LLVM expressions from Nixpkgs.
|
|
|
|
# Nothing here is upstreamed.
|
|
|
|
callPackage ./llvm-11 ({
|
|
|
|
inherit (stdenvAdapters) overrideCC;
|
|
|
|
buildLlvmTools = buildPackages.llvmPackages_11.tools;
|
|
|
|
targetLlvmLibraries = targetPackages.llvmPackages_11.libraries;
|
|
|
|
} // lib.optionalAttrs
|
|
|
|
(stdenv.hostPlatform.isi686 && buildPackages.stdenv.cc.isGNU) {
|
|
|
|
stdenv = gcc7Stdenv;
|
|
|
|
});
|
|
|
|
|
|
|
|
ncurses =
|
|
|
|
# https://invisible-island.net/autoconf/
|
|
|
|
# Stay clear of upstream on this one.
|
|
|
|
addPatchesHost [ ./ncurses/genode.patch ] ncurses;
|
|
|
|
|
2021-03-15 11:52:57 +01:00
|
|
|
nim-unwrapped =
|
2021-03-09 21:43:23 +01:00
|
|
|
# Fixes to the compiler and standard libary.
|
2021-03-15 11:52:57 +01:00
|
|
|
prev.nim-unwrapped.overrideAttrs
|
|
|
|
(attrs: { patches = attrs.patches ++ [ ./nim/genode.patch ]; });
|
|
|
|
|
|
|
|
nimblePackages =
|
|
|
|
# Packages from the Nimble flake with adjustments.
|
|
|
|
let pkgs' = flake.inputs.nimble.overlay (final // pkgs') final;
|
|
|
|
in pkgs'.nimblePackages.extend (final: prev: {
|
|
|
|
|
2021-03-20 19:49:35 +01:00
|
|
|
genode = prev.genode.overrideAttrs (attrs: rec {
|
|
|
|
version = "20.11.1";
|
2021-03-15 11:52:57 +01:00
|
|
|
src = fetchgit {
|
|
|
|
inherit (attrs.src) url;
|
2021-03-20 19:49:35 +01:00
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0i78idsrgph0g2yir6niar7v827y6qnmd058s6mpvp091sllvlv8";
|
2021-03-15 11:52:57 +01:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
2021-02-18 19:42:23 +01:00
|
|
|
|
2020-12-03 12:49:39 +01:00
|
|
|
openssl =
|
|
|
|
overrideHost { static = true; } # shared library comes out stupid big
|
|
|
|
(overrideAttrsHost (attrs: {
|
|
|
|
outputs = [ "out" ]
|
|
|
|
++ builtins.filter (x: x != "bin" && x != "out") attrs.outputs;
|
|
|
|
patches = attrs.patches or [ ] ++ [ ./openssl/genode.patch ];
|
|
|
|
configureScript = {
|
|
|
|
x86_64-genode = "./Configure Genode-x86_64";
|
|
|
|
}.${stdenv.hostPlatform.system} or (throw
|
|
|
|
"Not sure what configuration to use for ${stdenv.hostPlatform.config}");
|
|
|
|
configureFlags = attrs.configureFlags ++ [ "no-devcryptoeng" ];
|
|
|
|
postInstall =
|
|
|
|
"rm $out/bin/c_rehash"; # eliminate the perl runtime dependency
|
|
|
|
}) openssl);
|
2020-05-27 14:22:36 +02:00
|
|
|
|
2021-03-09 21:43:23 +01:00
|
|
|
patchelf = addPatchesTarget [
|
|
|
|
./patchelf/dynstr.patch
|
|
|
|
# Patch to fix a bug in rewriting the .dynstr section.
|
|
|
|
] prev.patchelf;
|
2021-02-19 14:57:21 +01:00
|
|
|
|
2020-11-26 12:11:29 +01:00
|
|
|
rsync = overrideHost {
|
2020-11-25 21:15:53 +01:00
|
|
|
enableACLs = false;
|
|
|
|
popt = null;
|
2020-11-26 12:11:29 +01:00
|
|
|
} (overrideAttrsHost (attrs: { outputs = [ "out" "man" ]; }) rsync);
|
2020-10-19 00:14:50 +02:00
|
|
|
|
2020-04-02 12:24:40 +02:00
|
|
|
solo5-tools = callPackage ./solo5-tools { };
|
|
|
|
|
2021-02-08 11:37:04 +01:00
|
|
|
stdenv = overrideHost (old: {
|
|
|
|
extraNativeBuildInputs = old.extraNativeBuildInputs
|
|
|
|
++ [ final.buildPackages.erisPatchHook ];
|
|
|
|
}) prev.stdenv;
|
|
|
|
|
2020-12-03 12:22:18 +01:00
|
|
|
tor = overrideAttrsHost (attrs: {
|
|
|
|
configureFlags = attrs.configureFlags or [ ]
|
|
|
|
++ [ "--disable-tool-name-check" ];
|
2021-03-09 21:43:23 +01:00
|
|
|
patches = attrs.patches or [ ] ++ [
|
|
|
|
./tor/genode.patch
|
|
|
|
# We don't do users and groups here.
|
|
|
|
];
|
2020-12-03 12:22:18 +01:00
|
|
|
postPatch = null; # Avoid torsocks patching
|
|
|
|
}) tor;
|
|
|
|
|
2020-11-26 12:11:29 +01:00
|
|
|
zlib = overrideAttrsHost (attrs: {
|
2020-06-10 18:21:26 +02:00
|
|
|
postInstall = attrs.postInstall or "" + ''
|
|
|
|
pushd ''${!outputLib}/lib
|
|
|
|
find . -type l -delete
|
|
|
|
mv libz.so.* libz.so
|
|
|
|
popd
|
|
|
|
'';
|
2020-11-26 12:11:29 +01:00
|
|
|
}) zlib;
|
|
|
|
|
2021-04-10 13:33:26 +02:00
|
|
|
zstd = let
|
|
|
|
static = true;
|
|
|
|
legacySupport = false;
|
|
|
|
in overrideAttrsHost (attrs: rec {
|
|
|
|
cmakeFlags = lib.attrsets.mapAttrsToList
|
|
|
|
(name: value: "-DZSTD_${name}:BOOL=${if value then "ON" else "OFF"}") {
|
|
|
|
BUILD_SHARED = !static;
|
|
|
|
BUILD_STATIC = static;
|
|
|
|
PROGRAMS_LINK_SHARED = !static;
|
|
|
|
LEGACY_SUPPORT = legacySupport;
|
|
|
|
BUILD_TESTS = doCheck;
|
|
|
|
};
|
|
|
|
doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
|
|
|
|
}) prev.zstd;
|
|
|
|
|
2020-03-21 17:08:37 +01:00
|
|
|
}
|