diff --git a/default.nix b/default.nix index 5f23d16..41f2387 100644 --- a/default.nix +++ b/default.nix @@ -54,7 +54,7 @@ in { tufted routeros.routeros routeros.ros-exec-script - mips-vm + run-liminix-vm borderVm.build.vm go-l2tp min-copy-closure diff --git a/devices/qemu/default.nix b/devices/qemu/default.nix index ee199dd..f2a7bf3 100644 --- a/devices/qemu/default.nix +++ b/devices/qemu/default.nix @@ -50,7 +50,7 @@ }; in { defaultOutput = "vmroot"; - flash.eraseBlockSize = "65536"; # c.f. pkgs/mips-vm/mips-vm.sh + flash.eraseBlockSize = "65536"; # c.f. pkgs/run-liminix-vm/run-liminix-vm.sh networkInterfaces = let inherit (config.system.service.network) link; in { diff --git a/doc/development.rst b/doc/development.rst index c47bfb5..f7cc19c 100644 --- a/doc/development.rst +++ b/doc/development.rst @@ -27,13 +27,13 @@ To build it, nix-build -I liminix-config=path/to/your/configuration.nix --arg device "import ./devices/qemu" -A outputs.default -In a ``buildEnv`` nix-shell, you can use the :command:`mips-vm` command +In a ``buildEnv`` nix-shell, you can use the :command:`run-liminix-vm` command to run Qemu with appropriate options. It connects the Liminix serial console and the `QEMU monitor `_ to stdin/stdout. Use ^P (not ^A) to switch to the monitor. .. code-block:: console - nix-shell --run "mips-vm result/vmlinux result/squashfs" + nix-shell --run "run-liminix-vm result/vmlinux result/squashfs" If you run with ``--background /path/to/some/directory`` as the first parameter, it will fork into the background and open Unix sockets in @@ -53,7 +53,7 @@ the right way: * multicast 230.0.0.1:1235 : lan * multicast 230.0.0.1:1236 : world (the internet) -A VM started with :command:`mips-vm` is connected to "lan" and "access", and +A VM started with :command:`run-liminix-vm` is connected to "lan" and "access", and the emulated border network gateway (see below) runs PPPoE and is connected to "access" and "world". diff --git a/doc/tutorial.rst b/doc/tutorial.rst index 7a50099..bb5ab8b 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -60,7 +60,7 @@ Now you can try it: .. code-block:: console - nix-shell --run "mips-vm ./result/vmlinux ./result/rootfs" + nix-shell --run "run-liminix-vm ./result/vmlinux ./result/rootfs" This starts the Qemu emulator with a bunch of useful options, to run the Liminix configuration you just built. It connects the emulated diff --git a/modules/outputs.nix b/modules/outputs.nix index 02c3cd1..6e8ec2d 100644 --- a/modules/outputs.nix +++ b/modules/outputs.nix @@ -36,7 +36,7 @@ in type = types.package; description = '' Directory containing separate kernel and rootfs image for - use with qemu (see mips-vm) + use with qemu (see run-liminix-vm) ''; }; manifest = mkOption { diff --git a/pkgs/default.nix b/pkgs/default.nix index a7233c3..13cd494 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -59,7 +59,7 @@ in { systemconfig = callPackage ./systemconfig {}; s6-init-bin = callPackage ./s6-init-bin {}; s6-rc-database = callPackage ./s6-rc-database {}; - mips-vm = callPackage ./mips-vm {}; + run-liminix-vm = callPackage ./run-liminix-vm {}; ppp = callPackage ./ppp {}; pppoe = callPackage ./pppoe {}; diff --git a/pkgs/mips-vm/default.nix b/pkgs/run-liminix-vm/default.nix similarity index 65% rename from pkgs/mips-vm/default.nix rename to pkgs/run-liminix-vm/default.nix index 21d268c..323810f 100644 --- a/pkgs/mips-vm/default.nix +++ b/pkgs/run-liminix-vm/default.nix @@ -5,15 +5,15 @@ , symlinkJoin , lib }: let - mips-vm = writeShellScriptBin "mips-vm" '' + run-liminix-vm = writeShellScriptBin "run-liminix-vm" '' export PATH="${lib.makeBinPath [qemu]}:$PATH" - ${builtins.readFile ./mips-vm.sh} + ${builtins.readFile ./run-liminix-vm.sh} ''; connect = writeShellScriptBin "connect-vm" '' export PATH="${lib.makeBinPath [socat]}:$PATH" socat -,raw,echo=0,icanon=0,isig=0,icrnl=0,escape=0x0f unix-connect:$1 ''; in symlinkJoin { - name = "mips-vm"; - paths = [ mips-vm connect ]; + name = "run-liminix-vm"; + paths = [ run-liminix-vm connect ]; } diff --git a/pkgs/mips-vm/mips-vm.sh b/pkgs/run-liminix-vm/mips-vm.sh similarity index 97% rename from pkgs/mips-vm/mips-vm.sh rename to pkgs/run-liminix-vm/mips-vm.sh index 2f534ab..f23671b 100755 --- a/pkgs/mips-vm/mips-vm.sh +++ b/pkgs/run-liminix-vm/mips-vm.sh @@ -31,7 +31,7 @@ test -n "$2" || usage lan=${LAN-"socket,mcast=230.0.0.1:1235,localaddr=127.0.0.1"} -rootfs=$(mktemp mips-vm-fs-XXXXXX) +rootfs=$(mktemp run-liminix-vm-fs-XXXXXX) dd if=/dev/zero of=$rootfs bs=1M count=16 conv=sync dd if=$2 of=$rootfs bs=65536 conv=sync,nocreat,notrunc diff --git a/tests/jffs2/test.nix b/tests/jffs2/test.nix index 7a04b03..44ad570 100644 --- a/tests/jffs2/test.nix +++ b/tests/jffs2/test.nix @@ -7,15 +7,15 @@ let img = (import liminix { liminix-config = ./configuration.nix; }).outputs.vmroot; pkgs = import { overlays = [(import ../../overlay.nix)]; }; - inherit (pkgs.pkgsBuildBuild) routeros mips-vm; + inherit (pkgs.pkgsBuildBuild) routeros run-liminix-vm; in pkgs.runCommand "check" { nativeBuildInputs = with pkgs; [ - mips-vm + run-liminix-vm expect socat ] ; } '' mkdir vm -mips-vm --background ./vm ${img}/vmlinux ${img}/rootfs +run-liminix-vm --background ./vm ${img}/vmlinux ${img}/rootfs expect ${./script.expect} >$out '' diff --git a/tests/min-copy-closure/test.nix b/tests/min-copy-closure/test.nix index fc58b68..d296bbd 100644 --- a/tests/min-copy-closure/test.nix +++ b/tests/min-copy-closure/test.nix @@ -9,11 +9,11 @@ let lmx = (import liminix { rogue = lmx.pkgs.rogue; img = lmx.outputs.vmroot; pkgs = import { overlays = [(import ../../overlay.nix)]; }; - inherit (pkgs.pkgsBuildBuild) mips-vm; + inherit (pkgs.pkgsBuildBuild) run-liminix-vm; in pkgs.runCommand "check" { nativeBuildInputs = with pkgs; [ expect - mips-vm + run-liminix-vm socat min-copy-closure rogue @@ -22,7 +22,7 @@ in pkgs.runCommand "check" { . ${../test-helpers.sh} mkdir vm -LAN=user,hostfwd=tcp::2022-:22 mips-vm --background ./vm ${img}/vmlinux ${img}/rootfs +LAN=user,hostfwd=tcp::2022-:22 run-liminix-vm --background ./vm ${img}/vmlinux ${img}/rootfs expect ${./wait-until-ready.expect} export SSH_COMMAND="ssh -o StrictHostKeyChecking=no -p 2022 -i ${./id}" $SSH_COMMAND root@localhost echo ready diff --git a/tests/pppoe/test.nix b/tests/pppoe/test.nix index c5d261f..d0d1754 100644 --- a/tests/pppoe/test.nix +++ b/tests/pppoe/test.nix @@ -7,7 +7,7 @@ let img = (import liminix { liminix-config = ./configuration.nix; }).outputs.default; pkgs = import { overlays = [(import ../../overlay.nix)]; }; - inherit (pkgs.pkgsBuildBuild) routeros mips-vm; + inherit (pkgs.pkgsBuildBuild) routeros run-liminix-vm; in pkgs.runCommand "check" { nativeBuildInputs = with pkgs; [ python3Packages.scapy @@ -15,7 +15,7 @@ in pkgs.runCommand "check" { jq socat routeros.routeros - mips-vm + run-liminix-vm ] ; } '' serverstatedir=$(mktemp -d -t routeros-XXXXXX) @@ -27,7 +27,7 @@ export MPLCONFIGDIR=$(mktemp -d -t routeros-XXXXXX) routeros $serverstatedir mkdir vm -mips-vm --background ./vm ${img}/vmlinux ${img}/rootfs +run-liminix-vm --background ./vm ${img}/vmlinux ${img}/rootfs expect ${./getaddress.expect} set -o pipefail diff --git a/tests/wlan/test.nix b/tests/wlan/test.nix index 4afc38d..3dd9989 100644 --- a/tests/wlan/test.nix +++ b/tests/wlan/test.nix @@ -7,17 +7,17 @@ let img = (import liminix { liminix-config = ./configuration.nix; }).outputs.default; pkgs = import { overlays = [(import ../../overlay.nix)]; }; - inherit (pkgs.pkgsBuildBuild) mips-vm; + inherit (pkgs.pkgsBuildBuild) run-liminix-vm; in pkgs.runCommand "check" { nativeBuildInputs = with pkgs; [ expect - mips-vm + run-liminix-vm socat ] ; } '' . ${../test-helpers.sh} mkdir vm -mips-vm --background ./vm ${img}/vmlinux ${img}/rootfs +run-liminix-vm --background ./vm ${img}/vmlinux ${img}/rootfs expect ${./wait-for-wlan.expect} |tee output && mv output $out ''