mirror of
https://code.dumpstack.io/tools/appvm.git
synced 2024-12-23 19:39:47 +00:00
First useful solution
This commit is contained in:
parent
4cd7319752
commit
2fef367e45
5
.gitignore
vendored
5
.gitignore
vendored
@ -1 +1,4 @@
|
||||
bin
|
||||
bin/*
|
||||
!bin/.keep
|
||||
qemu/qcow2/*
|
||||
!qemu/qcow2/.keep
|
||||
|
12
appvm.sh
Executable file
12
appvm.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
if [[ "$1" == "build" && "$2" != "" ]]; then
|
||||
NIX_PATH=$NIX_PATH:. nix-build '<nixpkgs/nixos>' -A config.system.build.vm -I nixos-config=nix/${2}.nix || exit 1
|
||||
NIX_SYSTEM=$(realpath result/system)
|
||||
mkdir -p bin
|
||||
sed "s;NIX_SYSTEM_PLACEHOLDER;${NIX_SYSTEM};" qemu/qemu.template > bin/appvm.${2}
|
||||
sed -i "s;NAME_PLACEHOLDER;${2};" bin/appvm.${2}
|
||||
chmod +x bin/appvm.${2}
|
||||
unlink result
|
||||
else
|
||||
echo "Usage: $0 build APPLICATION"
|
||||
fi
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
imports = [
|
||||
<nixpkgs/nixos/modules/virtualisation/qemu-vm.nix>
|
||||
<base.nix>
|
||||
<nix/base.nix>
|
||||
];
|
||||
|
||||
environment.systemPackages = [ pkgs.tdesktop ];
|
0
qemu/qcow2/.keep
Normal file
0
qemu/qcow2/.keep
Normal file
@ -1,6 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
NIX_DISK_IMAGE=$(readlink -f ${NIX_DISK_IMAGE:-./tdesktop.qcow2})
|
||||
NAME=NAME_PLACEHOLDER
|
||||
|
||||
NIX_DISK_IMAGE=$(readlink -f ${NIX_DISK_IMAGE:-./${NAME}.qcow2})
|
||||
|
||||
if ! test -e "$NIX_DISK_IMAGE"; then
|
||||
qemu-img create -f qcow2 "$NIX_DISK_IMAGE" 512M || exit 1
|
||||
@ -19,7 +21,7 @@ NIX_SYSTEM="NIX_SYSTEM_PLACEHOLDER"
|
||||
|
||||
# Start QEMU.
|
||||
qemu-system-x86_64 -enable-kvm \
|
||||
-name tdesktop \
|
||||
-name NAME_PLACEHOLDER \
|
||||
-m 1024 \
|
||||
-smp 1 \
|
||||
-device virtio-rng-pci \
|
Loading…
Reference in New Issue
Block a user