summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Documentation/default.nix2
-rw-r--r--Documentation/jekyll.nix2
-rw-r--r--host/initramfs/Makefile15
-rw-r--r--host/initramfs/default.nix2
-rw-r--r--host/initramfs/shell.nix2
-rw-r--r--host/rootfs/Makefile15
-rw-r--r--host/rootfs/default.nix2
-rw-r--r--host/rootfs/shell.nix2
-rw-r--r--host/start-vm/default.nix2
-rw-r--r--host/start-vm/shell.nix2
-rw-r--r--img/app/Makefile13
-rw-r--r--img/app/default.nix2
-rw-r--r--img/app/shell.nix2
-rw-r--r--lib/common.mk25
-rw-r--r--lib/eval-config.nix (renamed from nix/eval-config.nix)0
-rw-r--r--release.nix4
-rw-r--r--release/checks.nix (renamed from nix/checks.nix)2
-rw-r--r--release/combined/default.nix2
-rw-r--r--release/combined/eosimages.nix2
-rw-r--r--release/combined/run-vm.nix2
-rw-r--r--release/installer/default.nix2
-rw-r--r--release/installer/run-vm.nix2
-rw-r--r--release/live/Makefile12
-rw-r--r--release/live/default.nix2
-rw-r--r--release/live/shell.nix2
-rw-r--r--shell.nix2
-rw-r--r--vm/app/catgirl.nix2
-rw-r--r--vm/app/lynx.nix2
-rw-r--r--vm/make-vm.nix2
-rw-r--r--vm/sys/net/Makefile13
-rw-r--r--vm/sys/net/default.nix2
-rw-r--r--vm/sys/net/shell.nix2
32 files changed, 58 insertions, 87 deletions
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 <hi@alyssa.is>
 # 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 <hi@alyssa.is>
 
-# 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 <hi@alyssa.is>
 # 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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
 
-# 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 <hi@alyssa.is>
 # 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 <hi@alyssa.is>
 # 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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
 
-# 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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
+
+.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/nix/eval-config.nix b/lib/eval-config.nix
index 78cdeae..78cdeae 100644
--- a/nix/eval-config.nix
+++ b/lib/eval-config.nix
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/nix/checks.nix b/release/checks.nix
index d5a40c0..ee79c8d 100644
--- a/nix/checks.nix
+++ b/release/checks.nix
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: MIT
 # SPDX-FileCopyrightText: 2022 Unikie
 
-import ../nix/eval-config.nix ({ config, src, ... }: {
+import ../lib/eval-config.nix ({ config, src, ... }: {
   recurseForDerivations = true;
 
   doc-links = config.pkgs.callPackage (
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 <yuka@yuka.dev>
 # 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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
 
-# 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 <hi@alyssa.is>
 # 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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
 
-# 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 <hi@alyssa.is>
 
-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 <hi@alyssa.is>
 
-import ../../../nix/eval-config.nix ({ config, ... }: with config.pkgs;
+import ../../../lib/eval-config.nix ({ config, ... }: with config.pkgs;
 
 (import ./. { inherit config; }).overrideAttrs (
 { passthru ? {}, nativeBuildInputs ? [], ... }: