From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-4.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.4 Received: by atuin.qyliss.net (Postfix, from userid 496) id E5386627E; Sun, 11 Apr 2021 12:01:14 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 5E1265E24; Sun, 11 Apr 2021 11:58:47 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id 140315EA2; Sun, 11 Apr 2021 11:58:46 +0000 (UTC) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by atuin.qyliss.net (Postfix) with ESMTPS id 82ED55B91 for ; Sun, 11 Apr 2021 11:57:58 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EBC9C5C00D8 for ; Sun, 11 Apr 2021 07:57:57 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 11 Apr 2021 07:57:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h= from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=zG2U2VAznWCEz UGWXpgq+p/zv/CFiXWx/czgyhpqRf0=; b=c2LlIsMGqDNgIT75votRHqPYdY4TE X/5iWmr0FWW812b7thHHQVGb1zmlktUYCAZNU8gH4ysBjv4td80CWKoLIH/h68sR UsIq4nlNUtMLpm0+Plv5F9XmOpNixUV5fTByMl/gBW265wAwf/2mQljYHf9gcj2H ggKhYA29WYeCmrCI/woB7FjZQZueCJ+eIo/QXBe8q1t9SPRYydHj3V42phlxOKzk 0Ol/HRhdsBNVcz+23WZZ5/16iOi7csg3k8RY75vE64P4qFwICRvGf8rNYUroklIZ N/VPC/jm9QdhSGqDFI6vpPjn2qsSeBpNDSNzhf3MeHf8eFeEye3XbEbvQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=zG2U2VAznWCEzUGWXpgq+p/zv/CFiXWx/czgyhpqRf0=; b=erYdVdNm 9GIF3Tn9gs+rmg01WCMcB+2hnJfIp/p7eskvKHJOWo8gl9GOvUDyM7/GszrbCVMG gH2uqPXXl2D5qZ/7IVSxQQ6TiHYkblYYzrjiQEp3cMz6AlkDgliKXcABGJo2plWJ 1p+DFWu8Koz1lgbqV1WfrKIoiS6+1lu5fQ8rsXYEpVP9n9B9FAE4CpokkmnXsd9N s/HRwlgsLPRyTcHeJNX6MlwiTp2rT8r5swC/Ep5udA/dlexBirX0B8bMJaR3U+63 JGkY0jvfZ9RTRArZKMWB1O8KNx1UY631Azy7uh8iLBf3Rha3T9grw3CUkohFF+7x /fHGOqBTU1RyLA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudekgedgudejhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpeetlhihshhsrgcutfhoshhsuceohhhisegrlhihshhsrgdr ihhsqeenucggtffrrghtthgvrhhnpefhkeetkeekgedtvdekvefftddtleduhfejffduge elvdfgiedvhefgleetvdeukeenucffohhmrghinhepghgvthhthidrrhhunhenucfkphep jeelrddvfeehrdduudelrddutdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomhepqhihlhhishhsseigvddvtddrqhihlhhishhsrdhnvght X-ME-Proxy: Received: from x220.qyliss.net (p4feb776b.dip0.t-ipconnect.de [79.235.119.107]) by mail.messagingengine.com (Postfix) with ESMTPA id A6C911080054 for ; Sun, 11 Apr 2021 07:57:57 -0400 (EDT) Received: by x220.qyliss.net (Postfix, from userid 1000) id 2216918FD; Sun, 11 Apr 2021 11:57:56 +0000 (UTC) From: Alyssa Ross To: devel@spectrum-os.org Subject: [PATCH nixpkgs 12/16] spectrumPackages.sys-vms.comp: init Date: Sun, 11 Apr 2021 11:57:36 +0000 Message-Id: <20210411115740.29615-13-hi@alyssa.is> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210411115740.29615-1-hi@alyssa.is> References: <20210411115740.29615-1-hi@alyssa.is> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: ZKALDNMNUEDSI7CDWA4YBRZCOEG7J4F7 X-Message-ID-Hash: ZKALDNMNUEDSI7CDWA4YBRZCOEG7J4F7 X-MailFrom: qyliss@x220.qyliss.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.3.1 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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