mirror of
https://code.dumpstack.io/tools/appvm.git
synced 2024-12-23 19:39:47 +00:00
Shutdown vm at app close, initial support for args
This commit is contained in:
parent
8baa1ff73b
commit
3e8a08d638
15
generate.go
15
generate.go
@ -14,14 +14,23 @@ import (
|
||||
|
||||
var template = `
|
||||
{pkgs, ...}:
|
||||
{
|
||||
let
|
||||
application = "${pkgs.%s}/bin/%s";
|
||||
appRunner = pkgs.writeShellScriptBin "app" ''
|
||||
ARGS_FILE=/home/user/.args
|
||||
ARGS=$(cat $ARGS_FILE)
|
||||
rm $ARGS_FILE
|
||||
|
||||
${application} $ARGS
|
||||
systemctl poweroff
|
||||
'';
|
||||
in {
|
||||
imports = [
|
||||
<nixpkgs/nixos/modules/virtualisation/qemu-vm.nix>
|
||||
<nix/base.nix>
|
||||
];
|
||||
|
||||
services.xserver.displayManager.sessionCommands =
|
||||
"while [ 1 ]; do ${pkgs.%s}/bin/%s; done &";
|
||||
services.xserver.displayManager.sessionCommands = "${appRunner}/bin/app &";
|
||||
}
|
||||
`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user