mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
nixos/qemu-vm: sanitize generated environment variable name
This commit is contained in:
parent
d5253dd45d
commit
cdef7bcb5b
1 changed files with 6 additions and 2 deletions
|
@ -853,8 +853,12 @@ in
|
||||||
(mkIf (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64) [
|
(mkIf (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64) [
|
||||||
"-device virtio-gpu-pci" "-device usb-ehci,id=usb0" "-device usb-kbd" "-device usb-tablet"
|
"-device virtio-gpu-pci" "-device usb-ehci,id=usb0" "-device usb-kbd" "-device usb-tablet"
|
||||||
])
|
])
|
||||||
(mkIf (!cfg.useBootLoader) [
|
(let
|
||||||
"-kernel \${NIXPKGS_QEMU_KERNEL_${config.system.name}:-${config.system.build.toplevel}/kernel}"
|
alphaNumericChars = lowerChars ++ upperChars ++ (map toString (range 0 9));
|
||||||
|
# Replace all non-alphanumeric characters with underscores
|
||||||
|
sanitizeShellIdent = s: concatMapStrings (c: if builtins.elem c alphaNumericChars then c else "_") (stringToCharacters s);
|
||||||
|
in mkIf (!cfg.useBootLoader) [
|
||||||
|
"-kernel \${NIXPKGS_QEMU_KERNEL_${sanitizeShellIdent config.system.name}:-${config.system.build.toplevel}/kernel}"
|
||||||
"-initrd ${config.system.build.toplevel}/initrd"
|
"-initrd ${config.system.build.toplevel}/initrd"
|
||||||
''-append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.toplevel}/init regInfo=${regInfo}/registration ${consoles} $QEMU_KERNEL_PARAMS"''
|
''-append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.toplevel}/init regInfo=${regInfo}/registration ${consoles} $QEMU_KERNEL_PARAMS"''
|
||||||
])
|
])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue