Skip to content

Commit

Permalink
doc: fix literalExpression in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelCoding authored and astro committed Nov 25, 2024
1 parent ebbf56b commit 77f0b82
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
8 changes: 5 additions & 3 deletions nixos-modules/host/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@
at all, just set
`systemd.services."microvm-tap-interfaces@%i.service".enable = false`
'';
example = ''
example = lib.literalExpression ''
# Attach tap interface to bridge br0, and bring it up
''${pkgs.iproute2}/bin/ip link set "$id" master br0 up
"${pkgs.iproute2}/bin/ip link set \"$id\" master br0 up"
'';
type = types.lines;
default = ''
${pkgs.iproute2}/bin/ip link set "$id" up
'';
defaultText = "''${pkgs.iproute2}/bin/ip link set \"$id\" up";
defaultText = ''
${pkgs.iproute2}/bin/ip link set "$id" up
'';
};

vms = mkOption {
Expand Down
29 changes: 15 additions & 14 deletions nixos-modules/microvm/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ in
};
});
default = [];
example = lib.literalExpression
''
example = lib.literalExpression /* nix */ ''
[ # forward local port 2222 -> 22, to ssh into the VM
{ from = "host"; host.port = 2222; guest.port = 22; }
Expand All @@ -159,7 +158,7 @@ in
host.address = "127.0.0.1"; host.port = 80;
}
]
'';
'';
description =
''
When using the SLiRP user networking (default), this option allows to
Expand Down Expand Up @@ -319,17 +318,19 @@ in
devices = mkOption {
description = "PCI/USB devices that are passed from the host to the MicroVM";
default = [];
example = literalExpression ''[ {
bus = "pci";
path = "0000:01:00.0";
} {
bus = "pci";
path = "0000:01:01.0";
} {
# QEMU only
bus = "usb";
path = "vendorid=0xabcd,productid=0x0123";
} ]'';
example = literalExpression /* nix */ ''
[ {
bus = "pci";
path = "0000:01:00.0";
} {
bus = "pci";
path = "0000:01:01.0";
} {
# QEMU only
bus = "usb";
path = "vendorid=0xabcd,productid=0x0123";
} ]
'';
type = with types; listOf (submodule {
options = {
bus = mkOption {
Expand Down

0 comments on commit 77f0b82

Please sign in to comment.