summary refs log tree commit diff
path: root/vm/app/lynx/etc
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-10-09 11:40:36 +0000
committerAlyssa Ross <hi@alyssa.is>2022-11-13 23:58:55 +0000
commit2b0083087c127c5abbc8d694719fd6b94c2a9995 (patch)
treea7c20de4bfd3579ca0d4623959cd4215e6b9f1ad /vm/app/lynx/etc
parentd30f0248583e523eddb716aa931489b11a44e3f6 (diff)
downloadspectrum-2b0083087c127c5abbc8d694719fd6b94c2a9995.tar
spectrum-2b0083087c127c5abbc8d694719fd6b94c2a9995.tar.gz
spectrum-2b0083087c127c5abbc8d694719fd6b94c2a9995.tar.bz2
spectrum-2b0083087c127c5abbc8d694719fd6b94c2a9995.tar.lz
spectrum-2b0083087c127c5abbc8d694719fd6b94c2a9995.tar.xz
spectrum-2b0083087c127c5abbc8d694719fd6b94c2a9995.tar.zst
spectrum-2b0083087c127c5abbc8d694719fd6b94c2a9995.zip
img/app: extract from appvm-{lynx,catgirl}
This patch introduces a generic application VM image.  It mounts a
filesystem containing the application, and then launches a "run"
script on that filesystem to start the application.  The Nix store on
the application filesystem is overlaid onto the generic Nix store, so
shared paths don't have to be duplicated in the application
filesystem.

The "appvm" image is part of the Spectrum system — it lives on the
root filesystem, not the user data partition.  Users of course have
the choice not to use the built in image if they don't want to, but
this gives us a default to use for future features like starting VMs
at runtime.

Individual application VMs are now defined in a single Nix file each,
using a VM builder function.  I expect this is how Nix-based VMs would
be defined in the user data partition, and then built with Nix into
Spectrum VM configurations.

