~ehmry/sigil

93fa3e16bba3ee3ea870ffe3d036189c15859e36 — Emery Hemingway 3 years ago e4ed185 tor-rsync
tor package overrides

Patch libc to add missing symbols
5 files changed, 74 insertions(+), 122 deletions(-)

M overlay/default.nix
M packages/genodelabs/libc.patch
M tests/default.nix
D tests/rsync.dhall
A tests/tor.nix
M overlay/default.nix => overlay/default.nix +5 -0
@@ 96,6 96,8 @@ in {

  solo5-tools = callPackage ./solo5-tools { };

  tor = overrideHost tor { torsocks = "/dev/null"; };

  tup = prev.tup.overrideAttrs (attrs: { setupHook = ./tup/setup-hook.sh; });

  zlib = overrideHostAttrs zlib (attrs: {


@@ 106,4 108,7 @@ in {
      popd
    '';
  });

  zstd = overrideHostAttrs zstd
    (attrs: { outputs = builtins.filter (o: o != "man") attrs.outputs; });
}

M packages/genodelabs/libc.patch => packages/genodelabs/libc.patch +38 -0
@@ 85,3 85,41 @@ index 150640ddf3..e511897600 100644
 DUMMY(int   , -1, getpriority, (int, int))
 DUMMY(int   , -1, getrusage, (int, rusage *))
 DUMMY_SILENT(uid_t ,  0, getuid, (void))
commit 59f4ca28368f94dc3e94ac4a1b1ce275fd4f747f
Author: Emery Hemingway <ehmry@posteo.net>
Date:   Sat Sep 19 10:50:10 2020 +0200

    libc: build RFC2553 Interface Identification API

diff --git a/repos/libports/lib/mk/libc-net.mk b/repos/libports/lib/mk/libc-net.mk
index 3fb1e946fe..2a615ba043 100644
--- a/repos/libports/lib/mk/libc-net.mk
+++ b/repos/libports/lib/mk/libc-net.mk
@@ -21,6 +21,9 @@ SRC_C += vars.c
 # b64_ntop
 SRC_C += base64.c
 
+# RFC 2553
+SRC_C += if_indextoname.c if_nameindex.c if_nametoindex.c
+
 # suppress "warning: ‘strncpy’ specified bound depends on the length of the source argument"
 CC_OPT_getaddrinfo := -Wno-stringop-overflow
 
commit 481b5b6a92dde0ba6c129da3bf1dcade9f5c350f
Author: Emery Hemingway <ehmry@posteo.net>
Date:   Sat Sep 19 12:04:22 2020 +0200

    libc: build readpassphrase.c

diff --git a/repos/libports/lib/mk/libc-gen.inc b/repos/libports/lib/mk/libc-gen.inc
index ab0ce929aa..1c7f84e800 100644
--- a/repos/libports/lib/mk/libc-gen.inc
+++ b/repos/libports/lib/mk/libc-gen.inc
@@ -40,7 +40,6 @@ FILTER_OUT_C += \
 	getentropy.c \
 	getutxent.c \
 	pututxline.c \
-	readpassphrase.c \
 	scandir_b.c \
 	sem_new.c \
 	signal.c \

M tests/default.nix => tests/default.nix +1 -1
@@ 9,7 9,7 @@ let
    };

  testFiles =
    map callTest [ ./log.nix ./posix.nix ./vmm_arm.nix ./vmm_x86.nix ./x86.nix ]
    map callTest [ ./log.nix ./posix.nix ./tor.nix ./vmm_arm.nix ./vmm_x86.nix ./x86.nix ]
    ++ (callTest ./solo5);

  testPkgs = genodepkgs;

D tests/rsync.dhall => tests/rsync.dhall +0 -121
@@ 1,121 0,0 @@
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
                              ''
                              <vfs>
                              <dir name="dev"> <log name="stdout" label="stdout"/> <log name="stderr" label="stderr"/> <null/> <rtc/> <zero/> </dir>
                              <dir name="pipe"> <pipe/> </dir>
                              <dir name="usr"><dir name="bin"><symlink name="env" target="${params.coreutils}/bin/env"/></dir></dir>
                              <dir name="tmp"><ram/></dir>
                              <dir name="nix"><fs label="nix" root="nix"/></dir>
                              </vfs>
                              ''
                          ]
                        , 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
                                  ''
                                  <libc stdin="/dev/null" stdout="/dev/stdout" stderr="/dev/stderr" pipe="/pipe" rtc="/dev/rtc"/>
                                  <vfs> <fs/> </vfs>
                                  ''
                              ]
                            # 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 }

A tests/tor.nix => tests/tor.nix +30 -0
@@ 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 tor ])
        }
        set -v
        tor --version
        tor
      '';
    };
in rec {
  name = "tor";
  machine = {
    config = ''
      ${
        ./posix.dhall
      } { bash = \"${bash}\", coreutils = \"${coreutils}\", script = \"${script}\" }'';
    inputs = map pkgs.genodeSources.depot [ "libc" "posix" "vfs_pipe" "vfs" ]
      ++ [ bash legacyPackages.zlib ];
    extraPaths = [ script ] ++ (with legacyPackages; [ coreutils tor ]);
  };
}