Browse Source

Initial Nix flake

20.02
Emery Hemingway 2 years ago
parent
commit
606b45b96a
  1. 30
      flake.lock
  2. 40
      flake.nix
  3. 29
      hydra/jobsets.json
  4. 78
      hydra/jobsets.nix
  5. 44
      hydra/solo5-jobs.nix
  6. 33
      hydra/solo5.nix
  7. 26
      packages.nix
  8. 4
      pkgs/solo5/default.nix
  9. 33
      release.nix
  10. 10
      tests/default.nix
  11. 8
      tests/driver-nova.nix
  12. 20
      tests/solo5/default.nix

30
flake.lock

@ -0,0 +1,30 @@
{
"inputs": {
"dhall-haskell": {
"inputs": {
"nixpkgs": {
"inputs": {},
"narHash": "sha256-wJg4DA700SoQbEz61448sR6BgxRa1R92K3vvCV1g+HY=",
"originalUri": "git+https://github.com/nixos/nixpkgs.git?ref=18.09-beta&rev=1d4de0d552ae9aa66a5b8dee5fb0650a4372d148",
"uri": "git+https://github.com/nixos/nixpkgs.git?ref=18.09-beta&rev=1d4de0d552ae9aa66a5b8dee5fb0650a4372d148"
},
"nixpkgsStaticLinux": {
"inputs": {},
"narHash": "sha256-famU3pJZ4vkElV9qc71HmyRVSvcrAhfMZ0UJKpmmKP8=",
"originalUri": "git+https://github.com/nh2/nixpkgs.git?ref=static-haskell-nix-stack-dhall-working",
"uri": "git+https://github.com/nh2/nixpkgs.git?ref=static-haskell-nix-stack-dhall-working&rev=925aac04f4ca58aceb83beef18cb7dae0715421b"
}
},
"narHash": "sha256-NGbS2bymVuCQcanlBO41I6ZjSAZSLXhACK3qQU25zUs=",
"originalUri": "git+https://git.sr.ht/~ehmry/dhall-haskell?ref=flake",
"uri": "git+https://git.sr.ht/~ehmry/dhall-haskell?ref=flake&rev=256810cd5adf1ae5862eed0ffdaab4cf49f6fe67"
},
"nixpkgs": {
"inputs": {},
"narHash": "sha256-v6oDxjvJ7c0BWZJ/fd4L1gtnctQvkkFjL41lEt37vLg=",
"originalUri": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genodeFlake",
"uri": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genodeFlake&rev=28f37882fbb71230d6947af244a34cd3d42b280a"
}
},
"version": 3
}

40
flake.nix

@ -0,0 +1,40 @@
{
edition = 201909;
description = "Genode package overlay";
inputs = {
nixpkgs = {
uri = "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genodeFlake";
flake = false;
};
dhall-haskell = { uri = "git+https://git.sr.ht/~ehmry/dhall-haskell?ref=flake"; };
};
outputs = { self, nixpkgs, dhall-haskell }:
let fullPkgs = import ./packages.nix { inherit nixpkgs; };
in {
packages = with fullPkgs; {
inherit stdenv nova genode-os genode-base genode-base-nova
genode-base-linux solo5;
};
defaultPackage = self.packages.solo5;
hydraJobs = {
build.x86_64 = {
inherit (self.packages)
nova stdenv solo5 genode-base-linux genode-base-nova genode-os;
};
tests = import ./tests {
inherit nixpkgs dhall-haskell;
genodepkgs = fullPkgs;
};
};
checks = self.hydraJobs.tests.x86_64.nova.solo5;
};
}

29
hydra/jobsets.json

@ -1,29 +0,0 @@
{
"enabled": 1,
"hidden": true,
"description": ".jobsets",
"nixexprinput": "genodepkgs",
"nixexprpath": "hydra/jobsets.nix",
"checkinterval": 300,
"schedulingshares": 100,
"enableemail": false,
"emailoverride": "ehmry@posteo.net",
"keepnr": 3,
"inputs": {
"genodepkgs": {
"type": "git",
"value": "https://gitea.c3d2.de/ehmry/genodepkgs.git master",
"emailresponsible": false
},
"nixpkgs": {
"type": "git",
"value": "https://gitea.c3d2.de/ehmry/nixpkgs.git hybrid-19.09",
"emailresponsible": false
},
"solo5PullRequests": {
"type": "githubpulls",
"value": "solo5 solo5",
"emailresponsible": false
}
}
}