The new top-level vm-lib directory is intended to be copied into user
Nix expressions that build VMs, and therefore has to be usable
standalone.  User-defined VMs should not do any path deduplication
with the system-provided base VM, so that the two can independently
update Nixpkgs.  But for VMs that are part of the system (which I
consider the pre-built VMs to be, even though they're currently on the
user data partition), we can safely deduplicate paths that we know to
be present in the base image.  So they go through vm/make-vm.nix,
which is a wrapper around vm-lib/make-vm.nix that does this
deduplication.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Message-Id: <20221009114036.463071-7-hi@alyssa.is>
Diffstat (limited to 'vm/app/lynx/etc')
-rw-r--r--vm/app/lynx/etc/fstab6
-rwxr-xr-xvm/app/lynx/etc/init5
-rw-r--r--vm/app/lynx/etc/mdev.conf5
-rwxr-xr-xvm/app/lynx/etc/mdev/iface36
-rw-r--r--vm/app/lynx/etc/passwd1
-rw-r--r--vm/app/lynx/etc/passwd.license2
-rw-r--r--vm/app/lynx/etc/resolv.conf4
-rwxr-xr-xvm/app/lynx/etc/s6-linux-init/scripts/rc.init10
-rwxr-xr-xvm/app/lynx/etc/s6-rc/lynx/run27
-rw-r--r--vm/app/lynx/etc/s6-rc/lynx/type1
-rw-r--r--vm/app/lynx/etc/s6-rc/lynx/type.license2
-rw-r--r--vm/app/lynx/etc/s6-rc/mdevd-coldplug/dependencies4
-rw-r--r--vm/app/lynx/etc/s6-rc/mdevd-coldplug/type1
-rw-r--r--vm/app/lynx/etc/s6-rc/mdevd-coldplug/type.license2
-rw-r--r--vm/app/lynx/etc/s6-rc/mdevd-coldplug/up4
-rw-r--r--vm/app/lynx/etc/s6-rc/mdevd/notification-fd1
-rw-r--r--vm/app/lynx/etc/s6-rc/mdevd/notification-fd.license2
-rw-r--r--vm/app/lynx/etc/s6-rc/mdevd/run5
-rw-r--r--vm/app/lynx/etc/s6-rc/mdevd/type1
-rw-r--r--vm/app/lynx/etc/s6-rc/mdevd/type.license2
-rw-r--r--vm/app/lynx/etc/s6-rc/ok-all/contents4
-rw-r--r--vm/app/lynx/etc/s6-rc/ok-all/type1
-rw-r--r--vm/app/lynx/etc/s6-rc/ok-all/type.license2
l---------vm/app/lynx/etc/ssl/certs/ca-certificates.crt1
24 files changed, 0 insertions, 129 deletions
diff --git a/vm/app/lynx/etc/fstab b/vm/app/lynx/etc/fstab
deleted file mode 100644
index 6a82ecc..0000000
--- a/vm/app/lynx/etc/fstab
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: CC0-1.0
-# SPDX-FileCopyrightText: 2020-2021 Alyssa Ross <hi@alyssa.is>
-proc	/proc		proc	defaults		0	0
-devpts	/dev/pts	devpts	defaults,gid=4,mode=620	0	0
-tmpfs	/dev/shm	tmpfs	defaults		0	0
-sysfs	/sys		sysfs	defaults		0	0
diff --git a/vm/app/lynx/etc/init b/vm/app/lynx/etc/init
deleted file mode 100755
index 6424e22..0000000
--- a/vm/app/lynx/etc/init
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/execlineb -s0
-# SPDX-License-Identifier: EUPL-1.2+
-# SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
-
-/bin/s6-linux-init -Bc /etc/s6-linux-init -- $@
diff --git a/vm/app/lynx/etc/mdev.conf b/vm/app/lynx/etc/mdev.conf
deleted file mode 100644
index f114719..0000000
--- a/vm/app/lynx/etc/mdev.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-# SPDX-License-Identifier: EUPL-1.2+
-# SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
-
--$MODALIAS=.* 0:0 660 +importas -iu MODALIAS MODALIAS modprobe -q $MODALIAS
-$INTERFACE=.* 0:0 660 ! +/etc/mdev/iface
diff --git a/vm/app/lynx/etc/mdev/iface b/vm/app/lynx/etc/mdev/iface
deleted file mode 100755
index eb91e33..0000000
--- a/vm/app/lynx/etc/mdev/iface
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/execlineb -P
-# SPDX-License-Identifier: EUPL-1.2+
-# SPDX-FileCopyrightText: 2020-2021 Alyssa Ross <hi@alyssa.is>
-
-importas -i INTERFACE INTERFACE
-
-if { test $INTERFACE != lo }
-
-# Our IP is encoded in the NIC-specific portion of the interface's MAC
-# address.
-backtick -E LOCAL_IP {
-  awk -F: "{printf \"100.64.%d.%d\\n\", \"0x\" $5, \"0x\" $6}"
-  /sys/class/net/${INTERFACE}/address
-}
-
-if { ip address add ${LOCAL_IP}/32 dev $INTERFACE }
-if { ip link set $INTERFACE up }
-if { ip route add 169.254.0.1 dev $INTERFACE }
-if { ip route add default via 169.254.0.1 dev $INTERFACE }
-
-# Try to wait for the network to be up.
-# If we time out, well, there's not much we can do, so just carry on.
-# In future, it would be better if the network VM notified us about
-# network changes.
-foreground { printf "Waiting for network… " }
-foreground {
-  ifte { echo "Connected." } { echo "Timed out." }
-  pipeline { seq 10 }
-  forstdin _
-  if -n {
-    redirfd -w 2 /dev/null
-    wget -qT 6 -O /dev/null http://ipv4.connman.net/online/status.html
-  }
-}
-
-s6-rc -u change lynx
diff --git a/vm/app/lynx/etc/passwd b/vm/app/lynx/etc/passwd
deleted file mode 100644
index 29f3b25..0000000
--- a/vm/app/lynx/etc/passwd
+++ /dev/null
@@ -1 +0,0 @@
-root:x:0:0:System administrator:/:/bin/sh
diff --git a/vm/app/lynx/etc/passwd.license b/vm/app/lynx/etc/passwd.license
deleted file mode 100644
index 2b3b032..0000000
--- a/vm/app/lynx/etc/passwd.license
+++ /dev/null
@@ -1,2 +0,0 @@
-SPDX-License-Identifier: CC0-1.0
-SPDX-FileCopyrightText: 2020 Alyssa Ross <hi@alyssa.is>
diff --git a/vm/app/lynx/etc/resolv.conf b/vm/app/lynx/etc/resolv.conf
deleted file mode 100644
index 7fcdf3a..0000000
--- a/vm/app/lynx/etc/resolv.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-# SPDX-License-Identifier: CC0-1.0
-# SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
-
-nameserver 1.1.1.1
diff --git a/vm/app/lynx/etc/s6-linux-init/scripts/rc.init b/vm/app/lynx/etc/s6-linux-init/scripts/rc.init
deleted file mode 100755
index 1016d0c..0000000
--- a/vm/app/lynx/etc/s6-linux-init/scripts/rc.init
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/execlineb -P
-# SPDX-License-Identifier: EUPL-1.2+
-# SPDX-FileCopyrightText: 2020-2022 Alyssa Ross <hi@alyssa.is>
-
-if { s6-rc-init -c /etc/s6-rc /run/service }
-
-if { mkdir -p /dev/pts /dev/shm }
-if { mount -a }
-
-s6-rc change ok-all
diff --git a/vm/app/lynx/etc/s6-rc/lynx/run b/vm/app/lynx/etc/s6-rc/lynx/run
deleted file mode 100755
index d0e7a83..0000000
--- a/vm/app/lynx/etc/s6-rc/lynx/run
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/execlineb -P
-# SPDX-License-Identifier: EUPL-1.2+
-# SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
-
-export TERM foot
-export TERMINFO_DIRS /usr/share/terminfo
-export TMPDIR /run
-
-backtick USER { id -un }
-backtick HOME {
-  importas -i user USER
-  homeof $user
-}
-
-importas -i home HOME
-cd $home
-
-redirfd -u 0 /dev/hvc0
-fdmove -c 1 0
-fdmove -c 2 0
-
-foreground { clear }
-unexport ?
-
-# Run lynx, then a login shell to allow for debugging.
-foreground { lynx https://spectrum-os.org/ }
-exec -l sh
diff --git a/vm/app/lynx/etc/s6-rc/lynx/type b/vm/app/lynx/etc/s6-rc/lynx/type
deleted file mode 100644
index 5883cff..0000000
--- a/vm/app/lynx/etc/s6-rc/lynx/type
+++ /dev/null
@@ -1 +0,0 @@
-longrun
diff --git a/vm/app/lynx/etc/s6-rc/lynx/type.license b/vm/app/lynx/etc/s6-rc/lynx/type.license
deleted file mode 100644
index c49c11b..0000000
--- a/vm/app/lynx/etc/s6-rc/lynx/type.license
+++ /dev/null
@@ -1,2 +0,0 @@
-SPDX-License-Identifier: CC0-1.0
-SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
diff --git a/vm/app/lynx/etc/s6-rc/mdevd-coldplug/dependencies b/vm/app/lynx/etc/s6-rc/mdevd-coldplug/dependencies
deleted file mode 100644
index 59b02b7..0000000
--- a/vm/app/lynx/etc/s6-rc/mdevd-coldplug/dependencies
+++ /dev/null
@@ -1,4 +0,0 @@
-# SPDX-License-Identifier: CC0-1.0
-# SPDX-FileCopyrightText: 2020 Alyssa Ross <hi@alyssa.is>
-#
-mdevd
diff --git a/vm/app/lynx/etc/s6-rc/mdevd-coldplug/type b/vm/app/lynx/etc/s6-rc/mdevd-coldplug/type
deleted file mode 100644
index bdd22a1..0000000
--- a/vm/app/lynx/etc/s6-rc/mdevd-coldplug/type
+++ /dev/null
@@ -1 +0,0 @@
-oneshot
diff --git a/vm/app/lynx/etc/s6-rc/mdevd-coldplug/type.license b/vm/app/lynx/etc/s6-rc/mdevd-coldplug/type.license
deleted file mode 100644
index 2b3b032..0000000
--- a/vm/app/lynx/etc/s6-rc/mdevd-coldplug/type.license
+++ /dev/null
@@ -1,2 +0,0 @@
-SPDX-License-Identifier: CC0-1.0
-SPDX-FileCopyrightText: 2020 Alyssa Ross <hi@alyssa.is>
diff --git a/vm/app/lynx/etc/s6-rc/mdevd-coldplug/up b/vm/app/lynx/etc/s6-rc/mdevd-coldplug/up
deleted file mode 100644
index 8698f7d..0000000
--- a/vm/app/lynx/etc/s6-rc/mdevd-coldplug/up
+++ /dev/null
@@ -1,4 +0,0 @@
-# SPDX-License-Identifier: EUPL-1.2+
-# SPDX-FileCopyrightText: 2020-2021 Alyssa Ross <hi@alyssa.is>
-
-mdevd-coldplug
diff --git a/vm/app/lynx/etc/s6-rc/mdevd/notification-fd b/vm/app/lynx/etc/s6-rc/mdevd/notification-fd
deleted file mode 100644
index 00750ed..0000000
--- a/vm/app/lynx/etc/s6-rc/mdevd/notification-fd
+++ /dev/null
@@ -1 +0,0 @@
-3
diff --git a/vm/app/lynx/etc/s6-rc/mdevd/notification-fd.license b/vm/app/lynx/etc/s6-rc/mdevd/notification-fd.license
deleted file mode 100644
index 2b3b032..0000000
--- a/vm/app/lynx/etc/s6-rc/mdevd/notification-fd.license
+++ /dev/null
@@ -1,2 +0,0 @@
-SPDX-License-Identifier: CC0-1.0
-SPDX-FileCopyrightText: 2020 Alyssa Ross <hi@alyssa.is>
diff --git a/vm/app/lynx/etc/s6-rc/mdevd/run b/vm/app/lynx/etc/s6-rc/mdevd/run
deleted file mode 100644
index 6dacb13..0000000
--- a/vm/app/lynx/etc/s6-rc/mdevd/run
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/execlineb -P
-# SPDX-License-Identifier: EUPL-1.2+
-# SPDX-FileCopyrightText: 2020-2021 Alyssa Ross <hi@alyssa.is>
-
-mdevd -D3
diff --git a/vm/app/lynx/etc/s6-rc/mdevd/type b/vm/app/lynx/etc/s6-rc/mdevd/type
deleted file mode 100644
index 5883cff..0000000
--- a/vm/app/lynx/etc/s6-rc/mdevd/type
+++ /dev/null
@@ -1 +0,0 @@
-longrun
diff --git a/vm/app/lynx/etc/s6-rc/mdevd/type.license b/vm/app/lynx/etc/s6-rc/mdevd/type.license
deleted file mode 100644
index 2b3b032..0000000
--- a/vm/app/lynx/etc/s6-rc/mdevd/type.license
+++ /dev/null
@@ -1,2 +0,0 @@
-SPDX-License-Identifier: CC0-1.0
-SPDX-FileCopyrightText: 2020 Alyssa Ross <hi@alyssa.is>
diff --git a/vm/app/lynx/etc/s6-rc/ok-all/contents b/vm/app/lynx/etc/s6-rc/ok-all/contents
deleted file mode 100644
index c4ea84f..0000000
--- a/vm/app/lynx/etc/s6-rc/ok-all/contents
+++ /dev/null
@@ -1,4 +0,0 @@
-# SPDX-License-Identifier: CC0-1.0
-# SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
-#
-mdevd-coldplug
diff --git a/vm/app/lynx/etc/s6-rc/ok-all/type b/vm/app/lynx/etc/s6-rc/ok-all/type
deleted file mode 100644
index 757b422..0000000
--- a/vm/app/lynx/etc/s6-rc/ok-all/type
+++ /dev/null
@@ -1 +0,0 @@
-bundle
diff --git a/vm/app/lynx/etc/s6-rc/ok-all/type.license b/vm/app/lynx/etc/s6-rc/ok-all/type.license
deleted file mode 100644
index c49c11b..0000000
--- a/vm/app/lynx/etc/s6-rc/ok-all/type.license
+++ /dev/null
@@ -1,2 +0,0 @@
-SPDX-License-Identifier: CC0-1.0
-SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
diff --git a/vm/app/lynx/etc/ssl/certs/ca-certificates.crt b/vm/app/lynx/etc/ssl/certs/ca-certificates.crt
deleted file mode 120000
index 42d8e23..0000000
--- a/vm/app/lynx/etc/ssl/certs/ca-certificates.crt
+++ /dev/null
@@ -1 +0,0 @@
-/usr/share/ssl/certs/ca-bundle.crt
\ No newline at end of file