Move upstream build to external flake
This commit is contained in:
parent
41d52bbd35
commit
15360a0ff5
29
flake.lock
29
flake.lock
|
@ -19,24 +19,37 @@
|
|||
"originalUrl": "git+https://github.com/dhall-lang/dhall-haskell?ref=flake",
|
||||
"url": "git+https://github.com/dhall-lang/dhall-haskell?ref=flake&rev=256810cd5adf1ae5862eed0ffdaab4cf49f6fe67"
|
||||
},
|
||||
"genode": {
|
||||
"inputs": {
|
||||
"nixpkgs": {
|
||||
"inputs": {},
|
||||
"narHash": "sha256-HYX9rCn1dweN+L3ecNy4BiCGw4WEt1zgdIiAeYNY5GM=",
|
||||
"originalUrl": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode",
|
||||
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=12e31ac07c6d337760b3f59dc64c03f26cdd2009"
|
||||
}
|
||||
},
|
||||
"narHash": "sha256-9/RR/CwvB1M2VSR7CrSVexYXN1YSSSE4WG4siDh0LE0=",
|
||||
"originalUrl": "git+https://gitea.c3d2.de/ehmry/genode.git",
|
||||
"url": "git+https://gitea.c3d2.de/ehmry/genode.git?ref=master&rev=2a9178fced42cac986de07b6944afd4422d28976"
|
||||
},
|
||||
"genode-depot": {
|
||||
"inputs": {
|
||||
"nixpkgs": {
|
||||
"inputs": {},
|
||||
"narHash": "sha256-Y5ZOTgInrYYoas3vM8uTPLA2DvFI9YoI6haftIKl9go=",
|
||||
"narHash": "sha256-HYX9rCn1dweN+L3ecNy4BiCGw4WEt1zgdIiAeYNY5GM=",
|
||||
"originalUrl": "nixpkgs",
|
||||
"url": "github:edolstra/nixpkgs/015c9ec3372e328ea6742b409a1e9aa26dab2b31"
|
||||
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=12e31ac07c6d337760b3f59dc64c03f26cdd2009"
|
||||
}
|
||||
},
|
||||
"narHash": "sha256-bCKZSw8cBTJf5EPSXzuKPTaM8EAFXez27BCMZn+rUk0=",
|
||||
"originalUrl": "genode-depot",
|
||||
"url": "git+file:///home/repo/genode-depot?ref=master&rev=b9119fccb3114829900ae75886d3b5edb54bbd7f"
|
||||
"narHash": "sha256-be9whulZ8unz1sq9PiFr+tuUAXlwiPEhIe0Z6jmfZiU=",
|
||||
"originalUrl": "git+https://gitea.c3d2.de/ehmry/genode-depot.git",
|
||||
"url": "git+https://gitea.c3d2.de/ehmry/genode-depot.git?ref=master&rev=2f3162d88220bd6fa6b6fbc7c6d9fed68533a761"
|
||||
},
|
||||
"nixpkgs": {
|
||||
"inputs": {},
|
||||
"narHash": "sha256-1bzVtI5qk3bFvAnf4ww3R4grNymC4EdZZsRncuKe/gQ=",
|
||||
"originalUrl": "git+file:///home/repo/nixpkgs?ref=genode",
|
||||
"url": "git+file:///home/repo/nixpkgs?ref=genode&rev=52db5235aa35b4e334a7187ba18517cb5dc6410d"
|
||||
"narHash": "sha256-HYX9rCn1dweN+L3ecNy4BiCGw4WEt1zgdIiAeYNY5GM=",
|
||||
"originalUrl": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode",
|
||||
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=12e31ac07c6d337760b3f59dc64c03f26cdd2009"
|
||||
}
|
||||
},
|
||||
"version": 3
|
||||
|
|
14
flake.nix
14
flake.nix
|
@ -4,12 +4,14 @@
|
|||
description = "Genode packages";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.uri = "git+file:///home/repo/nixpkgs?ref=genode";
|
||||
dhall-haskell.uri =
|
||||
"git+https://github.com/dhall-lang/dhall-haskell?ref=flake";
|
||||
genode-depot.uri = "git+https://gitea.c3d2.de/ehmry/genode-depot.git";
|
||||
genode.uri = "git+https://gitea.c3d2.de/ehmry/genode.git";
|
||||
nixpkgs.uri = "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, dhall-haskell, genode-depot }:
|
||||
outputs = { self, dhall-haskell, genode-depot, genode, nixpkgs }:
|
||||
let
|
||||
systems = [ "x86_64-genode" ];
|
||||
|
||||
|
@ -23,10 +25,12 @@
|
|||
};
|
||||
|
||||
packages = forAllSystems (system:
|
||||
import ./packages.nix {
|
||||
let thisSystem = builtins.getAttr system;
|
||||
in import ./packages.nix {
|
||||
inherit system nixpkgs;
|
||||
depot = builtins.getAttr system genode-depot.packages;
|
||||
});
|
||||
depot = thisSystem genode-depot.packages;
|
||||
genode = thisSystem genode.packages;
|
||||
} // builtins.getAttr system genode.packages);
|
||||
|
||||
checks = forAllSystems (system:
|
||||
import ./tests {
|
||||
|
|
|
@ -41,12 +41,12 @@ in {
|
|||
let
|
||||
|
||||
inherit (hostPkgs) cdrkit syslinux;
|
||||
coreNovaObj = "${testPkgs.genode-base-nova}/lib/core-nova.o";
|
||||
coreNovaObj = "${testPkgs.base-nova}/lib/core-nova.o";
|
||||
|
||||
rom' = (with testPkgs; {
|
||||
init = "${genode-os}/bin/init";
|
||||
init = "${os}/bin/init";
|
||||
"ld.lib.so" = "${depot.base-nova}/lib/ld.lib.so";
|
||||
timer = "${genode-base-nova}/bin/nova_timer_drv";
|
||||
timer = "${base-nova}/bin/nova_timer_drv";
|
||||
}) // rom;
|
||||
|
||||
addressType = ".quad"; # TODO: 32bit?!
|
||||
|
|
13
packages.nix
13
packages.nix
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
|
||||
|
||||
{ system, nixpkgs, depot }:
|
||||
{ system, nixpkgs, depot, genode }:
|
||||
|
||||
let
|
||||
toolchainOverlay = import ./toolchain-overlay;
|
||||
|
@ -12,21 +12,14 @@ let
|
|||
|
||||
inherit (super) callPackage;
|
||||
|
||||
genode = (callPackage ./upstream { } // {
|
||||
nic_bus = callPackage ./pkgs/nic_bus { };
|
||||
});
|
||||
dhallPackages = super.dhallPackages // (callPackage ./dhall { });
|
||||
in rec {
|
||||
inherit (super) stdenv;
|
||||
genode-base = genode.base;
|
||||
genode-base-linux = genode.base-linux;
|
||||
genode-base-nova = genode.base-nova;
|
||||
genode-os = genode.os;
|
||||
libc = callPackage ./pkgs/libc { inherit depot; };
|
||||
stdcxx = callPackage ./pkgs/stdcxx { };
|
||||
|
||||
nic_bus = callPackage ./pkgs/nic_bus { inherit (genode) base os; };
|
||||
dhallGenode = dhallPackages.genode;
|
||||
dhallPrelude = dhallPackages.prelude;
|
||||
nova = callPackage ./NOVA { };
|
||||
solo5 = callPackage ./pkgs/solo5 { inherit genode-base genode-os; };
|
||||
solo5 = callPackage ./pkgs/solo5 { inherit (genode) base os; };
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
|
||||
|
||||
{ stdenv, buildPackages, fetchgit, genode, pkgconfig, tup }:
|
||||
{ stdenv, buildPackages, fetchgit, base, os, pkgconfig, tup }:
|
||||
|
||||
let
|
||||
tupArch = with stdenv.targetPlatform;
|
||||
|
@ -28,7 +28,7 @@ in stdenv.mkDerivation rec {
|
|||
|
||||
nativeBuildInputs = [ pkgconfig tup ];
|
||||
|
||||
buildInputs = [ genode.base genode.os ];
|
||||
buildInputs = [ base os ];
|
||||
|
||||
tupConfig = toTupConfig {
|
||||
TUP_ARCH = tupArch;
|
||||
|
@ -36,7 +36,7 @@ in stdenv.mkDerivation rec {
|
|||
};
|
||||
|
||||
configurePhase = ''
|
||||
cp -v ${genode.base.src}/Tuprules.tup .
|
||||
cp -v ${base.src}/Tuprules.tup .
|
||||
|
||||
# Configure Tup
|
||||
echo $tupConfig | tr ' CONFIG_' '\nCONFIG_' > tup.config
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
|
||||
|
||||
{ stdenv, buildPackages, fetchurl, llvmPackages, pkgconfig, genode-base, genode-os }:
|
||||
{ stdenv, buildPackages, fetchurl, llvmPackages, pkgconfig, base, os }:
|
||||
|
||||
let version = "0.6.3";
|
||||
in stdenv.mkDerivation {
|
||||
|
@ -13,7 +13,7 @@ in stdenv.mkDerivation {
|
|||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
|
||||
buildInputs = [ genode-base.dev genode-os.dev ];
|
||||
buildInputs = [ base.dev os.dev ];
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/Solo5/solo5/releases/download/v${version}/solo5-v${version}.tar.gz";
|
||||
|
|
|
@ -42,10 +42,10 @@ let
|
|||
bootModules' = {
|
||||
inherit testConfig;
|
||||
config = ./driver-config.xml;
|
||||
core = "${genode-base-linux}/bin/core-linux";
|
||||
init = "${genode-os}/bin/init";
|
||||
core = "${base-linux}/bin/core-linux";
|
||||
init = "${os}/bin/init";
|
||||
"ld.lib.so" = "${depot.base-linux}/lib/ld.lib.so";
|
||||
timer = "${genode-base-linux}/bin/linux_timer_drv";
|
||||
timer = "${base-linux}/bin/linux_timer_drv";
|
||||
} // bootModules;
|
||||
|
||||
baseSetup = with builtins;
|
||||
|
|
|
@ -8,11 +8,11 @@ testEnv.mkTest {
|
|||
testConfig = ./fs_report.xml;
|
||||
|
||||
bootModules = {
|
||||
fs_report = "${genode-os}/bin/fs_report";
|
||||
fs_rom = "${genode-os}/bin/fs_rom";
|
||||
ram_fs = "${genode-os}/bin/ram_fs";
|
||||
test-fs_report = "${genode-os}/bin/test-fs_report";
|
||||
"vfs.lib.so" = "${genode-os}/lib/vfs.lib.so";
|
||||
fs_report = "${os}/bin/fs_report";
|
||||
fs_rom = "${os}/bin/fs_rom";
|
||||
ram_fs = "${os}/bin/ram_fs";
|
||||
test-fs_report = "${os}/bin/test-fs_report";
|
||||
"vfs.lib.so" = "${os}/lib/vfs.lib.so";
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
|
|
|
@ -12,7 +12,7 @@ testEnv.mkTest rec {
|
|||
"libm.lib.so" = "${depot.libc}/lib/libm.lib.so";
|
||||
"posix.lib.so" = "${depot.posix}/lib/posix.lib.so";
|
||||
"test-libc" = "${depot.test-libc}/bin/test-libc";
|
||||
"vfs.lib.so" = "${genode-os}/lib/vfs.lib.so";
|
||||
"vfs.lib.so" = "${os}/lib/vfs.lib.so";
|
||||
};
|
||||
|
||||
qemuMem = 384;
|
||||
|
|
|
@ -7,7 +7,7 @@ testEnv.mkTest rec {
|
|||
|
||||
testConfig = testEnv.lib.renderDhallInit ./log.dhall "{=}";
|
||||
|
||||
bootModules.test-log = "${genode-base}/bin/test-log";
|
||||
bootModules.test-log = "${base}/bin/test-log";
|
||||
|
||||
testScript = "run_genode_until {Test done.} 10";
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ testEnv.mkTest {
|
|||
testConfig = testEnv.lib.renderDhallInit ./pci.dhall "{=}";
|
||||
|
||||
bootModules = {
|
||||
acpi_drv = "${genode-os}/bin/acpi_drv";
|
||||
platform_drv = "${genode-os}/bin/platform_drv";
|
||||
report_rom = "${genode-os}/bin/report_rom";
|
||||
test-pci = "${genode-os}/bin/test-pci";
|
||||
acpi_drv = "${os}/bin/acpi_drv";
|
||||
platform_drv = "${os}/bin/platform_drv";
|
||||
report_rom = "${os}/bin/report_rom";
|
||||
test-pci = "${os}/bin/test-pci";
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
|
|
|
@ -7,7 +7,7 @@ testEnv.mkTest rec {
|
|||
|
||||
testConfig = testEnv.lib.renderDhallInit ./signal.dhall "{=}";
|
||||
|
||||
bootModules.test-signal = "${genode-os}/bin/test-signal";
|
||||
bootModules.test-signal = "${os}/bin/test-signal";
|
||||
|
||||
testScript = "run_genode_until {--- Signalling test finished ---} 120";
|
||||
}
|
||||
|
|
|
@ -1,161 +0,0 @@
|
|||
# SPDX-FileCopyrightText: Emery Hemingway
|
||||
#
|
||||
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
|
||||
|
||||
{ stdenv, buildPackages, fetchgit, llvmPackages }:
|
||||
|
||||
let
|
||||
version = "19.08-64-g69eb762e4a";
|
||||
|
||||
inherit (stdenv) lib targetPlatform;
|
||||
specs = with targetPlatform; []
|
||||
++ lib.optional is32bit "32bit"
|
||||
++ lib.optional is64bit "64bit"
|
||||
++ lib.optional isAarch32 "arm"
|
||||
++ lib.optional isAarch64 "arm_64"
|
||||
++ lib.optional isRiscV "riscv"
|
||||
++ lib.optional isx86 "x86"
|
||||
++ lib.optional isx86_32 "x86_32"
|
||||
++ lib.optional isx86_64 "x86_64";
|
||||
|
||||
buildRepo = { repo, repoInputs }:
|
||||
let
|
||||
tupArch = with stdenv.targetPlatform;
|
||||
if isAarch32 then "arm" else
|
||||
if isAarch64 then "arm64" else
|
||||
if isx86_32 then "i386" else
|
||||
if isx86_64 then "x86_64" else
|
||||
abort "unhandled targetPlatform";
|
||||
|
||||
toTupConfig = attrs:
|
||||
with builtins;
|
||||
let op = config: name: "${config}CONFIG_${name}=${getAttr name attrs} ";
|
||||
in foldl' op "" (attrNames attrs);
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
name = "genode-${repo}-${version}";
|
||||
outputs = [ "out" "dev" ];
|
||||
inherit repo specs version;
|
||||
|
||||
src = fetchgit {
|
||||
url = "https://git.sr.ht/~ehmry/genode";
|
||||
rev = "c6c7870a2956e8120bf5333a8588e5603540b136";
|
||||
sha256 = "0xw0dhybjgj5y2cyw06i9hmjkn6ryl7pjrx5r9b3f659yn195f5q";
|
||||
fetchSubmodules = false;
|
||||
};
|
||||
|
||||
setupHook = ./../tool/setup-hooks.sh;
|
||||
|
||||
nativeBuildInputs = repoInputs;
|
||||
# This is wrong, why does pkg-config not collect buildInputs?
|
||||
|
||||
propagatedNativeBuildInputs = repoInputs;
|
||||
|
||||
depsBuildBuild = with buildPackages; [ llvm pkgconfig tup ];
|
||||
|
||||
tupConfig = toTupConfig {
|
||||
LIBCXX = llvmPackages.libcxx;
|
||||
LIBCXXABI = llvmPackages.libcxxabi;
|
||||
LIBUNWIND = llvmPackages.libunwind;
|
||||
LIBUNWIND_BAREMETAL =
|
||||
llvmPackages.libunwind.override { isBaremetal = true; };
|
||||
LINUX_HEADERS = buildPackages.glibc.dev;
|
||||
OLEVEL = "-O2";
|
||||
TUP_ARCH = tupArch;
|
||||
VERSION = version;
|
||||
};
|
||||
|
||||
configurePhase = ''
|
||||
# Configure Tup
|
||||
echo $tupConfig | tr ' CONFIG_' '\nCONFIG_' > tup.config
|
||||
echo CONFIG_NIX_OUTPUTS_OUT=$out >> tup.config
|
||||
echo CONFIG_NIX_OUTPUTS_DEV=$dev >> tup.config
|
||||
|
||||
# Disable other repos
|
||||
for R in repos/*; do
|
||||
[ "$R" != "repos/$repo" ] && find $R -name Tupfile -delete
|
||||
done
|
||||
find repos/gems -name Tupfile -delete
|
||||
|
||||
# Scan repository and generate script
|
||||
tup init
|
||||
tup generate buildPhase.sh
|
||||
|
||||
# Redirect artifacts to Nix store
|
||||
mkdir -p $out $dev/include
|
||||
ln -s $out out
|
||||
ln -s $dev dev
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
test -d repos/$repo/src/ld && cp -rv repos/$repo/src/ld $dev/
|
||||
pushd .
|
||||
set -v
|
||||
source buildPhase.sh
|
||||
set +v
|
||||
popd
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
# Populate the "dev" headers
|
||||
if [ -d "repos/$repo/include" ]; then
|
||||
for DIR in repos/$repo/include; do
|
||||
for SPEC in $specs; do
|
||||
if [ -d $DIR/spec/$SPEC ]; then
|
||||
cp -r $DIR/spec/$SPEC/* $dev/include
|
||||
rm -r $DIR/spec/$SPEC
|
||||
fi
|
||||
done
|
||||
rm -rf $DIR/spec
|
||||
cp -r $DIR $dev/
|
||||
done
|
||||
fi
|
||||
|
||||
touch $dev/.genode
|
||||
for pc in $dev/lib/pkgconfig/*.pc; do
|
||||
sed -i "s|-l:|$dev/lib/|g" $pc
|
||||
done
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description =
|
||||
"The Genode operation system framework (${repo} repository).";
|
||||
homepage = "https://genode.org/";
|
||||
license = licenses.agpl3;
|
||||
maintainers = [ maintainers.ehmry ];
|
||||
};
|
||||
|
||||
shellHook = ''
|
||||
export PROMPT_DIRTRIM=2
|
||||
export PS1="\[\033[1;30m\]Genode-dev [\[\033[1;37m\]\w\[\033[1;30m\]] $\[\033[0m\] "
|
||||
export PS2="\[\033[1;30m\]>\[\033[0m\] "
|
||||
if [ -e "configs/.gitignore" ]; then
|
||||
local CFG_PATH=configs/${targetPlatform.config}.config
|
||||
echo $tupConfig | tr ' CONFIG_' '\nCONFIG_' > $CFG_PATH
|
||||
echo "Tup configuration placed at $CFG_PATH, to activate run the following command:"
|
||||
echo " tup variant $CFG_PATH"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
in rec {
|
||||
base = buildRepo {
|
||||
repo = "base";
|
||||
repoInputs = [ ];
|
||||
};
|
||||
|
||||
base-linux = buildRepo {
|
||||
repo = "base-linux";
|
||||
repoInputs = [ base ];
|
||||
};
|
||||
|
||||
base-nova = buildRepo {
|
||||
repo = "base-nova";
|
||||
repoInputs = [ base ];
|
||||
};
|
||||
|
||||
os = buildRepo {
|
||||
repo = "os";
|
||||
repoInputs = [ base ];
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue