liminix/pkgs/run-liminix-vm/default.nix
Daniel Barlow 98d3336926 rewrite run-liminix-vm as a fennel program
the effect of shell quoting/word splitting rules was reaching
completely unreasonable, insofar as I was unable to reason about it
2023-12-03 22:51:39 +00:00

23 lines
564 B
Nix

{
qemu
, socat
, writeShellScript
, writeFennel
, runCommand
, lib
, lua
, pkgsBuildBuild
}: let
run-liminix-vm = pkgsBuildBuild.writeFennel "run-liminix-vm" {
packages = [ qemu lua.pkgs.luaposix lua.pkgs.fennel ];
} ./run-liminix-vm.fnl;
connect = writeShellScript "connect-vm" ''
export PATH="${lib.makeBinPath [socat]}:$PATH"
socat -,raw,echo=0,icanon=0,isig=0,icrnl=0,escape=0x0f unix-connect:$1
'';
in runCommand "vm" {} ''
mkdir -p $out/bin
cd $out/bin
ln -s ${connect} ./connect-vm
ln -s ${run-liminix-vm} ./run-liminix-vm
''