78
hydra/jobsets.nix

@ -1,78 +0,0 @@
{ genodepkgs ? ../default.nix
, nixpkgs ? import ../nixpkgs.nix
, solo5PullRequests
}:
let
pkgs = import nixpkgs { };
mkJobSet = { description, nixexprpath, inputs }: {
inherit description nixexprpath inputs;
enabled = 1;
hidden = false;
nixexprinput = "genodepkgs";
checkinterval = 300;
schedulingshares = 100;
enableemail = false;
emailoverride = "";
keepnr = 8;
};
releaseInputs = {
dhall-haskell = {
type = "git";
value = "https://github.com/dhall-lang/dhall-haskell.git master";
emailresponsible = false;
};
dhallNixpkgsStaticLinux = {
type = "git";
value =
"https://github.com/nh2/nixpkgs.git 925aac04f4ca58aceb83beef18cb7dae0715421b";
emailresponsible = false;
};
dhallNixpkgs = {
type = "git";
value =
"https://gitea.c3d2.de/ehmry/nixpkgs.git 1d4de0d552ae9aa66a5b8dee5fb0650a4372d148";
emailresponsible = false;
};
genodepkgs = {
type = "git";
value = "https://gitea.c3d2.de/ehmry/genodepkgs.git master";
emailresponsible = false;
};
nixpkgs = {
type = "git";
value = "https://gitea.c3d2.de/ehmry/nixpkgs.git hybrid-19.09";
emailresponsible = false;
};
nim-overlay = {
type = "git";
value = "https://git.sr.ht/~ehmry/nim-overlay";
emailresponsible = false;
};
};
solo5 = import ./solo5-jobs.nix {
inherit releaseInputs;
pullRequests = solo5PullRequests;
};
jobsets = ({
trunk = mkJobSet {
description = "Genodepkgs master branch";
nixexprpath = "release.nix";
inputs = releaseInputs;
};
} // solo5);
in { jobsets = pkgs.writeText "jobsets.json" (builtins.toJSON jobsets); }

44
hydra/solo5-jobs.nix

@ -1,44 +0,0 @@
# SPDX-FileCopyrightText: Emery Hemingway
#
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
{ releaseInputs, pullRequests }:
with builtins;
let
pullRequests' = fromJSON (readFile pullRequests);
prToJob = pr: {
name = "solo5-${toString pr.number}";
value = {
description = pr.title;
nixexprpath = "hydra/solo5.nix";
enabled = 1;
hidden = false;
nixexprinput = "genodepkgs";
checkinterval = 300;
schedulingshares = 100;
enableemail = false;
emailoverride = "";
keepnr = 8;
inputs = releaseInputs // {
prSrc = {
type = "git";
value = "https://github.com/Solo5/solo5.git pull/${
toString pr.number
}/head";
emailresponsible = false;
};
};
};
};
jobs = map prToJob (attrValues pullRequests');
in listToAttrs jobs

33
hydra/solo5.nix

@ -1,33 +0,0 @@
# SPDX-FileCopyrightText: Emery Hemingway
#
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
{ genodepkgs, nixpkgs, dhall-haskell, dhallNixpkgs, dhallNixpkgsStaticLinux
, nim-overlay, prSrc }:
let
prOverride = attrs: {
src = prSrc;
preConfigure = ''
cat <<EOM >include/solo5/solo5_version.h.distrib
#ifndef __VERSION_H__
#define __VERSION_H__
#define SOLO5_VERSION "pull-request-test"
#endif
EOM
'';
};
extraOverlays =
[ (self: super: { solo5 = super.solo5.overrideAttrs prOverride; }) ];
release = import ../release.nix {
inherit dhall-haskell dhallNixpkgs dhallNixpkgsStaticLinux nixpkgs
genodepkgs nim-overlay extraOverlays;
};
in {
build.x86_64.solo5 = release.build.x86_64.solo5;
tests.x86_64.nova.solo5 = release.tests.x86_64.nova.solo5;
}

26
default.nix → packages.nix

@ -5,13 +5,21 @@
let
nativeOverlay = self: super:
# Overlay of locally defined packages
with self; {
depot = callPackage ./depot { };
dhallPackages = super.dhallPackages // (callPackage ./dhall { });
with self;
let
genode = (callPackage ./upstream { } // {
libc = callPackage ./pkgs/libc { };
nic_bus = callPackage ./pkgs/nic_bus { };
});
dhallPackages = super.dhallPackages // (callPackage ./dhall { });
in {
genode-base = genode.base;
genode-base-linux = genode.base-linux;
genode-base-nova = genode.base-nova;
genode-os = genode.os;
depot = callPackage ./depot { };
dhallGenode = dhallPackages.genode;
dhallPrelude = dhallPackages.prelude;
nova = callPackage ./NOVA { };
solo5 = callPackage ./pkgs/solo5 { };
};
@ -19,15 +27,11 @@ let
toolchainOverlay = import ./toolchain-overlay;
# Overlay of toolchain patches
in { nixpkgs ? ../nixpkgs, nim-overlay ? <nim-overlay>, extraOverlays ? [] }:
in { nixpkgs, extraOverlays ? [ ] }:
import nixpkgs {
# Evaluate an overlayed Nixpkgs for a Genode target
config.allowUnsupportedSystem = true;
crossSystem = {
isx86_64 = true;
isGenode = true;
imports = [ ./platform.nix ];
};
overlays = [ toolchainOverlay nativeOverlay (import nim-overlay) ] ++ extraOverlays;
localSystem = "x86_64-linux";
crossSystem = "x86_64-genode";
overlays = [ toolchainOverlay nativeOverlay ] ++ extraOverlays;
}

4
pkgs/solo5/default.nix

@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
{ stdenv, buildPackages, fetchurl, llvmPackages, pkgconfig, genode }:
{ stdenv, buildPackages, fetchurl, llvmPackages, pkgconfig, genode-base, genode-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 = [ genode-base.dev genode-os.dev ];
src = fetchurl {
url = "https://github.com/Solo5/solo5/releases/download/v${version}/solo5-v${version}.tar.gz";

33
release.nix

@ -1,33 +0,0 @@
# SPDX-FileCopyrightText: Emery Hemingway
#
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
let dhallPinned = import ../dhall-haskell/nix/pinnedNixpkgs.nix; in
{ genodepkgs ? ./default.nix
, nixpkgs ? import ./nixpkgs.nix
, dhall-haskell ? <dhall-haskell>
, dhallNixpkgs ? dhallPinned.nixpkgs
, dhallNixpkgsStaticLinux ? dhallPinned.nixpkgsStaticLinux
, nim-overlay ? <nim-overlay>
, extraOverlays ? []
}:
let
pkgs = import genodepkgs { inherit nixpkgs nim-overlay extraOverlays; };
dhall-haskell' = import (dhall-haskell + "/release.nix") {
nixpkgs = dhallNixpkgs;
nixpkgsStaticLinux = dhallNixpkgsStaticLinux;
};
in {
build.x86_64 = {
inherit (pkgs) nova stdenv solo5;
genode = removeAttrs pkgs.genode [ "override" "overrideDerivation" ];
};
tests = import ./tests {
inherit nixpkgs;
genodepkgs = pkgs;
dhall-haskell = dhall-haskell';
};
}

10
tests/default.nix

@ -11,12 +11,12 @@ let
solo5 = call ./solo5 { };
};
in { genodepkgs ? import ./../default.nix { }, nixpkgs ? import ./../nixpkgs.nix
, dhall-haskell }:
in { genodepkgs, nixpkgs, dhall-haskell }:
let
hostPkgs = import nixpkgs {
overlays = [ (self: super: { dhall = dhall-haskell.linux-dhall; }) ];
system = "x86_64-linux";
overlays = [ (self: super: { inherit (dhall-haskell.packages) dhall; }) ];
};
testPkgs = genodepkgs;
@ -40,8 +40,8 @@ let
buildInputs = [ hostPkgs.dhall ];
initConfig = path;
initArgs = args;
DHALL_PRELUDE = "${testPkgs.dhallPackages.prelude}/package.dhall";
DHALL_GENODE = "${testPkgs.dhallPackages.genode}/package.dhall";
DHALL_PRELUDE = "${testPkgs.dhallPrelude}/package.dhall";
DHALL_GENODE = "${testPkgs.dhallGenode}/package.dhall";
} ''
export XDG_CACHE_HOME=$NIX_BUILD_TOP
dhall text \

8
tests/driver-nova.nix

@ -38,7 +38,7 @@ let
mkIso = import ./nova-iso.nix {
inherit hostPkgs testPkgs;
coreNovaObj = "${testPkgs.genode.base-nova}/lib/core-nova.o";
coreNovaObj = "${testPkgs.genode-base-nova}/lib/core-nova.o";
};
mkTest = { name ? "unamed", testScript, testConfig, bootModules, qemuMem ? 32
@ -48,9 +48,9 @@ let
{
inherit testConfig;
config = ./driver-config.xml;
init = "${genode.os}/bin/init";
init = "${genode-os}/bin/init";
"ld.lib.so" = "${depot.base-nova}/lib/ld.lib.so";
timer = "${genode.base-nova}/bin/nova_timer_drv";
timer = "${genode-base-nova}/bin/nova_timer_drv";
} // bootModules);
iso = mkIso bootModules';
@ -94,7 +94,7 @@ let
}
global spawn_id
spawn ${hostPkgs.qemu}/bin/qemu-system-x86_64 -cdrom ${iso} -nographic \
spawn ${hostPkgs.qemu_test}/bin/qemu-system-x86_64 -cdrom ${iso} -nographic \
-machine q35 -m size=${toString qemuMem}
wait_for_output $wait_for_re $timeout_value $spawn_id
}

