Skip to content

Commit 77f0b82

Browse files
MarcelCodingastro
authored andcommitted
doc: fix literalExpression in examples
1 parent ebbf56b commit 77f0b82

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

nixos-modules/host/options.nix

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,17 @@
3232
at all, just set
3333
`systemd.services."microvm-tap-interfaces@%i.service".enable = false`
3434
'';
35-
example = ''
35+
example = lib.literalExpression ''
3636
# Attach tap interface to bridge br0, and bring it up
37-
''${pkgs.iproute2}/bin/ip link set "$id" master br0 up
37+
"${pkgs.iproute2}/bin/ip link set \"$id\" master br0 up"
3838
'';
3939
type = types.lines;
4040
default = ''
4141
${pkgs.iproute2}/bin/ip link set "$id" up
4242
'';
43-
defaultText = "''${pkgs.iproute2}/bin/ip link set \"$id\" up";
43+
defaultText = ''
44+
${pkgs.iproute2}/bin/ip link set "$id" up
45+
'';
4446
};
4547

4648
vms = mkOption {

nixos-modules/microvm/options.nix

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ in
148148
};
149149
});
150150
default = [];
151-
example = lib.literalExpression
152-
''
151+
example = lib.literalExpression /* nix */ ''
153152
[ # forward local port 2222 -> 22, to ssh into the VM
154153
{ from = "host"; host.port = 2222; guest.port = 22; }
155154
@@ -159,7 +158,7 @@ in
159158
host.address = "127.0.0.1"; host.port = 80;
160159
}
161160
]
162-
'';
161+
'';
163162
description =
164163
''
165164
When using the SLiRP user networking (default), this option allows to
@@ -319,17 +318,19 @@ in
319318
devices = mkOption {
320319
description = "PCI/USB devices that are passed from the host to the MicroVM";
321320
default = [];
322-
example = literalExpression ''[ {
323-
bus = "pci";
324-
path = "0000:01:00.0";
325-
} {
326-
bus = "pci";
327-
path = "0000:01:01.0";
328-
} {
329-
# QEMU only
330-
bus = "usb";
331-
path = "vendorid=0xabcd,productid=0x0123";
332-
} ]'';
321+
example = literalExpression /* nix */ ''
322+
[ {
323+
bus = "pci";
324+
path = "0000:01:00.0";
325+
} {
326+
bus = "pci";
327+
path = "0000:01:01.0";
328+
} {
329+
# QEMU only
330+
bus = "usb";
331+
path = "vendorid=0xabcd,productid=0x0123";
332+
} ]
333+
'';
333334
type = with types; listOf (submodule {
334335
options = {
335336
bus = mkOption {

0 commit comments

Comments
 (0)