Allow running the VM as root
This commit is contained in:
parent
0480f0d4a4
commit
cf051abbdf
1 changed files with 49 additions and 49 deletions
|
@ -1,11 +1,10 @@
|
|||
{ config, lib, options, pkgs, ... }:
|
||||
let
|
||||
vmOptions = { };
|
||||
in {
|
||||
{ config, lib, options, pkgs, ... }: {
|
||||
options = {
|
||||
virtualisation = {
|
||||
vmVariant = vmOptions;
|
||||
vmVariantWithBootLoader = vmOptions;
|
||||
runAsRoot = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -36,10 +35,11 @@
|
|||
mergedSystem.mergedValue.vm
|
||||
else
|
||||
let
|
||||
prefix = lib.concatStringsSep " " (lib.optional config.virtualisation.runAsRoot "sudo");
|
||||
wrapped = pkgs.writeShellApplication {
|
||||
name = "run-${config.system.name}-vm";
|
||||
text = ''
|
||||
${mergedSystem.mergedValue.vm}/bin/run-${config.system.name}-vm
|
||||
${prefix} ${mergedSystem.mergedValue.vm}/bin/run-${config.system.name}-vm
|
||||
'';
|
||||
};
|
||||
in
|
||||
|
|
Loading…
Reference in a new issue