20
tests/solo5/default.nix

@ -28,7 +28,7 @@ let
name = "blk";
bootModules = {
test = "${solo5.tests}/bin/solo5-test_blk";
ram_block = "${genode.os}/bin/ram_block";
ram_block = "${genode-os}/bin/ram_block";
};
testConfig = testEnv.lib.renderDhallInit ./blk.dhall "{=}";
}
@ -69,7 +69,7 @@ let
name = "mft_maxdevices";
bootModules = {
test = "${solo5.tests}/bin/solo5-test_mft_maxdevices";
rom_block = "${genode.os}/bin/rom_block";
rom_block = "${genode-os}/bin/rom_block";
};
testConfig = testEnv.lib.renderDhallInit ./mft_maxdevices.dhall "{=}";
}
@ -79,9 +79,9 @@ let
name = "net";
bootModules = {
test = "${solo5.tests}/bin/solo5-test_net";
nic_bridge = "${genode.os}/bin/nic_bridge";
nic_loopback = "${genode.os}/bin/nic_loopback";
ping = "${genode.os}/bin/ping";
nic_bridge = "${genode-os}/bin/nic_bridge";
nic_loopback = "${genode-os}/bin/nic_loopback";
ping = "${genode-os}/bin/ping";
};
testConfig = testEnv.lib.renderDhallInit ./net.dhall "{=}";
testScript = ''
@ -93,10 +93,10 @@ let
name = "net_2if";
bootModules = {
test = "${solo5.tests}/bin/solo5-test_net_2if";
sequence = "${genode.os}/bin/sequence";
nic_bridge = "${genode.os}/bin/nic_bridge";
nic_loopback = "${genode.os}/bin/nic_loopback";
ping = "${genode.os}/bin/ping";
sequence = "${genode-os}/bin/sequence";
nic_bridge = "${genode-os}/bin/nic_bridge";
nic_loopback = "${genode-os}/bin/nic_loopback";
ping = "${genode-os}/bin/ping";
};
testConfig = testEnv.lib.renderDhallInit ./net_2if.dhall "{=}";
testScript = ''
@ -151,7 +151,7 @@ let
name = "time";
bootModules = {
test = "${solo5.tests}/bin/solo5-test_time";
rtc_drv = "${genode.os}/bin/rtc_drv";
rtc_drv = "${genode-os}/bin/rtc_drv";
};
testConfig = testEnv.lib.renderDhallInit ./time.dhall "{=}";
}

Loading…
Cancel
Save