aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/hpkg/app.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-10-14 06:37:24 +0900
committerOphestra <cat@gensokyo.uk>2025-10-14 06:39:00 +0900
commit4c647add0db06cc7a28571aee7502737f0d66b27 (patch)
tree7446453d4380ed21c3ad3c3f8026c708fc53e729 /cmd/hpkg/app.go
parenta3414669428d4de37b68aff3f2db14e5768e1f59 (diff)
hst/container: pack boolean options
The memory saving is relatively insignificant, however this increases serialisation efficiency. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd/hpkg/app.go')
-rw-r--r--cmd/hpkg/app.go35
1 files changed, 26 insertions, 9 deletions
diff --git a/cmd/hpkg/app.go b/cmd/hpkg/app.go
index d03c8b03..87a2c47c 100644
--- a/cmd/hpkg/app.go
+++ b/cmd/hpkg/app.go
@@ -76,15 +76,7 @@ func (app *appInfo) toHst(pathSet *appPathSet, pathname *check.Absolute, argv []
Groups: app.Groups,
Container: &hst.ContainerConfig{
- Hostname: formatHostname(app.Name),
- Devel: app.Devel,
- Userns: app.Userns,
- HostNet: app.HostNet,
- HostAbstract: app.HostAbstract,
- Device: app.Device,
- Tty: app.Tty || flagDropShell,
- MapRealUID: app.MapRealUID,
- Multiarch: app.Multiarch,
+ Hostname: formatHostname(app.Name),
Filesystem: []hst.FilesystemConfigJSON{
{FilesystemConfig: &hst.FSBind{Target: fhs.AbsEtc, Source: pathSet.cacheDir.Append("etc"), Special: true}},
{FilesystemConfig: &hst.FSBind{Source: pathSet.nixPath.Append("store"), Target: pathNixStore}},
@@ -113,6 +105,31 @@ func (app *appInfo) toHst(pathSet *appPathSet, pathname *check.Absolute, argv []
{Ensure: true, Path: pathSet.baseDir, Read: true, Write: true, Execute: true},
},
}
+
+ if app.Devel {
+ config.Container.Flags |= hst.FDevel
+ }
+ if app.Userns {
+ config.Container.Flags |= hst.FUserns
+ }
+ if app.HostNet {
+ config.Container.Flags |= hst.FHostNet
+ }
+ if app.HostAbstract {
+ config.Container.Flags |= hst.FHostAbstract
+ }
+ if app.Device {
+ config.Container.Flags |= hst.FDevice
+ }
+ if app.Tty || flagDropShell {
+ config.Container.Flags |= hst.FTty
+ }
+ if app.MapRealUID {
+ config.Container.Flags |= hst.FMapRealUID
+ }
+ if app.Multiarch {
+ config.Container.Flags |= hst.FMultiarch
+ }
return config
}