From c3fbeca89c23270314d1a24017160ff6fe7cc497 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 22 Feb 2023 18:34:47 +0000 Subject: lib/common.mk: init We can simplify our Makefiles a bit by moving some things into a library file. So far, I've done this for non-component-specific macros, and inference rules. Some tar2ext4 rules used a temporary file for the tar2ext4 invocation, and then moved the file into place when it was done, to prevent a half-built image sticking around if tar2ext4 died. According to POSIX, make should clean up any targets that didn't finish building if it's interrupted, so we should only end up with a half-built image if tar2ext4 crashes, e.g. due to running out of disk space. I think we should just ignore that possibility, since otherwise we'd have to write annoying make rules using temporary file names for every target, and if it does happen recovery is just a make clean away. With this, I've also made a small reorganisation. I got rid of the "nix" directory and created a "lib" directory, where I put eval-config.nix and the new common.mk file, since both are library code. checks.nix isn't really a library though, so I moved it into the "release" directory, since the only reference to it is in release.nix. Signed-off-by: Alyssa Ross --- Documentation/default.nix | 2 +- Documentation/jekyll.nix | 2 +- host/initramfs/Makefile | 15 +----------- host/initramfs/default.nix | 2 +- host/initramfs/shell.nix | 2 +- host/rootfs/Makefile | 15 +++--------- host/rootfs/default.nix | 2 +- host/rootfs/shell.nix | 2 +- host/start-vm/default.nix | 2 +- host/start-vm/shell.nix | 2 +- img/app/Makefile | 13 +--------- img/app/default.nix | 2 +- img/app/shell.nix | 2 +- lib/common.mk | 25 +++++++++++++++++++ lib/eval-config.nix | 30 +++++++++++++++++++++++ nix/checks.nix | 55 ------------------------------------------ nix/eval-config.nix | 30 ----------------------- release.nix | 4 +-- release/checks.nix | 55 ++++++++++++++++++++++++++++++++++++++++++ release/combined/default.nix | 2 +- release/combined/eosimages.nix | 2 +- release/combined/run-vm.nix | 2 +- release/installer/default.nix | 2 +- release/installer/run-vm.nix | 2 +- release/live/Makefile | 12 +-------- release/live/default.nix | 2 +- release/live/shell.nix | 2 +- shell.nix | 2 +- vm/app/catgirl.nix | 2 +- vm/app/lynx.nix | 2 +- vm/make-vm.nix | 2 +- vm/sys/net/Makefile | 13 +--------- vm/sys/net/default.nix | 2 +- vm/sys/net/shell.nix | 2 +- 34 files changed, 142 insertions(+), 171 deletions(-) create mode 100644 lib/common.mk create mode 100644 lib/eval-config.nix delete mode 100644 nix/checks.nix delete mode 100644 nix/eval-config.nix create mode 100644 release/checks.nix diff --git a/Documentation/default.nix b/Documentation/default.nix index 90f8e88..b0fe341 100644 --- a/Documentation/default.nix +++ b/Documentation/default.nix @@ -2,7 +2,7 @@ # SPDX-FileCopyrightText: 2022 Unikie # SPDX-License-Identifier: MIT -import ../nix/eval-config.nix ({ config, src, ... }: config.pkgs.callPackage ( +import ../lib/eval-config.nix ({ config, src, ... }: config.pkgs.callPackage ( { lib, stdenvNoCC, jekyll, drawio-headless }: diff --git a/Documentation/jekyll.nix b/Documentation/jekyll.nix index fe16186..4b32ebe 100644 --- a/Documentation/jekyll.nix +++ b/Documentation/jekyll.nix @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2022 Alyssa Ross # SPDX-License-Identifier: MIT -import ../nix/eval-config.nix ({ config, ... }: config.pkgs.callPackage ( +import ../lib/eval-config.nix ({ config, ... }: config.pkgs.callPackage ( { bundlerApp }: diff --git a/host/initramfs/Makefile b/host/initramfs/Makefile index b0e236f..e341d1a 100644 --- a/host/initramfs/Makefile +++ b/host/initramfs/Makefile @@ -1,16 +1,7 @@ # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -# qemu-kvm is non-standard, but is present in at least Fedora and -# Nixpkgs. If you don't have qemu-kvm, you'll need to set e.g. -# QEMU_KVM = qemu-system-x86_64 -enable-kvm. -QEMU_KVM = qemu-kvm - -CPIO = cpio -CPIOFLAGS = --reproducible -R +0:+0 -H newc -TAR = tar -TAR2EXT4 = tar2ext4 -VERITYSETUP = veritysetup +include ../../lib/common.mk RUN_IMAGE = build/live.img @@ -65,10 +56,6 @@ build/live.img: ../../scripts/format-uuid.sh ../../scripts/make-gpt.sh build/roo build/loop.tar: build/live.img $(TAR) -cf $@ build/live.img -.SUFFIXES: .ext4 .tar -.tar.ext4: - $(TAR2EXT4) -i $< -o $@ - build/loop.img: ../../scripts/make-gpt.sh build/loop.ext4 ../../scripts/make-gpt.sh $@.tmp \ build/loop.ext4:56a3bbc3-aefa-43d9-a64d-7b3fd59bbc4e diff --git a/host/initramfs/default.nix b/host/initramfs/default.nix index 828ba5d..154ae41 100644 --- a/host/initramfs/default.nix +++ b/host/initramfs/default.nix @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross # SPDX-License-Identifier: MIT -import ../../nix/eval-config.nix ( +import ../../lib/eval-config.nix ( { config, src , rootfs ? import ../rootfs { inherit config; } , ... diff --git a/host/initramfs/shell.nix b/host/initramfs/shell.nix index 5475737..73e215d 100644 --- a/host/initramfs/shell.nix +++ b/host/initramfs/shell.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -import ../../nix/eval-config.nix ({ config, ... } @ args: +import ../../lib/eval-config.nix ({ config, ... } @ args: let inherit (config) pkgs; diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile index 4c187b0..f4b17a0 100644 --- a/host/rootfs/Makefile +++ b/host/rootfs/Makefile @@ -1,18 +1,7 @@ # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -# qemu-kvm is non-standard, but is present in at least Fedora and -# Nixpkgs. If you don't have qemu-kvm, you'll need to set e.g. -# QEMU_KVM = qemu-system-x86_64 -enable-kvm. -QEMU_KVM = qemu-kvm - -VERITYSETUP = veritysetup - -# tar2ext4 will leave half a filesystem behind if it's interrupted -# half way through. -build/rootfs.ext4: build/rootfs.tar - tar2ext4 -i build/rootfs.tar -o $@.tmp - mv $@.tmp $@ +include ../../lib/common.mk FILES = \ etc/fonts/fonts.conf \ @@ -47,6 +36,8 @@ LINKS = bin sbin BUILD_FILES = build/etc/mdev/modalias.sh build/etc/s6-rc +build/rootfs.ext4: + build/empty: mkdir -p $@ diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix index acc0719..95bb3a8 100644 --- a/host/rootfs/default.nix +++ b/host/rootfs/default.nix @@ -2,7 +2,7 @@ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross # SPDX-FileCopyrightText: 2022 Unikie -import ../../nix/eval-config.nix ( +import ../../lib/eval-config.nix ( { config, src, ... }: let inherit (config) pkgs; in pkgs.pkgsStatic.callPackage ( diff --git a/host/rootfs/shell.nix b/host/rootfs/shell.nix index 94e84be..fea9b16 100644 --- a/host/rootfs/shell.nix +++ b/host/rootfs/shell.nix @@ -2,7 +2,7 @@ # SPDX-FileCopyrightText: 2021 Alyssa Ross # SPDX-FileCopyrightText: 2022 Unikie -import ../../nix/eval-config.nix ({ config, ... } @ args: +import ../../lib/eval-config.nix ({ config, ... } @ args: let rootfs = import ./. { inherit config; }; diff --git a/host/start-vm/default.nix b/host/start-vm/default.nix index 767a967..f0709cd 100644 --- a/host/start-vm/default.nix +++ b/host/start-vm/default.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2022 Alyssa Ross -import ../../nix/eval-config.nix ({ config, src, ... }: config.pkgs.callPackage ( +import ../../lib/eval-config.nix ({ config, src, ... }: config.pkgs.callPackage ( { lib, stdenv, meson, ninja, rustc }: let diff --git a/host/start-vm/shell.nix b/host/start-vm/shell.nix index cbc1fee..f470233 100644 --- a/host/start-vm/shell.nix +++ b/host/start-vm/shell.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021 Alyssa Ross -import ../../nix/eval-config.nix ({ config, ... }: +import ../../lib/eval-config.nix ({ config, ... }: with config.pkgs; diff --git a/img/app/Makefile b/img/app/Makefile index 7a59693..9649403 100644 --- a/img/app/Makefile +++ b/img/app/Makefile @@ -1,11 +1,7 @@ # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -# qemu-kvm is non-standard, but is present in at least Fedora and -# Nixpkgs. If you don't have qemu-kvm, you'll need to set e.g. -# QEMU_KVM = qemu-system-x86_64 -enable-kvm. -QEMU_KVM = qemu-kvm -CLOUD_HYPERVISOR = cloud-hypervisor +include ../../lib/common.mk prefix = /usr/local imgdir = $(prefix)/img @@ -34,13 +30,6 @@ build/host/appvm/blk/root.img: ../../scripts/make-gpt.sh ../../scripts/sfdisk-fi build/rootfs.ext4:4f68bce3-e8cd-4db1-96e7-fbcaf984b709:5460386f-2203-4911-8694-91400125c604:root mv $@.tmp $@ -# tar2ext4 will leave half a filesystem behind if it's interrupted -# half way through. -build/rootfs.ext4: build/rootfs.tar - mkdir -p $$(dirname $@) - tar2ext4 -i build/rootfs.tar -o $@.tmp - mv $@.tmp $@ - VM_FILES = \ etc/fstab \ etc/init \ diff --git a/img/app/default.nix b/img/app/default.nix index 7aa22ad..dbffff0 100644 --- a/img/app/default.nix +++ b/img/app/default.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -import ../../nix/eval-config.nix ( +import ../../lib/eval-config.nix ( { config, src, terminfo ? config.pkgs.foot.terminfo, ... }: config.pkgs.pkgsStatic.callPackage ( diff --git a/img/app/shell.nix b/img/app/shell.nix index 7a323aa..9fe6031 100644 --- a/img/app/shell.nix +++ b/img/app/shell.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -import ../../nix/eval-config.nix ( +import ../../lib/eval-config.nix ( { config, run ? ../../vm/app/catgirl.nix, ... }: with config.pkgs; diff --git a/lib/common.mk b/lib/common.mk new file mode 100644 index 0000000..efa04a0 --- /dev/null +++ b/lib/common.mk @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: EUPL-1.2+ +# SPDX-FileCopyrightText: 2021, 2023 Alyssa Ross + +.POSIX: + +# qemu-kvm is non-standard, but is present in at least Fedora and +# Nixpkgs. If you don't have qemu-kvm, you'll need to set e.g. +# QEMU_KVM = qemu-system-x86_64 -enable-kvm. +QEMU_KVM = qemu-kvm + +CLOUD_HYPERVISOR = cloud-hypervisor +CPIO = cpio +CPIOFLAGS = --reproducible -R +0:+0 -H newc +MCOPY = mcopy +MKFS_FAT = mkfs.fat +MMD = mmd +OBJCOPY = objcopy +TAR = tar +TAR2EXT4 = tar2ext4 +TRUNCATE = truncate +VERITYSETUP = veritysetup + +.SUFFIXES: .ext4 .tar +.tar.ext4: + $(TAR2EXT4) -i $< -o $@ diff --git a/lib/eval-config.nix b/lib/eval-config.nix new file mode 100644 index 0000000..78cdeae --- /dev/null +++ b/lib/eval-config.nix @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: MIT +# SPDX-FileCopyrightText: 2022 Unikie +# SPDX-FileCopyrightText: 2023 Alyssa Ross + +# The empty list of attribute set arguments is required, because +# otherwise Nix will not pass arguments supplied on the command line +# with --arg/--argstr. +callback: { ... } @ args: + +let + customConfigPath = builtins.tryEval ; +in + +callback (args // rec { + config = ({ pkgs ? import {} }: { + inherit pkgs; + }) args.config or (if customConfigPath.success then import customConfigPath.value + else if builtins.pathExists ../config.nix then import ../config.nix + else {}); + + src = with config.pkgs.lib; cleanSourceWith { + filter = path: type: + path != toString ../Documentation/_site && + path != toString ../Documentation/.jekyll-cache && + path != toString ../Documentation/diagrams/stack.svg && + (type == "file" -> !hasSuffix ".nix" path) && + (type == "directory" -> builtins.baseNameOf path != "build"); + src = cleanSource ../.; + }; +}) diff --git a/nix/checks.nix b/nix/checks.nix deleted file mode 100644 index d5a40c0..0000000 --- a/nix/checks.nix +++ /dev/null @@ -1,55 +0,0 @@ -# SPDX-License-Identifier: MIT -# SPDX-FileCopyrightText: 2022 Unikie - -import ../nix/eval-config.nix ({ config, src, ... }: { - recurseForDerivations = true; - - doc-links = config.pkgs.callPackage ( - { lib, runCommand, ruby, wget }: - runCommand "spectrum-doc-links" { - doc = import ../Documentation { inherit config; }; - nativeBuildInputs = [ ruby wget ]; - } '' - mkdir root - ln -s $doc root/doc - ruby -run -e httpd -- --port 4000 root & - wget -r -nv --delete-after --no-parent --retry-connrefused http://localhost:4000/doc/ - touch $out - '' - ) {}; - - reuse = config.pkgs.callPackage ( - { lib, runCommand, reuse }: - runCommand "spectrum-reuse" { - inherit src; - nativeBuildInputs = [ reuse ]; - } '' - reuse --root $src lint - touch $out - '' - ) {}; - - rustfmt = config.pkgs.callPackage ( - { lib, runCommand, rustfmt }: - runCommand "spectrum-rustfmt" { - inherit src; - nativeBuildInputs = [ rustfmt ]; - } '' - shopt -s globstar - rustfmt --check $src/**/*.rs - touch $out - '' - ) {}; - - shellcheck = config.pkgs.callPackage ( - { lib, runCommand, shellcheck }: - runCommand "spectrum-shellcheck" { - inherit src; - nativeBuildInputs = [ shellcheck ]; - } '' - shopt -s globstar - shellcheck $src/**/*.sh - touch $out - '' - ) {}; -}) diff --git a/nix/eval-config.nix b/nix/eval-config.nix deleted file mode 100644 index 78cdeae..0000000 --- a/nix/eval-config.nix +++ /dev/null @@ -1,30 +0,0 @@ -# SPDX-License-Identifier: MIT -# SPDX-FileCopyrightText: 2022 Unikie -# SPDX-FileCopyrightText: 2023 Alyssa Ross - -# The empty list of attribute set arguments is required, because -# otherwise Nix will not pass arguments supplied on the command line -# with --arg/--argstr. -callback: { ... } @ args: - -let - customConfigPath = builtins.tryEval ; -in - -callback (args // rec { - config = ({ pkgs ? import {} }: { - inherit pkgs; - }) args.config or (if customConfigPath.success then import customConfigPath.value - else if builtins.pathExists ../config.nix then import ../config.nix - else {}); - - src = with config.pkgs.lib; cleanSourceWith { - filter = path: type: - path != toString ../Documentation/_site && - path != toString ../Documentation/.jekyll-cache && - path != toString ../Documentation/diagrams/stack.svg && - (type == "file" -> !hasSuffix ".nix" path) && - (type == "directory" -> builtins.baseNameOf path != "build"); - src = cleanSource ../.; - }; -}) diff --git a/release.nix b/release.nix index 707c86c..7f758ae 100644 --- a/release.nix +++ b/release.nix @@ -3,10 +3,10 @@ # This file is built to populate the binary cache. -import nix/eval-config.nix ({ config, ... }: { +import lib/eval-config.nix ({ config, ... }: { doc = import ./Documentation { inherit config; }; - checks = import nix/checks.nix { inherit config; }; + checks = import release/checks.nix { inherit config; }; combined = import release/combined/run-vm.nix { inherit config; }; }) diff --git a/release/checks.nix b/release/checks.nix new file mode 100644 index 0000000..ee79c8d --- /dev/null +++ b/release/checks.nix @@ -0,0 +1,55 @@ +# SPDX-License-Identifier: MIT +# SPDX-FileCopyrightText: 2022 Unikie + +import ../lib/eval-config.nix ({ config, src, ... }: { + recurseForDerivations = true; + + doc-links = config.pkgs.callPackage ( + { lib, runCommand, ruby, wget }: + runCommand "spectrum-doc-links" { + doc = import ../Documentation { inherit config; }; + nativeBuildInputs = [ ruby wget ]; + } '' + mkdir root + ln -s $doc root/doc + ruby -run -e httpd -- --port 4000 root & + wget -r -nv --delete-after --no-parent --retry-connrefused http://localhost:4000/doc/ + touch $out + '' + ) {}; + + reuse = config.pkgs.callPackage ( + { lib, runCommand, reuse }: + runCommand "spectrum-reuse" { + inherit src; + nativeBuildInputs = [ reuse ]; + } '' + reuse --root $src lint + touch $out + '' + ) {}; + + rustfmt = config.pkgs.callPackage ( + { lib, runCommand, rustfmt }: + runCommand "spectrum-rustfmt" { + inherit src; + nativeBuildInputs = [ rustfmt ]; + } '' + shopt -s globstar + rustfmt --check $src/**/*.rs + touch $out + '' + ) {}; + + shellcheck = config.pkgs.callPackage ( + { lib, runCommand, shellcheck }: + runCommand "spectrum-shellcheck" { + inherit src; + nativeBuildInputs = [ shellcheck ]; + } '' + shopt -s globstar + shellcheck $src/**/*.sh + touch $out + '' + ) {}; +}) diff --git a/release/combined/default.nix b/release/combined/default.nix index 7f7b3a2..6740497 100644 --- a/release/combined/default.nix +++ b/release/combined/default.nix @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2021 Yureka # SPDX-FileCopyrightText: 2022 Unikie -import ../../nix/eval-config.nix ({ config, ... } @ args: with config.pkgs; +import ../../lib/eval-config.nix ({ config, ... } @ args: with config.pkgs; let inherit (builtins) storeDir; diff --git a/release/combined/eosimages.nix b/release/combined/eosimages.nix index b2dba13..5850b15 100644 --- a/release/combined/eosimages.nix +++ b/release/combined/eosimages.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -import ../../nix/eval-config.nix ({ config, ... }: with config.pkgs; +import ../../lib/eval-config.nix ({ config, ... }: with config.pkgs; runCommand "eosimages.img" { nativeBuildInputs = [ e2fsprogs tar2ext4 ]; diff --git a/release/combined/run-vm.nix b/release/combined/run-vm.nix index 10bd8bf..819f549 100644 --- a/release/combined/run-vm.nix +++ b/release/combined/run-vm.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021 Alyssa Ross -import ../../nix/eval-config.nix ({ config, ... }: with config.pkgs; +import ../../lib/eval-config.nix ({ config, ... }: with config.pkgs; let image = import ./. { inherit config; }; diff --git a/release/installer/default.nix b/release/installer/default.nix index 16a7d35..44f3be2 100644 --- a/release/installer/default.nix +++ b/release/installer/default.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -import ../../nix/eval-config.nix ({ config, extraConfig ? {}, ... }: +import ../../lib/eval-config.nix ({ config, extraConfig ? {}, ... }: with config.pkgs; let diff --git a/release/installer/run-vm.nix b/release/installer/run-vm.nix index c42155b..024bd5d 100644 --- a/release/installer/run-vm.nix +++ b/release/installer/run-vm.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -import ../../nix/eval-config.nix ({ config, ... }: +import ../../lib/eval-config.nix ({ config, ... }: let inherit (builtins) storeDir; diff --git a/release/live/Makefile b/release/live/Makefile index f887f0a..4eeeaa6 100644 --- a/release/live/Makefile +++ b/release/live/Makefile @@ -1,17 +1,7 @@ # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -# qemu-kvm is non-standard, but is present in at least Fedora and -# Nixpkgs. If you don't have qemu-kvm, you'll need to set e.g. -# QEMU_KVM = qemu-system-x86_64 -enable-kvm. -QEMU_KVM = qemu-kvm - -MCOPY = mcopy -MKFS_FAT = mkfs.fat -MMD = mmd -OBJCOPY = objcopy -TRUNCATE = truncate -VERITYSETUP = veritysetup +include ../../lib/common.mk build/live.img: ../../scripts/format-uuid.sh ../../scripts/make-gpt.sh build/boot.fat build/rootfs.verity.superblock build/rootfs.verity.roothash $(ROOT_FS) $(EXT_FS) ../../scripts/make-gpt.sh $@.tmp \ diff --git a/release/live/default.nix b/release/live/default.nix index c36c34b..cdbd348 100644 --- a/release/live/default.nix +++ b/release/live/default.nix @@ -2,7 +2,7 @@ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross # SPDX-FileCopyrightText: 2022 Unikie -import ../../nix/eval-config.nix ({ config, src, ... }: +import ../../lib/eval-config.nix ({ config, src, ... }: config.pkgs.callPackage ( { stdenvNoCC, cryptsetup, dosfstools, jq, mtools, util-linux, stdenv diff --git a/release/live/shell.nix b/release/live/shell.nix index 7cec144..577b714 100644 --- a/release/live/shell.nix +++ b/release/live/shell.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -import ../../nix/eval-config.nix ({ config, ... }: +import ../../lib/eval-config.nix ({ config, ... }: with config.pkgs; diff --git a/shell.nix b/shell.nix index c249aa6..bcb3de9 100644 --- a/shell.nix +++ b/shell.nix @@ -2,7 +2,7 @@ # SPDX-FileCopyrightText: 2022 Unikie # SPDX-License-Identifier: MIT -import nix/eval-config.nix ({ config, ... }: with config.pkgs; +import lib/eval-config.nix ({ config, ... }: with config.pkgs; mkShell { nativeBuildInputs = [ b4 reuse rustfmt ]; diff --git a/vm/app/catgirl.nix b/vm/app/catgirl.nix index f74acc9..7cd76a9 100644 --- a/vm/app/catgirl.nix +++ b/vm/app/catgirl.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -import ../../nix/eval-config.nix ({ config, ... }: +import ../../lib/eval-config.nix ({ config, ... }: import ../make-vm.nix { inherit config; } { providers.net = [ "netvm" ]; diff --git a/vm/app/lynx.nix b/vm/app/lynx.nix index d0b36a0..21cb56e 100644 --- a/vm/app/lynx.nix +++ b/vm/app/lynx.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -import ../../nix/eval-config.nix ({ config, ... }: +import ../../lib/eval-config.nix ({ config, ... }: import ../make-vm.nix { inherit config; } { providers.net = [ "netvm" ]; diff --git a/vm/make-vm.nix b/vm/make-vm.nix index da3bdf7..d33cedd 100644 --- a/vm/make-vm.nix +++ b/vm/make-vm.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2022 Alyssa Ross -import ../nix/eval-config.nix ({ config, ... }: +import ../lib/eval-config.nix ({ config, ... }: import ../vm-lib/make-vm.nix { inherit (config) pkgs; diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile index 076e991..cb294a4 100644 --- a/vm/sys/net/Makefile +++ b/vm/sys/net/Makefile @@ -1,11 +1,7 @@ # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -# qemu-kvm is non-standard, but is present in at least Fedora and -# Nixpkgs. If you don't have qemu-kvm, you'll need to set e.g. -# QEMU_KVM = qemu-system-x86_64 -enable-kvm. -QEMU_KVM = qemu-kvm -CLOUD_HYPERVISOR = cloud-hypervisor +include ../../../lib/common.mk VMM = qemu @@ -36,13 +32,6 @@ build/host/data/netvm/blk/root.img: ../../../scripts/make-gpt.sh ../../../script build/rootfs.ext4:4f68bce3-e8cd-4db1-96e7-fbcaf984b709:ea21da27-0391-48da-9235-9d2ab2ca7844:root mv $@.tmp $@ -# tar2ext4 will leave half a filesystem behind if it's interrupted -# half way through. -build/rootfs.ext4: build/rootfs.tar - mkdir -p $$(dirname $@) - tar2ext4 -i build/rootfs.tar -o $@.tmp - mv $@.tmp $@ - VM_FILES = \ etc/dbus-1/system.conf \ etc/fstab \ diff --git a/vm/sys/net/default.nix b/vm/sys/net/default.nix index a30f5f5..a7f6cc0 100644 --- a/vm/sys/net/default.nix +++ b/vm/sys/net/default.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross -import ../../../nix/eval-config.nix ( +import ../../../lib/eval-config.nix ( { config, src, terminfo ? config.pkgs.foot.terminfo, ... }: config.pkgs.pkgsStatic.callPackage ( diff --git a/vm/sys/net/shell.nix b/vm/sys/net/shell.nix index f298431..c0771e8 100644 --- a/vm/sys/net/shell.nix +++ b/vm/sys/net/shell.nix @@ -1,7 +1,7 @@ # SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021 Alyssa Ross -import ../../../nix/eval-config.nix ({ config, ... }: with config.pkgs; +import ../../../lib/eval-config.nix ({ config, ... }: with config.pkgs; (import ./. { inherit config; }).overrideAttrs ( { passthru ? {}, nativeBuildInputs ? [], ... }: -- cgit 1.4.1