From: Alyssa Ross <hi@alyssa.is>
To: devel@spectrum-os.org
Subject: [PATCH nixpkgs 12/16] spectrumPackages.sys-vms.comp: init
Date: Sun, 11 Apr 2021 11:57:36 +0000 [thread overview]
Message-ID: <20210411115740.29615-13-hi@alyssa.is> (raw)
In-Reply-To: <20210411115740.29615-1-hi@alyssa.is>
This removes the default rootfs, and creates a VM called "comp" that
runs all the Wayfire stuff the default rootfs did previously.
This is in a new namespace called sys-vms, which I have a very vague
intention of being a place to put VMs that run system services like a
Wayland compositor or hardware drivers. I don't think this will be
the final structure, but it's _a_ structure that supports more than
one VM, so it's an improvement over what we had before.
---
pkgs/os-specific/linux/spectrum/default.nix | 4 +-
.../linux/spectrum/rootfs/default.nix | 78 -----------------
.../linux/spectrum/spectrum-vm/default.nix | 6 +-
.../linux/spectrum/vm/comp/default.nix | 86 +++++++++++++++++++
.../os-specific/linux/spectrum/vm/default.nix | 5 ++
5 files changed, 96 insertions(+), 83 deletions(-)
delete mode 100644 pkgs/os-specific/linux/spectrum/rootfs/default.nix
create mode 100644 pkgs/os-specific/linux/spectrum/vm/comp/default.nix
create mode 100644 pkgs/os-specific/linux/spectrum/vm/default.nix
diff --git a/pkgs/os-specific/linux/spectrum/default.nix b/pkgs/os-specific/linux/spectrum/default.nix
index ea86dc25c2b..f8a9813d16a 100644
--- a/pkgs/os-specific/linux/spectrum/default.nix
+++ b/pkgs/os-specific/linux/spectrum/default.nix
@@ -4,13 +4,13 @@ let
self = with self; {
callPackage = newScope self;
+ sys-vms = callPackage ./vm { };
+
spectrum-vm = callPackage ./spectrum-vm { linux = linux_vm; };
linux_vm = callPackage ./linux/vm.nix { linux = linux_cros; };
makeRootfs = callPackage ./rootfs/generic.nix { };
-
- rootfs = callPackage ./rootfs { };
};
in
self
diff --git a/pkgs/os-specific/linux/spectrum/rootfs/default.nix b/pkgs/os-specific/linux/spectrum/rootfs/default.nix
deleted file mode 100644
index 70ddac4c545..00000000000
--- a/pkgs/os-specific/linux/spectrum/rootfs/default.nix
+++ /dev/null
@@ -1,78 +0,0 @@
-{ writeScript, writeText, lib, makeRootfs
-, busybox, execline, s6, sommelier, source-code-pro, wayfire, zsh
-, gcc, emacs26-nox, westonLite
-}:
-
-let
- path = [
- zsh emacs26-nox gcc wayfire sommelier westonLite busybox s6 execline
- ];
-
- login = writeScript "login" ''
- #! ${execline}/bin/execlineb -s0
- unexport !
- ${busybox}/bin/login -p -f root $@
- '';
-
- # This can't be /etc/wayfire/defaults.ini because autostart entries
- # from that file aren't applied.
- wayfireConfig = writeText "wayfire-config" ''
- [core]
- xwayland = false
-
- [input]
- xkb_layout = us
- xkb_variant = dvorak
-
- [autostart]
- terminal = weston-terminal --shell $(command -v zsh)
- '';
-in
-
-makeRootfs {
- services.getty.run = writeScript "getty-run" ''
- #! ${execline}/bin/execlineb -P
- ${busybox}/bin/getty -i -n -l ${login} 38400 ttyS0
- '';
-
- rcServices.ok-all = {
- type = writeText "ok-all-type" ''
- bundle
- '';
- contents = writeText "ok-all-contents" ''
- wayfire
- '';
- };
-
- rcServices.wayfire = {
- type = writeText "wayfire-type" ''
- longrun
- '';
- run = writeScript "wayfire-run" ''
- #! ${execline}/bin/execlineb -S0
-
- s6-applyuidgid -u 1000 -g 1000
-
- export HOME /
- export PATH ${lib.makeBinPath path}
- export XDG_RUNTIME_DIR /run/user/1000
-
- ${sommelier}/bin/sommelier
- wayfire -c ${wayfireConfig}
- '';
- dependencies = writeText "wayfire-dependencies" ''
- wl0
- '';
- };
-
- rcServices.wl0 = {
- type = writeText "wl0-type" ''
- oneshot
- '';
- up = writeText "wl0-run" ''
- chown user /dev/wl0
- '';
- };
-
- fonts = [ source-code-pro ];
-}
diff --git a/pkgs/os-specific/linux/spectrum/spectrum-vm/default.nix b/pkgs/os-specific/linux/spectrum/spectrum-vm/default.nix
index 56f1eadea99..c56d2537c63 100644
--- a/pkgs/os-specific/linux/spectrum/spectrum-vm/default.nix
+++ b/pkgs/os-specific/linux/spectrum/spectrum-vm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, makeWrapper, utillinux, crosvm, linux, rootfs }:
+{ stdenv, lib, makeWrapper, utillinux, crosvm, linux, sys-vms }:
stdenv.mkDerivation {
name = "spectrum-vm";
@@ -18,8 +18,8 @@ stdenv.mkDerivation {
getopt = "${lib.getBin utillinux}/bin/getopt";
crosvm = "${lib.getBin crosvm}/bin/crosvm";
- kernel = "${linux}/bzImage";
- rootfs = rootfs.squashfs;
+ kernel = "${sys-vms.comp.linux}/bzImage";
+ rootfs = sys-vms.comp.rootfs.squashfs;
installPhase = ''
mkdir -p $out/bin
diff --git a/pkgs/os-specific/linux/spectrum/vm/comp/default.nix b/pkgs/os-specific/linux/spectrum/vm/comp/default.nix
new file mode 100644
index 00000000000..988fad5fba6
--- /dev/null
+++ b/pkgs/os-specific/linux/spectrum/vm/comp/default.nix
@@ -0,0 +1,86 @@
+{ lib, makeRootfs, runCommand, writeScript, writeText
+, busybox, emacs26-nox, execline, gcc, linux_vm, s6, sommelier, source-code-pro
+, wayfire, westonLite, zsh
+}:
+
+runCommand "vm-comp" rec {
+ linux = linux_vm;
+
+ path = [
+ busybox emacs26-nox execline gcc s6 sommelier wayfire westonLite zsh
+ ];
+
+ login = writeScript "login" ''
+ #! ${execline}/bin/execlineb -s0
+ unexport !
+ ${busybox}/bin/login -p -f root $@
+ '';
+
+ # This can't be /etc/wayfire/defaults.ini because autostart entries
+ # from that file aren't applied.
+ wayfireConfig = writeText "wayfire-config" ''
+ [core]
+ xwayland = false
+
+ [input]
+ xkb_layout = us
+ xkb_variant = dvorak
+
+ [autostart]
+ terminal = weston-terminal --shell $(command -v zsh)
+ '';
+
+ rootfs = makeRootfs {
+ services.getty.run = writeScript "getty-run" ''
+ #! ${execline}/bin/execlineb -P
+ ${busybox}/bin/getty -i -n -l ${login} 38400 ttyS0
+ '';
+
+ rcServices.ok-all = {
+ type = writeText "ok-all-type" ''
+ bundle
+ '';
+ contents = writeText "ok-all-contents" ''
+ wayfire
+ '';
+ };
+
+ rcServices.wayfire = {
+ type = writeText "wayfire-type" ''
+ longrun
+ '';
+ run = writeScript "wayfire-run" ''
+ #! ${execline}/bin/execlineb -S0
+
+ s6-applyuidgid -u 1000 -g 1000
+
+ export HOME /
+ export PATH ${lib.makeBinPath path}
+ export XDG_RUNTIME_DIR /run/user/1000
+
+ ${sommelier}/bin/sommelier
+ wayfire -c ${wayfireConfig}
+ '';
+ dependencies = writeText "wayfire-dependencies" ''
+ wl0
+ '';
+ };
+
+ rcServices.wl0 = {
+ type = writeText "wl0-type" ''
+ oneshot
+ '';
+ up = writeText "wl0-run" ''
+ chown user /dev/wl0
+ '';
+ };
+
+ fonts = [ source-code-pro ];
+ };
+
+ inherit (rootfs) squashfs;
+} ''
+ mkdir $out
+ ln -s $linux/bzImage $out/kernel
+ ln -s $squashfs $out/squashfs
+''
diff --git a/pkgs/os-specific/linux/spectrum/vm/default.nix b/pkgs/os-specific/linux/spectrum/vm/default.nix
new file mode 100644
index 00000000000..582a0c2e9c3
--- /dev/null
+++ b/pkgs/os-specific/linux/spectrum/vm/default.nix
@@ -0,0 +1,5 @@
+{ callPackage }:
+
+{
+ comp = callPackage ./comp { };
+}
--
2.30.0
next prev parent reply other threads:[~2021-04-11 12:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-11 11:57 [PATCH nixpkgs 00/16] Inter-guest networking Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 01/16] linux: enable Xen everywhere it can be Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 02/16] cloud-hypervisor: 0.8.0 -> 0.14.1 Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 03/16] mdevd: init at 0.1.3.0 Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 04/16] spectrumPackages.linux_vm: fix cloud-hypervisor hotplug Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 05/16] spectrumPackages.linux_vm: allow config overrides Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 06/16] crosvm: support setting guest MAC from --tap-fd Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 07/16] spectrumPackages: export makeRootfs Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 08/16] spectrumPackages.rootfs: add s6-rc support Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 09/16] spectrumPackages.rootfs: make /var/lib and /var/run Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 10/16] spectrumPackages.rootfs: add dbus configuration Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 11/16] spectrumPackages.rootfs: add connman dbus services Alyssa Ross
2021-04-11 11:57 ` Alyssa Ross [this message]
2021-04-11 11:57 ` [PATCH nixpkgs 13/16] spectrumPackages.makeRootfs: move to default.nix Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 14/16] spectrumPackages.sys-vms.net: init Alyssa Ross
2021-04-14 20:49 ` Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 15/16] spectrumPackages.sys-vms.app: init Alyssa Ross
2021-04-11 11:57 ` [PATCH nixpkgs 16/16] spectrumPackages.spectrum-testhost: init Alyssa Ross
2021-04-14 22:15 ` [PATCH nixpkgs 00/16] Inter-guest networking Cole Helbling
2021-04-14 23:56 ` Alyssa Ross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210411115740.29615-13-hi@alyssa.is \
--to=hi@alyssa.is \
--cc=devel@spectrum-os.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).