From e4ed185e8bb1ce1e67f363439d135edd782adad3 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 18 Sep 2020 19:14:40 +0200 Subject: [PATCH] rsync package overrides --- overlay/default.nix | 5 ++ tests/posix.dhall | 14 ++--- tests/rsync.dhall | 121 ++++++++++++++++++++++++++++++++++++++++++++ tests/rsync.nix | 30 +++++++++++ 4 files changed, 164 insertions(+), 6 deletions(-) create mode 100644 tests/rsync.dhall create mode 100644 tests/rsync.nix diff --git a/overlay/default.nix b/overlay/default.nix index a14f8a0..a3c3665 100644 --- a/overlay/default.nix +++ b/overlay/default.nix @@ -1,6 +1,9 @@ final: prev: with prev; let + overrideHost = drv: attrs: + if hostPlatform.isGenode then drv.override attrs else drv; + overrideHostAttrs = drv: f: if hostPlatform.isGenode then drv.overrideAttrs f else drv; @@ -89,6 +92,8 @@ in { "rm $out/bin/c_rehash"; # eliminate the perl runtime dependency }); + rsync = overrideHost rsync { enableACLs = false; }; + solo5-tools = callPackage ./solo5-tools { }; tup = prev.tup.overrideAttrs (attrs: { setupHook = ./tup/setup-hook.sh; }); diff --git a/tests/posix.dhall b/tests/posix.dhall index 5e700a5..af0de26 100644 --- a/tests/posix.dhall +++ b/tests/posix.dhall @@ -24,11 +24,13 @@ in λ(params : { bash : Text, coreutils : Text, script : Text }) → Child.Attributes::{ , binary = "vfs" , config = Init.Config::{ + , attributes = toMap { ld_verbose = "yes" } , content = [ Prelude.XML.text '' - + + @@ -41,7 +43,7 @@ in λ(params : { bash : Text, coreutils : Text, script : Text }) → } , provides = [ "File_system" ] , resources = Genode.Init.Resources::{ - , caps = 256 + , caps = 512 , ram = Genode.units.MiB 8 } , routes = @@ -58,7 +60,7 @@ in λ(params : { bash : Text, coreutils : Text, script : Text }) → , provides = [ "ROM" ] , resources = Init.Resources::{ , caps = 256 - , ram = Genode.units.MiB 4 + , ram = Genode.units.MiB 8 } , routes = [ Init.ServiceRoute.parentLabel @@ -75,7 +77,7 @@ in λ(params : { bash : Text, coreutils : Text, script : Text }) → , content = [ Prelude.XML.text '' - + '' ] @@ -92,8 +94,8 @@ in λ(params : { bash : Text, coreutils : Text, script : Text }) → } , exitPropagate = True , resources = Genode.Init.Resources::{ - , caps = 256 - , ram = Genode.units.MiB 8 + , caps = 1024 + , ram = Genode.units.MiB 32 } , routes = [ Init.ServiceRoute.child "File_system" "vfs" diff --git a/tests/rsync.dhall b/tests/rsync.dhall new file mode 100644 index 0000000..afa7373 --- /dev/null +++ b/tests/rsync.dhall @@ -0,0 +1,121 @@ +let Test = ./test.dhall ? env:DHALL_GENODE_TEST + +let Genode = Test.Genode + +let Prelude = Genode.Prelude + +let XML = Prelude.XML + +let Init = Genode.Init + +let Child = Init.Child + +in λ(params : { bash : Text, coreutils : Text, script : Text }) → + let init = + Init::{ + , verbose = True + , routes = + [ Init.ServiceRoute.parent "Timer" + , Init.ServiceRoute.parent "Rtc" + ] + , children = toMap + { vfs = + Child.flat + Child.Attributes::{ + , binary = "vfs" + , config = Init.Config::{ + , content = + [ Prelude.XML.text + '' + + + + + + + + '' + ] + , defaultPolicy = Some Init.Config.DefaultPolicy::{ + , attributes = toMap { root = "/", writeable = "yes" } + } + } + , provides = [ "File_system" ] + , resources = Genode.Init.Resources::{ + , caps = 256 + , ram = Genode.units.MiB 8 + } + , routes = + Prelude.List.map + Text + Init.ServiceRoute.Type + Init.ServiceRoute.parent + [ "File_system", "Rtc" ] + } + , store_rom = + Child.flat + Child.Attributes::{ + , binary = "cached_fs_rom" + , provides = [ "ROM" ] + , resources = Init.Resources::{ + , caps = 256 + , ram = Genode.units.MiB 4 + } + , routes = + [ Init.ServiceRoute.parentLabel + "File_system" + (None Text) + (Some "nix") + ] + } + , shell = + Child.flat + Child.Attributes::{ + , binary = "bash" + , config = Genode.Init.Config::{ + , content = + [ Prelude.XML.text + '' + + + '' + ] + # Prelude.List.map + Text + XML.Type + ( λ(x : Text) → + XML.leaf + { name = "arg" + , attributes = toMap { value = x } + } + ) + [ "bash", params.script ] + } + , exitPropagate = True + , resources = Genode.Init.Resources::{ + , caps = 1024 + , ram = Genode.units.MiB 32 + } + , routes = + [ Init.ServiceRoute.child "File_system" "vfs" + , { service = + { name = "ROM" + , label = + Init.LabelSelector.Type.Partial + { prefix = Some "/nix/store/" + , suffix = None Text + } + } + , route = + Init.Route.Type.Child + { name = "store_rom" + , label = None Text + , diag = None Bool + } + } + ] + } + } + } + + in Test::{ children = Test.initToChildren init } diff --git a/tests/rsync.nix b/tests/rsync.nix new file mode 100644 index 0000000..72597f4 --- /dev/null +++ b/tests/rsync.nix @@ -0,0 +1,30 @@ +{ pkgs, legacyPackages, ... }: +with pkgs; + +let + inherit (legacyPackages) bash coreutils; + script = with legacyPackages; + writeTextFile { + name = "rsync.sh"; + text = '' + export PATH=${ + lib.makeSearchPathOutput "bin" "bin" + (with legacyPackages; [ bash coreutils rsync ]) + } + set -v + rsync --version + rsync -r /nix + ''; + }; +in rec { + name = "rsync"; + machine = { + config = '' + ${ + ./posix.dhall + } { bash = \"${bash}\", coreutils = \"${coreutils}\", script = \"${script}\" }''; + inputs = map pkgs.genodeSources.depot [ "libc" "posix" "vfs_pipe" "vfs" ] + ++ [ bash ]; + extraPaths = [ script ] ++ (with legacyPackages; [ coreutils rsync ]); + }; +}