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, ... }:
|
{ config, lib, options, pkgs, ... }: {
|
||||||
let
|
|
||||||
vmOptions = { };
|
|
||||||
in {
|
|
||||||
options = {
|
options = {
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
vmVariant = vmOptions;
|
runAsRoot = lib.mkOption {
|
||||||
vmVariantWithBootLoader = vmOptions;
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,10 +35,11 @@
|
||||||
mergedSystem.mergedValue.vm
|
mergedSystem.mergedValue.vm
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
|
prefix = lib.concatStringsSep " " (lib.optional config.virtualisation.runAsRoot "sudo");
|
||||||
wrapped = pkgs.writeShellApplication {
|
wrapped = pkgs.writeShellApplication {
|
||||||
name = "run-${config.system.name}-vm";
|
name = "run-${config.system.name}-vm";
|
||||||
text = ''
|
text = ''
|
||||||
${mergedSystem.mergedValue.vm}/bin/run-${config.system.name}-vm
|
${prefix} ${mergedSystem.mergedValue.vm}/bin/run-${config.system.name}-vm
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
Loading…
Reference in a new issue