2
0
Fork 0

nixos: pass binary seperately from args in systemd wrapper

This commit is contained in:
Emery Hemingway 2020-11-29 14:49:52 +01:00
parent bf4a673c98
commit 526e7bafc1
2 changed files with 15 additions and 7 deletions

View File

@ -16,7 +16,11 @@ let parentRoutes =
Prelude.List.map Text Init.ServiceRoute.Type Init.ServiceRoute.parent
in λ ( params
: { args : List Text, coreutils : Text, interface : Optional Text }
: { args : List Text
, binary : Text
, coreutils : Text
, interface : Optional Text
}
) →
let socketsVfs =
merge
@ -112,7 +116,7 @@ in λ ( params
, ExecStart =
Child.flat
Child.Attributes::{
, binary = "bash"
, binary = params.binary
, exitPropagate = True
, resources = Genode.Init.Resources::{
, caps = 256
@ -125,10 +129,11 @@ in λ ( params
, stdout = Some "/dev/log"
, stderr = Some "/dev/log"
, pipe = Some "/dev/pipes"
, rng = Some "/dev/random"
, rtc = Some "/dev/rtc"
, socket = Some "/dev/sockets"
, vfs = [ VFS.leaf "fs" ]
, args = params.args
, args = [ params.binary ] # params.args
}
)
with attributes = toMap { ld_verbose = "yes" }

View File

@ -43,12 +43,14 @@ with lib; {
libc
posix
vfs
vfs_jitterentropy
vfs_pipe
];
configFile = let
args = ''[ "'' + concatStringsSep ''", "''
((lib.strings.splitString " ")
(toString service.serviceConfig.ExecStart)) + ''" ]'';
args = lib.strings.splitString " "
(toString service.serviceConfig.ExecStart);
binary = builtins.head args;
args' = ''[ "${concatStringsSep ''", "'' (builtins.tail args)}" ]'';
# TODO: service.environment;
interface = if service.genode.interface == null then
"None Text"
@ -56,7 +58,8 @@ with lib; {
''Some "${service.genode.interface}"'';
in pkgs.writeText "${name'}.dhall" ''
${./systemd-runner.dhall} {
, args = ${args}
, args = ${args'}
, binary = "${binary}"
, coreutils = "${pkgs.coreutils}"
, interface = ${interface}
}