Browse Source

nixos: move ExecStart to end of systemd children list

dabus
Emery Hemingway 7 months ago
parent
commit
5d4fee3bf2
1 changed files with 127 additions and 119 deletions
  1. 127
    119
      nixos-modules/systemd-runner.dhall

+ 127
- 119
nixos-modules/systemd-runner.dhall View File

@@ -40,131 +40,139 @@ in  λ ( params
40 40
             Init::{
41 41
             , routes =
42 42
                 parentRoutes [ "File_system", "Rtc", "Terminal", "Timer" ]
43
-            , children = toMap
44
-                { vfs =
45
-                    Child.flat
46
-                      Child.Attributes::{
47
-                      , binary = "vfs"
48
-                      , exitPropagate = True
49
-                      , resources = Genode.Init.Resources::{
50
-                        , caps = 256
51
-                        , ram = Genode.units.MiB 8
52
-                        }
53
-                      , config = Init.Config::{
54
-                        , content =
55
-                          [ VFS.vfs
56
-                              (   [ VFS.dir
57
-                                      "dev"
58
-                                      (   [ VFS.dir "pipes" [ VFS.leaf "pipe" ]
59
-                                          , VFS.leaf "log"
60
-                                          , VFS.leaf "null"
61
-                                          , VFS.leafAttrs
62
-                                              "terminal"
63
-                                              ( toMap
64
-                                                  { name = "entropy"
65
-                                                  , label = "entropy"
66
-                                                  }
67
-                                              )
68
-                                          , VFS.leaf "rtc"
69
-                                          , VFS.leaf "zero"
70
-                                          ]
71
-                                        # socketsVfs
72
-                                      )
73
-                                  , VFS.dir
74
-                                      "usr"
75
-                                      [ VFS.dir
76
-                                          "bin"
77
-                                          [ VFS.symlink
78
-                                              "env"
79
-                                              "${params.coreutils}/bin/env"
43
+            , children =
44
+                  toMap
45
+                    { vfs =
46
+                        Child.flat
47
+                          Child.Attributes::{
48
+                          , binary = "vfs"
49
+                          , exitPropagate = True
50
+                          , resources = Genode.Init.Resources::{
51
+                            , caps = 256
52
+                            , ram = Genode.units.MiB 8
53
+                            }
54
+                          , config = Init.Config::{
55
+                            , content =
56
+                              [ VFS.vfs
57
+                                  (   [ VFS.dir
58
+                                          "dev"
59
+                                          (   [ VFS.dir
60
+                                                  "pipes"
61
+                                                  [ VFS.leaf "pipe" ]
62
+                                              , VFS.leaf "log"
63
+                                              , VFS.leaf "null"
64
+                                              , VFS.leafAttrs
65
+                                                  "terminal"
66
+                                                  ( toMap
67
+                                                      { name = "entropy"
68
+                                                      , label = "entropy"
69
+                                                      }
70
+                                                  )
71
+                                              , VFS.leaf "rtc"
72
+                                              , VFS.leaf "zero"
73
+                                              ]
74
+                                            # socketsVfs
75
+                                          )
76
+                                      , VFS.dir
77
+                                          "usr"
78
+                                          [ VFS.dir
79
+                                              "bin"
80
+                                              [ VFS.symlink
81
+                                                  "env"
82
+                                                  "${params.coreutils}/bin/env"
83
+                                              ]
80 84
                                           ]
81
-                                      ]
82
-                                  , VFS.dir "tmp" [ VFS.leaf "ram" ]
83
-                                  , VFS.dir
84
-                                      "nix"
85
-                                      [ VFS.dir
86
-                                          "store"
87
-                                          [ VFS.fs
88
-                                              VFS.FS::{ label = "nix-store" }
85
+                                      , VFS.dir "tmp" [ VFS.leaf "ram" ]
86
+                                      , VFS.dir
87
+                                          "nix"
88
+                                          [ VFS.dir
89
+                                              "store"
90
+                                              [ VFS.fs
91
+                                                  VFS.FS::{
92
+                                                  , label = "nix-store"
93
+                                                  }
94
+                                              ]
89 95
                                           ]
90 96
                                       ]
91
-                                  ]
92
-                                # params.extraVfs
93
-                              )
94
-                          ]
95
-                        , policies =
96
-                          [ Init.Config.Policy::{
97
-                            , service = "File_system"
98
-                            , label = Init.LabelSelector.prefix "ExecStart"
99
-                            , attributes = toMap
100
-                                { root = "/", writeable = "yes" }
97
+                                    # params.extraVfs
98
+                                  )
99
+                              ]
100
+                            , policies =
101
+                              [ Init.Config.Policy::{
102
+                                , service = "File_system"
103
+                                , label = Init.LabelSelector.prefix "ExecStart"
104
+                                , attributes = toMap
105
+                                    { root = "/", writeable = "yes" }
106
+                                }
107
+                              , Init.Config.Policy::{
108
+                                , service = "File_system"
109
+                                , label = Init.LabelSelector.prefix "vfs_rom"
110
+                                , attributes = toMap
111
+                                    { root = "/", writeable = "no" }
112
+                                }
113
+                              ]
101 114
                             }
102
-                          , Init.Config.Policy::{
103
-                            , service = "File_system"
104
-                            , label = Init.LabelSelector.prefix "vfs_rom"
105
-                            , attributes = toMap
106
-                                { root = "/", writeable = "no" }
115
+                          }
116
+                    , vfs_rom =
117
+                        Child.flat
118
+                          Child.Attributes::{
119
+                          , binary = "cached_fs_rom"
120
+                          , resources = Genode.Init.Resources::{
121
+                            , ram = Genode.units.MiB 32
107 122
                             }
108
-                          ]
109
-                        }
110
-                      }
111
-                , vfs_rom =
112
-                    Child.flat
113
-                      Child.Attributes::{
114
-                      , binary = "cached_fs_rom"
115
-                      , resources = Genode.Init.Resources::{
116
-                        , ram = Genode.units.MiB 32
117
-                        }
118
-                      , config = Init.Config::{
119
-                        , policies =
120
-                          [ Init.Config.Policy::{
121
-                            , service = "ROM"
122
-                            , label = Init.LabelSelector.prefix "ExecStart"
123
+                          , config = Init.Config::{
124
+                            , policies =
125
+                              [ Init.Config.Policy::{
126
+                                , service = "ROM"
127
+                                , label = Init.LabelSelector.prefix "ExecStart"
128
+                                }
129
+                              ]
123 130
                             }
124
-                          ]
125
-                        }
126
-                      }
127
-                , ExecStart =
128
-                    Child.flat
129
-                      Child.Attributes::{
130
-                      , binary = params.binary
131
-                      , exitPropagate = True
132
-                      , resources = Genode.Init.Resources::{
133
-                        , caps = 256
134
-                        , ram = Genode.units.MiB params.ramQuotaMiB
135
-                        }
136
-                      , config =
137
-                          ( Libc.toConfig
138
-                              Libc::{
139
-                              , stdin = Some "/dev/null"
140
-                              , stdout = Some "/dev/log"
141
-                              , stderr = Some "/dev/log"
142
-                              , pipe = Some "/dev/pipes"
143
-                              , rng = Some "/dev/entropy"
144
-                              , rtc = Some "/dev/rtc"
145
-                              , socket = Some "/dev/sockets"
146
-                              , vfs = [ VFS.leaf "fs" ]
147
-                              , args = [ params.binary ] # params.args
148
-                              }
149
-                          )
150
-                        with attributes = toMap { ld_verbose = "yes" }
151
-                      , routes =
152
-                          Prelude.List.map
153
-                            Text
154
-                            Init.ServiceRoute.Type
155
-                            ( λ(label : Text) →
156
-                                Init.ServiceRoute.parentLabel
157
-                                  "ROM"
158
-                                  (Some label)
159
-                                  (Some label)
160
-                            )
161
-                            [ "libc.lib.so"
162
-                            , "libm.lib.so"
163
-                            , "posix.lib.so"
164
-                            , "vfs.lib.so"
165
-                            ]
166
-                      }
167
-                }
131
+                          }
132
+                    }
133
+                # [ { mapKey = "ExecStart"
134
+                    , mapValue =
135
+                        Child.flat
136
+                          Child.Attributes::{
137
+                          , binary = params.binary
138
+                          , exitPropagate = True
139
+                          , resources = Genode.Init.Resources::{
140
+                            , caps = 256
141
+                            , ram = Genode.units.MiB params.ramQuotaMiB
142
+                            }
143
+                          , config =
144
+                              ( Libc.toConfig
145
+                                  Libc::{
146
+                                  , stdin = Some "/dev/null"
147
+                                  , stdout = Some "/dev/log"
148
+                                  , stderr = Some "/dev/log"
149
+                                  , pipe = Some "/dev/pipes"
150
+                                  , rng = Some "/dev/entropy"
151
+                                  , rtc = Some "/dev/rtc"
152
+                                  , socket = Some "/dev/sockets"
153
+                                  , vfs = [ VFS.leaf "fs" ]
154
+                                  , args = [ params.binary ] # params.args
155
+                                  }
156
+                              )
157
+                            with attributes = toMap { ld_verbose = "yes" }
158
+                          , routes =
159
+                              Prelude.List.map
160
+                                Text
161
+                                Init.ServiceRoute.Type
162
+                                ( λ(label : Text) →
163
+                                    Init.ServiceRoute.parentLabel
164
+                                      "ROM"
165
+                                      (Some label)
166
+                                      (Some label)
167
+                                )
168
+                                [ "libc.lib.so"
169
+                                , "libm.lib.so"
170
+                                , "posix.lib.so"
171
+                                , "vfs.lib.so"
172
+                                ]
173
+                          }
174
+                    }
175
+                  ]
168 176
             }
169 177
 
170 178
       in  Init.toChild init Init.Attributes::{=}

Loading…
Cancel
Save