Micros Documentation Options
_module.args Link copied!
lazy attribute set of raw valueAdditional arguments passed to each module in addition to ones
like lib, config,
and pkgs, modulesPath.
This option is also available to all submodules. Submodules do not
inherit args from their parent module, nor do they provide args to
their parent module or sibling submodules. The sole exception to
this is the argument name which is provided by
parent modules to a submodule and contains the attribute name
the submodule is bound to, or a unique generated name if it is
not bound to an attribute.
Some arguments are already passed by default, of which the following cannot be changed with this option:
-
lib: The nixpkgs library. -
config: The results of all options after merging the values from all modules together. -
options: The options declared in all modules. -
specialArgs: ThespecialArgsargument passed toevalModules. -
All attributes of
specialArgsWhereas option values can generally depend on other option values thanks to laziness, this does not apply to
imports, which must be computed statically before anything else.For this reason, callers of the module system can provide
specialArgswhich are available during import resolution.For NixOS,
specialArgsincludesmodulesPath, which allows you to import extra modules from the nixpkgs package tree without having to somehow make the module aware of the location of thenixpkgsor NixOS directories.{ modulesPath, ... }: { imports = [ (modulesPath + "/profiles/minimal.nix") ]; }
For NixOS, the default value for this option includes at least this argument:
pkgs: The nixpkgs package set according to thenixpkgs.pkgsoption.
{ }<nixpkgs/lib/modules.nix>boot.consoleLogLevel Link copied!
signed integerThe kernel console loglevel. All Kernel Messages with a log level smaller
than this setting will be printed to the console.
4<nixpkgs/nixos/modules/system/boot/kernel.nix>boot.devShmSize Link copied!
stringSize limit for the /dev/shm tmpfs. Look at mount(8), tmpfs size option, for the accepted syntax.
"50%""256m"<micros/micros/modules/tasks/filesystems.nix>boot.devSize Link copied!
stringSize limit for the /dev tmpfs. Look at mount(8), tmpfs size option, for the accepted syntax.
"5%""32m"<micros/micros/modules/tasks/filesystems.nix>boot.extraModulePackages Link copied!
list of packageA list of additional packages supplying kernel modules.
[ ][ config.boot.kernelPackages.nvidia_x11 ]<nixpkgs/nixos/modules/system/boot/kernel.nix>boot.init.availableBackends Link copied!
attribute set of (submodule)List of available backends.
{ }<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.executable Link copied!
absolute path or stringExecutable that stage 2 will hand off to as PID 1.
<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.extraFiles Link copied!
attribute set of (submodule)Extra files required by the init system, passed directly to environment.etc and uses the same syntax.
[ ]<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.extraFiles.<name>.enable Link copied!
booleanWhether this /etc file should be generated. This option allows specific /etc files to be disabled.
true<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.extraFiles.<name>.gid Link copied!
signed integerGID of created file. Only takes effect when the file is copied (that is, the mode is not 'symlink').
0<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.extraFiles.<name>.group Link copied!
stringGroup name of file owner.
Only takes effect when the file is copied (that is, the
mode is not symlink).
When services.userborn.enable, this option has no effect.
You have to assign a gid instead. Otherwise this option
takes precedence over gid.
"+0"<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.extraFiles.<name>.mode Link copied!
stringIf set to something else than symlink,
the file is copied instead of symlinked, with the given
file mode.
"symlink""0600"<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.extraFiles.<name>.source Link copied!
absolute pathPath of the source file.
<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.extraFiles.<name>.target Link copied!
stringName of symlink (relative to
/etc). Defaults to the attribute
name.
<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.extraFiles.<name>.text Link copied!
null or strings concatenated with "\n"Text of the file.
null<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.extraFiles.<name>.uid Link copied!
signed integerUID of created file. Only takes effect when the file is copied (that is, the mode is not 'symlink').
0<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.extraFiles.<name>.user Link copied!
stringUser name of file owner.
Only takes effect when the file is copied (that is, the
mode is not symlink).
When services.userborn.enable, this option has no effect.
You have to assign a uid instead. Otherwise this option
takes precedence over uid.
"+0"<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.name Link copied!
stringName of the init backend used after stage-2 activation.
<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.requiredPackages Link copied!
list of packagePackages which are required for the backend to function.
[ ]<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.serviceBuilder Link copied!
functionFunction which takes config.micros.services as an input and outputs files to be appended to environment.etc.
<micros/micros/modules/system/boot/init.nix>boot.init.availableBackends.<name>.supportedFeatures Link copied!
list of value "dependencies" (singular enum)Extra features offered by the init backend, e.g. dependency management
[ ]<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend Link copied!
submoduleInit backend used after stage-2 activation has completed.
{
executable = "/nix/store/gmwg1y3hz8k8377iw8ll2d0xsf99c3fg-runit-2.3.1/bin/runit";
extraFiles = {
"runit/1" = {
enable = true;
gid = 0;
group = "+0";
mode = "symlink";
source = <derivation runit-stage-1>;
target = "runit/1";
text = null;
uid = 0;
user = "+0";
};
"runit/2" = {
enable = true;
gid = 0;
group = "+0";
mode = "symlink";
source = <derivation runit-stage-2>;
target = "runit/2";
text = null;
uid = 0;
user = "+0";
};
"runit/3" = {
enable = true;
gid = 0;
group = "+0";
mode = "symlink";
source = <derivation runit-stage-3>;
target = "runit/3";
text = null;
uid = 0;
user = "+0";
};
"service/boot/run" = {
enable = true;
gid = 0;
group = "+0";
mode = "symlink";
source = <derivation boot-manager-service>;
target = "service/boot/run";
text = null;
uid = 0;
user = "+0";
};
};
name = "runit";
requiredPackages = [
<derivation runit-compat>
<derivation runit-2.3.1>
];
serviceBuilder = <function>;
supportedFeatures = [
"dependencies"
];
}<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.executable Link copied!
absolute path or stringExecutable that stage 2 will hand off to as PID 1.
<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.extraFiles Link copied!
attribute set of (submodule)Extra files required by the init system, passed directly to environment.etc and uses the same syntax.
[ ]<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.extraFiles.<name>.enable Link copied!
booleanWhether this /etc file should be generated. This option allows specific /etc files to be disabled.
true<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.extraFiles.<name>.gid Link copied!
signed integerGID of created file. Only takes effect when the file is copied (that is, the mode is not 'symlink').
0<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.extraFiles.<name>.group Link copied!
stringGroup name of file owner.
Only takes effect when the file is copied (that is, the
mode is not symlink).
When services.userborn.enable, this option has no effect.
You have to assign a gid instead. Otherwise this option
takes precedence over gid.
"+0"<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.extraFiles.<name>.mode Link copied!
stringIf set to something else than symlink,
the file is copied instead of symlinked, with the given
file mode.
"symlink""0600"<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.extraFiles.<name>.source Link copied!
absolute pathPath of the source file.
<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.extraFiles.<name>.target Link copied!
stringName of symlink (relative to
/etc). Defaults to the attribute
name.
<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.extraFiles.<name>.text Link copied!
null or strings concatenated with "\n"Text of the file.
null<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.extraFiles.<name>.uid Link copied!
signed integerUID of created file. Only takes effect when the file is copied (that is, the mode is not 'symlink').
0<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.extraFiles.<name>.user Link copied!
stringUser name of file owner.
Only takes effect when the file is copied (that is, the
mode is not symlink).
When services.userborn.enable, this option has no effect.
You have to assign a uid instead. Otherwise this option
takes precedence over uid.
"+0"<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.name Link copied!
stringName of the init backend used after stage-2 activation.
<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.requiredPackages Link copied!
list of packagePackages which are required for the backend to function.
[ ]<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.serviceBuilder Link copied!
functionFunction which takes config.micros.services as an input and outputs files to be appended to environment.etc.
<micros/micros/modules/system/boot/init.nix>boot.init.currentBackend.supportedFeatures Link copied!
list of value "dependencies" (singular enum)Extra features offered by the init backend, e.g. dependency management
[ ]<micros/micros/modules/system/boot/init.nix>boot.init.executable Link copied!
absolute path or stringExecutable that stage 2 will hand off to as PID 1.
"/nix/store/gmwg1y3hz8k8377iw8ll2d0xsf99c3fg-runit-2.3.1/bin/runit"<micros/micros/modules/system/boot/init.nix>boot.init.stage2Path Link copied!
stringPATH value used by stage 2 before handing off to the init backend.
"/run/booted-system/sw/bin"<micros/micros/modules/system/boot/init.nix>boot.initrd.allowMissingModules Link copied!
booleanWhether the initrd can be built even though modules listed in
boot.initrd.kernelModules or
boot.initrd.availableKernelModules are missing from
the kernel. This is useful when combining configurations that
include a lot of modules, such as
hardware.enableAllHardware, with kernels that don't
provide as many modules as typical NixOS kernels.
Note that enabling this is discouraged. Instead, try disabling
individual modules by setting e.g.
boot.initrd.availableKernelModules.foo = lib.mkForce false;
false<nixpkgs/nixos/modules/system/boot/kernel.nix>boot.initrd.availableKernelModules Link copied!
(attribute set of boolean) or (list of string) convertible to itThe set of kernel modules in the initial ramdisk used during the
boot process. This set must include all modules necessary for
mounting the root device. That is, it should include modules
for the physical device (e.g., SCSI drivers) and for the file
system (e.g., ext3). The set specified here is automatically
closed under the module dependency relation, i.e., all
dependencies of the modules list here are included
automatically. The modules listed here are available in the
initrd, but are only loaded on demand (e.g., the ext3 module is
loaded automatically when an ext3 filesystem is mounted, and
modules for PCI devices are loaded when they match the PCI ID
of a device in your system). To force a module to be loaded,
include it in boot.initrd.kernelModules.
This can either be a list of modules, or an attrset. In an
attrset, names that are set to true represent modules that will
be included. Note that setting these names to false does not
prevent the module from being loaded. For that, use
boot.blacklistedKernelModules.
{ }[
"sata_nv"
"ext3"
]<nixpkgs/nixos/modules/system/boot/kernel.nix>boot.initrd.compressor Link copied!
string or function that evaluates to a(n) stringThe compressor to use on the initrd image. May be any of:
- The name of one of the predefined compressors, see
pkgs/build-support/kernel/initrd-compressor-meta.nixfor the definitions. - A function which, given the nixpkgs package set, returns the path to a compressor tool, e.g.
pkgs: "${pkgs.pigz}/bin/pigz" - (not recommended, because it does not work when cross-compiling) the full path to a compressor tool, e.g.
"${pkgs.pigz}/bin/pigz"
The given program should read data from stdin and write it to stdout compressed.
`zstd` if the kernel supports it (5.9+), `gzip` if not"xz"<micros/micros/modules/system/boot/stage-1.nix>boot.initrd.compressorArgs Link copied!
null or (list of string)Arguments to pass to the compressor for the initrd image, or null to use the compressor's defaults.
null<micros/micros/modules/system/boot/stage-1.nix>boot.initrd.enable Link copied!
booleanWhether to enable initrd.
truetrue<micros/micros/modules/system/boot/stage-1.nix>boot.initrd.includeDefaultModules Link copied!
booleanThis option, if set, adds a collection of default kernel modules
to boot.initrd.availableKernelModules and
boot.initrd.kernelModules.
true<nixpkgs/nixos/modules/system/boot/kernel.nix>boot.initrd.kernelModules Link copied!
(attribute set of boolean) or (list of string) convertible to itSet of modules that are always loaded by the initrd.
This can either be a list of modules, or an attrset. In an
attrset, names that are set to true represent modules that will
be included. Note that setting these names to false does not
prevent the module from being loaded. For that, use
boot.blacklistedKernelModules.
{ }<nixpkgs/nixos/modules/system/boot/kernel.nix>boot.isContainer Link copied!
booleanWhether the image is a container.
false<micros/micros/modules/system/boot/containers.nix>boot.kernel.enable Link copied!
booleanWhether to enable the Linux kernel. This is useful for systemd-like containers which do not require a kernel.
truetrue<nixpkgs/nixos/modules/system/boot/kernel.nix>boot.kernel.randstructSeed Link copied!
stringProvides a custom seed for the RANDSTRUCT security
option of the Linux kernel. Note that RANDSTRUCT is
only enabled in NixOS hardened kernels. Using a custom seed requires
building the kernel and dependent packages locally, since this
customization happens at build time.
"""my secret seed"<nixpkgs/nixos/modules/system/boot/kernel.nix>boot.kernel.sysctl Link copied!
open submodule of attribute set of (sysctl option value)Runtime parameters of the Linux kernel, as set by
sysctl(8). Note that sysctl
parameters names must be enclosed in quotes
(e.g. "vm.swappiness" instead of
vm.swappiness). The value of each
parameter may be a string, integer, boolean, or null
(signifying the option will not appear at all).
{ }{ "net.ipv4.tcp_syncookies" = false; "vm.swappiness" = 60; }
<nixpkgs/nixos/modules/config/sysctl.nix>boot.kernel.sysctl."net.core.rmem_max" Link copied!
null or (unsigned integer, meaning >=0)The maximum receive socket buffer size in bytes. In case of conflicting values, the highest will be used.
null<nixpkgs/nixos/modules/config/sysctl.nix>boot.kernel.sysctl."net.core.wmem_max" Link copied!
null or (unsigned integer, meaning >=0)The maximum send socket buffer size in bytes. In case of conflicting values, the highest will be used.
null<nixpkgs/nixos/modules/config/sysctl.nix>boot.kernelModules Link copied!
(attribute set of boolean) or (list of string) convertible to itThe set of kernel modules to be loaded in the second stage of
the boot process. Note that modules that are needed to
mount the root file system should be added to
boot.initrd.availableKernelModules or
boot.initrd.kernelModules.
This can either be a list of modules, or an attrset. In an
attrset, names that are set to true represent modules that will
be included. Note that setting these names to false does not
prevent the module from being loaded. For that, use
boot.blacklistedKernelModules.
{ }<nixpkgs/nixos/modules/system/boot/kernel.nix>boot.kernelPackages Link copied!
raw valueThis option allows you to override the Linux kernel used by
NixOS. Since things like external kernel module packages are
tied to the kernel you're using, it also overrides those.
This option is a function that takes Nixpkgs as an argument
(as a convenience), and returns an attribute set containing at
the very least an attribute kernel.
Additional attributes may be needed depending on your
configuration. For instance, if you use the NVIDIA X driver,
then it also needs to contain an attribute
nvidia_x11.
Please note that we strictly support kernel versions that are maintained by the Linux developers only. More information on the availability of kernel versions is documented in the Linux section of the manual.
pkgs.linuxPackagespkgs.linuxKernel.packages.linux_5_10<nixpkgs/nixos/modules/system/boot/kernel.nix>boot.kernelParams Link copied!
list of string, with spaces inside double quotesParameters added to the kernel command line.
[ ]<nixpkgs/nixos/modules/system/boot/kernel.nix>boot.kernelPatches Link copied!
list of (attribute set)A list of additional patches to apply to the kernel.
Every item should be an attribute set with the following attributes:
{
name = "foo"; # descriptive name, required
patch = ./foo.patch; # path or derivation that contains the patch source
# (required, but can be null if only config changes
# are needed)
structuredExtraConfig = { # attrset of extra configuration parameters without the CONFIG_ prefix
FOO = lib.kernel.yes; # (optional)
}; # values should generally be lib.kernel.yes,
# lib.kernel.no or lib.kernel.module
features = { # attrset of extra "features" the kernel is considered to have
foo = true; # (may be checked by other NixOS modules, optional)
};
extraConfig = "FOO y"; # extra configuration options in string form without the CONFIG_ prefix
# (optional, multiple lines allowed to specify multiple options)
# (deprecated, use structuredExtraConfig instead)
}
There's a small set of existing kernel patches in Nixpkgs, available as pkgs.kernelPatches,
that follow this format and can be used directly.
[ ][
{
name = "foo";
patch = ./foo.patch;
structuredExtraConfig.FOO = lib.kernel.yes;
features.foo = true;
}
{
name = "foo-ml-mbox";
patch = (fetchurl {
url = "https://lore.kernel.org/lkml/19700205182810.58382-1-email@domain/t.mbox.gz";
hash = "sha256-...";
});
}
]
<nixpkgs/nixos/modules/system/boot/kernel.nix>boot.runSize Link copied!
stringSize limit for the /run tmpfs. Look at mount(8), tmpfs size option, for the accepted syntax.
"25%""256m"<micros/micros/modules/tasks/filesystems.nix>boot.specialFileSystems.<name>.depends Link copied!
list of string (with check: non-empty without trailing slash)List of paths that should be mounted before this one. This filesystem's
device and mountPoint are always
checked and do not need to be included explicitly. If a path is added
to this list, any other filesystem whose mount point is a parent of
the path will be mounted before this filesystem. The paths do not need
to actually be the mountPoint of some other filesystem.
[ ][
"/persist"
]<micros/micros/modules/tasks/filesystems.nix>boot.specialFileSystems.<name>.device Link copied!
null or string (with check: non-empty)Location of the device.
null"/dev/sda"<micros/micros/modules/tasks/filesystems.nix>boot.specialFileSystems.<name>.enable Link copied!
booleanWhether to enable the filesystem mount.
truetrue<micros/micros/modules/tasks/filesystems.nix>boot.specialFileSystems.<name>.fsType Link copied!
string (with check: non-empty)Type of the file system.
"auto""ext3"<micros/micros/modules/tasks/filesystems.nix>boot.specialFileSystems.<name>.mountPoint Link copied!
string (with check: non-empty without trailing slash)Location of the mounted file system.
"/mnt/usb"<micros/micros/modules/tasks/filesystems.nix>boot.specialFileSystems.<name>.neededForBoot Link copied!
booleanWhether to mount filesystem in Stage 1
falsetrue<micros/micros/modules/tasks/filesystems.nix>boot.specialFileSystems.<name>.options Link copied!
non-empty (list of string (with check: non-empty))Options used to mount the file system.
[
"defaults"
][
"data=journal"
]<micros/micros/modules/tasks/filesystems.nix>boot.specialFileSystems.<name>.stratis.poolUuid Link copied!
null or stringUUID of the stratis pool that the fs is located in
null"04c68063-90a5-4235-b9dd-6180098a20d9"<micros/micros/modules/tasks/filesystems.nix>boot.supportedFilesystems Link copied!
(attribute set of boolean) or (list of string) convertible to itNames of supported filesystem types, or an attribute set of file system types
and their state. The set form may be used together with lib.mkForce to
explicitly disable support for specific filesystems, e.g. to disable ZFS
with an unsupported kernel.
{ }{
btrfs = true;
zfs = lib.mkForce false;
}
<micros/micros/modules/tasks/filesystems.nix>boot.vesa Link copied!
boolean(Deprecated) This option, if set, activates the VESA 800x600 video
mode on boot and disables kernel modesetting. It is equivalent to
specifying [ "vga=0x317" "nomodeset" ] in the
boot.kernelParams option. This option is
deprecated as of 2020: Xorg now works better with modesetting, and
you might want a different VESA vga setting, anyway.
false<nixpkgs/nixos/modules/system/boot/kernel.nix>environment.binsh Link copied!
absolute pathThe shell executable that is linked system-wide to /bin/sh.
"${config.system.build.binsh}/bin/sh""${pkgs.dash}/bin/dash"<micros/micros/modules/environment.nix>environment.etc Link copied!
attribute set of (submodule)Set of files that have to be linked in /etc.
{ }{ example-configuration-file =
{ source = "/nix/store/.../etc/dir/file.conf.example";
mode = "0440";
};
"default/useradd".text = "GROUP=100 ...";
}
<nixpkgs/nixos/modules/system/etc/etc.nix>environment.etc.<name>.enable Link copied!
booleanWhether this /etc file should be generated. This option allows specific /etc files to be disabled.
true<nixpkgs/nixos/modules/system/etc/etc.nix>environment.etc.<name>.gid Link copied!
signed integerGID of created file. Only takes effect when the file is copied (that is, the mode is not 'symlink').
0<nixpkgs/nixos/modules/system/etc/etc.nix>environment.etc.<name>.group Link copied!
stringGroup name of file owner.
Only takes effect when the file is copied (that is, the
mode is not symlink).
When services.userborn.enable, this option has no effect.
You have to assign a gid instead. Otherwise this option
takes precedence over gid.
"+0"<nixpkgs/nixos/modules/system/etc/etc.nix>environment.etc.<name>.mode Link copied!
stringIf set to something else than symlink,
the file is copied instead of symlinked, with the given
file mode.
"symlink""0600"<nixpkgs/nixos/modules/system/etc/etc.nix>environment.etc.<name>.source Link copied!
absolute pathPath of the source file.
<nixpkgs/nixos/modules/system/etc/etc.nix>environment.etc.<name>.target Link copied!
stringName of symlink (relative to
/etc). Defaults to the attribute
name.
<nixpkgs/nixos/modules/system/etc/etc.nix>environment.etc.<name>.text Link copied!
null or strings concatenated with "\n"Text of the file.
null<nixpkgs/nixos/modules/system/etc/etc.nix>environment.etc.<name>.uid Link copied!
signed integerUID of created file. Only takes effect when the file is copied (that is, the mode is not 'symlink').
0<nixpkgs/nixos/modules/system/etc/etc.nix>environment.etc.<name>.user Link copied!
stringUser name of file owner.
Only takes effect when the file is copied (that is, the
mode is not symlink).
When services.userborn.enable, this option has no effect.
You have to assign a uid instead. Otherwise this option
takes precedence over uid.
"+0"<nixpkgs/nixos/modules/system/etc/etc.nix>environment.extraInit Link copied!
strings concatenated with "\n"Shell script code called during global environment initialisation after all variables and profileVariables have been set. This code is assumed to be shell-independent, which means you should stick to pure sh without sh word split.
""<micros/micros/modules/environment.nix>environment.extraOutputsToInstall Link copied!
list of stringList of additional package outputs to be symlinked into /run/current-system/sw.
[ ][
"doc"
"info"
"docdev"
]<micros/micros/modules/config/system-path.nix>environment.extraSetup Link copied!
strings concatenated with "\n"Shell fragments to be run after the system environment has been created.
This should only be used for things that need to modify the internals of
the environment, e.g. generating MIME caches. The environment being built
can be accessed at $out.
""<micros/micros/modules/config/system-path.nix>environment.pathsToLink Link copied!
list of stringList of directories to be symlinked in /run/current-system/sw
[ ][
"/"
]<micros/micros/modules/config/system-path.nix>environment.systemPackages Link copied!
list of packageThe set of packages that appear in /run/current-system/sw.
These packages are automatically available to all users, and are automatically
updated every time you rebuild the system configuration. (The latter is the
main difference with installing them in the default profile, /nix/var/nix/profiles/default.
[ ][ pkgs.firefox pkgs.thunderbird ]<micros/micros/modules/config/system-path.nix>fileSystems Link copied!
attribute set of (submodule)The file systems to be mounted. It must include an entry for
the root directory (mountPoint = "/"). Each
entry in the list is an attribute set with the following fields:
mountPoint, device,
fsType (a file system type recognised by
mount; defaults to
"auto"), and options
(the mount options passed to mount using the
-o flag; defaults to [ "defaults" ]).
Instead of specifying device, you can also
specify a volume label (label) for file
systems that support it, such as ext2/ext3 (see mke2fs -L).
{ }{
"/".device = "/dev/hda1";
"/data" = {
device = "/dev/hda2";
fsType = "ext3";
options = [ "data=journal" ];
};
"/bigdisk".label = "bigdisk";
}
<micros/micros/modules/tasks/filesystems.nix>fileSystems.<name>.autoFormat Link copied!
booleanIf the device does not currently contain a filesystem (as
determined by blkid), then automatically
format it with the filesystem type specified in
fsType. Use with caution.
false<micros/micros/modules/tasks/filesystems.nix>fileSystems.<name>.autoResize Link copied!
booleanIf set, the filesystem is grown to its maximum size before being mounted. (This is typically the size of the containing partition.) This is currently only supported for ext2/3/4 filesystems that are mounted during early boot.
false<micros/micros/modules/tasks/filesystems.nix>fileSystems.<name>.depends Link copied!
list of string (with check: non-empty without trailing slash)List of paths that should be mounted before this one. This filesystem's
device and mountPoint are always
checked and do not need to be included explicitly. If a path is added
to this list, any other filesystem whose mount point is a parent of
the path will be mounted before this filesystem. The paths do not need
to actually be the mountPoint of some other filesystem.
[ ][
"/persist"
]<micros/micros/modules/tasks/filesystems.nix>fileSystems.<name>.device Link copied!
null or string (with check: non-empty)Location of the device.
null"/dev/sda"<micros/micros/modules/tasks/filesystems.nix>fileSystems.<name>.enable Link copied!
booleanWhether to enable the filesystem mount.
truetrue<micros/micros/modules/tasks/filesystems.nix>fileSystems.<name>.fsType Link copied!
string (with check: non-empty)Type of the file system.
"auto""ext3"<micros/micros/modules/tasks/filesystems.nix>fileSystems.<name>.label Link copied!
null or string (with check: non-empty)Label of the device (if any).
null"root-partition"<micros/micros/modules/tasks/filesystems.nix>fileSystems.<name>.mountPoint Link copied!
string (with check: non-empty without trailing slash)Location of the mounted file system.
"/mnt/usb"<micros/micros/modules/tasks/filesystems.nix>fileSystems.<name>.neededForBoot Link copied!
booleanWhether to mount filesystem in Stage 1
falsetrue<micros/micros/modules/tasks/filesystems.nix>fileSystems.<name>.noCheck Link copied!
booleanDisable running fsck on this filesystem.
false<micros/micros/modules/tasks/filesystems.nix>fileSystems.<name>.options Link copied!
non-empty (list of string (with check: non-empty))Options used to mount the file system.
[
"defaults"
][
"data=journal"
]<micros/micros/modules/tasks/filesystems.nix>fileSystems.<name>.stratis.poolUuid Link copied!
null or stringUUID of the stratis pool that the fs is located in
null"04c68063-90a5-4235-b9dd-6180098a20d9"<micros/micros/modules/tasks/filesystems.nix>hardware.firmware Link copied!
list of packageFirmware packages
[ ]<micros/micros/modules/hardware/firmware.nix>lib Link copied!
attribute set of (attribute set)This option allows modules to define helper functions, constants, etc.
{ }<nixpkgs/nixos/modules/misc/lib.nix>meta.maintainers Link copied!
list of lib.maintainersList of maintainers of each module. This option should be defined at most once per module.
The option value is not a list of maintainers, but an attribute set that maps module file names to lists of maintainers.
[ ][ lib.maintainers.alice lib.maintainers.bob ]<nixpkgs/modules/generic/meta-maintainers.nix>meta.teams Link copied!
list of lib.teamsList of team maintainers of each module. This option should be defined at most once per module.
[ ][ lib.teams.acme lib.teams.haskell ]<nixpkgs/modules/generic/meta-maintainers.nix>micros.services Link copied!
attribute set of (submodule)Init-backend-agnostic service definitions.
{ }<micros/micros/modules/system/services.nix>micros.services.<name>.confScript Link copied!
null or strings concatenated with "\n"Optional shell fragment available to init backends that support service configuration files.
null<micros/micros/modules/system/services.nix>micros.services.<name>.dependencies Link copied!
list of stringOther services to depend on. If they are not running, start them prior to starting this service.
[ ]<micros/micros/modules/system/services.nix>micros.services.<name>.enable Link copied!
booleanWhether to enable Whether to enable this service. .
truetrue<micros/micros/modules/system/services.nix>micros.services.<name>.finishScript Link copied!
null or strings concatenated with "\n"Optional shell script run by init backends that support service exit hooks.
null<micros/micros/modules/system/services.nix>micros.services.<name>.name Link copied!
stringService name used by the selected init backend.
<micros/micros/modules/system/services.nix>micros.services.<name>.startOnBoot Link copied!
booleanWhether to start automatically after boot
false<micros/micros/modules/system/services.nix>micros.services.<name>.startScript Link copied!
null or strings concatenated with "\n"Shell script used to start the service.
null<micros/micros/modules/system/services.nix>micros.services.<name>.type Link copied!
one of "longrun", "oneshot"Whether this service should be supervised continuously or run once.
"longrun"<micros/micros/modules/system/services.nix>networking.dhcp.enable Link copied!
booleanWhether to enable DHCP globally. This is overrided by individual interface settings. Defaults to true
true<micros/micros/modules/networking/networking.nix>networking.dhcp.overrideNameservers Link copied!
booleanWhether to use DHCP nameservers over configured ones. Defaults to false.
false<micros/micros/modules/networking/networking.nix>networking.firewall.allowPing Link copied!
booleanWhether to respond to incoming ICMPv4 echo requests ("pings"). ICMPv6 pings are always allowed because the larger address space of IPv6 makes network scanning much less effective.
true<micros/micros/modules/networking/firewall.nix>networking.firewall.allowedTCPPortRanges Link copied!
list of attribute set of 16 bit unsigned integer; between 0 and 65535 (both inclusive)Range of open TCP ports.
[ ][
{
from = 32000;
to = 32768;
}
]<micros/micros/modules/networking/firewall.nix>networking.firewall.allowedTCPPorts Link copied!
list of 16 bit unsigned integer; between 0 and 65535 (both inclusive)List of open TCP ports.
[ ][
22
]<micros/micros/modules/networking/firewall.nix>networking.firewall.allowedUDPPortRanges Link copied!
list of attribute set of 16 bit unsigned integer; between 0 and 65535 (both inclusive)Range of open UDP ports.
[ ][
{
from = 32000;
to = 32768;
}
]<micros/micros/modules/networking/firewall.nix>networking.firewall.allowedUDPPorts Link copied!
list of 16 bit unsigned integer; between 0 and 65535 (both inclusive)List of open UDP ports.
[ ][
53
]<micros/micros/modules/networking/firewall.nix>networking.firewall.autoLoadConntrackHelpers Link copied!
booleanWhether to auto-load connection-tracking helpers. See the description at networking.firewall.connectionTrackingModules
(needs kernel 3.5+)
false<micros/micros/modules/networking/firewall.nix>networking.firewall.checkReversePath Link copied!
boolean or one of "strict", "loose"Performs a reverse path filter test on a packet. If a reply to the packet would not be sent via the same interface that the packet arrived on, it is refused.
If using asymmetric routing or other complicated routing, set this option to loose mode or disable it and setup your own counter-measures.
This option can be either true (or "strict"), "loose" (only drop the packet if the source address is not reachable via any interface) or false.
`true` except if the iptables based firewall is in use and the kernel lacks rpfilter support"loose"<micros/micros/modules/networking/firewall.nix>networking.firewall.connectionTrackingModules Link copied!
list of stringList of connection-tracking helpers that are auto-loaded. The complete list of possible values is given in the example.
As helpers can pose as a security risk, it is advised to set this to an empty list and disable the setting networking.firewall.autoLoadConntrackHelpers unless you know what you are doing. Connection tracking is disabled by default.
Loading of helpers is recommended to be done through the CT target. More info: <https://home.regit.org/netfilter-en/secure-use-of-helpers/>
[ ][
"ftp"
"irc"
"sane"
"sip"
"tftp"
"amanda"
"h323"
"netbios_sn"
"pptp"
"snmp"
]<micros/micros/modules/networking/firewall.nix>networking.firewall.enable Link copied!
booleanWhether to enable firewall.
falsetrue<micros/micros/modules/networking/firewall.nix>networking.firewall.extraForwardRules Link copied!
strings concatenated with "\n"Additional nftables rules to be appended to the forward-allow chain.
This option only works with the nftables based firewall.
"""iifname wg0 accept"<micros/micros/modules/networking/firewall.nix>networking.firewall.extraInputRules Link copied!
strings concatenated with "\n"Additional nftables rules to be appended to the input-allow chain.
This option only works with the nftables based firewall.
"""ip6 saddr { fc00::/7, fe80::/10 } tcp dport 24800 accept"<micros/micros/modules/networking/firewall.nix>networking.firewall.extraReversePathFilterRules Link copied!
strings concatenated with "\n"Additional nftables rules to be appended to the rpfilter-allow chain.
This option only works with the nftables based firewall.
"""fib daddr . mark . iif type local accept"<micros/micros/modules/networking/firewall.nix>networking.firewall.filterForward Link copied!
booleanEnable filtering in IP forwarding.
This option only works with the nftables based firewall.
false<micros/micros/modules/networking/firewall.nix>networking.firewall.interfaces Link copied!
attribute set of (submodule)Interface-specific open ports.
{ }<micros/micros/modules/networking/firewall.nix>networking.firewall.interfaces.<name>.allowedTCPPortRanges Link copied!
list of attribute set of 16 bit unsigned integer; between 0 and 65535 (both inclusive)Range of open TCP ports.
[ ][
{
from = 32000;
to = 32768;
}
]<micros/micros/modules/networking/firewall.nix>networking.firewall.interfaces.<name>.allowedTCPPorts Link copied!
list of 16 bit unsigned integer; between 0 and 65535 (both inclusive)List of open TCP ports.
[ ][
22
]<micros/micros/modules/networking/firewall.nix>networking.firewall.interfaces.<name>.allowedUDPPortRanges Link copied!
list of attribute set of 16 bit unsigned integer; between 0 and 65535 (both inclusive)Range of open UDP ports.
[ ][
{
from = 32000;
to = 32768;
}
]<micros/micros/modules/networking/firewall.nix>networking.firewall.interfaces.<name>.allowedUDPPorts Link copied!
list of 16 bit unsigned integer; between 0 and 65535 (both inclusive)List of open UDP ports.
[ ][
53
]<micros/micros/modules/networking/firewall.nix>networking.firewall.logRefusedConnections Link copied!
booleanWhether to log rejected or dropped incoming connections. Note: The logs are found in the kernel logs, i.e. dmesg or journalctl -k.
true<micros/micros/modules/networking/firewall.nix>networking.firewall.logRefusedPackets Link copied!
booleanWhether to log all rejected or dropped incoming packets. This tends to give a lot of log messages, so it's mostly useful for debugging. Note: The logs are found in the kernel logs, i.e. dmesg or journalctl -k.
false<micros/micros/modules/networking/firewall.nix>networking.firewall.logRefusedUnicastsOnly Link copied!
booleanIf networking.firewall.logRefusedPackets
and this option are enabled, then only log packets
specifically directed at this machine, i.e., not broadcasts
or multicasts.
true<micros/micros/modules/networking/firewall.nix>networking.firewall.logReversePathDrops Link copied!
booleanLogs dropped packets failing the reverse path filter test if the option networking.firewall.checkReversePath is enabled.
false<micros/micros/modules/networking/firewall.nix>networking.firewall.pingLimit Link copied!
null or strings concatenated with " "If pings are allowed, this allows setting rate limits on them.
For the iptables based firewall, it should be set like "--limit 1/minute --limit-burst 5".
For the nftables based firewall, it should be set like "2/second" or "1/minute burst 5 packets".
null"--limit 1/minute --limit-burst 5"<micros/micros/modules/networking/firewall.nix>networking.firewall.rejectPackets Link copied!
booleanIf set, refused packets are rejected rather than dropped (ignored). This means that an ICMP "port unreachable" error message is sent back to the client (or a TCP RST packet in case of an existing connection). Rejecting packets makes port scanning somewhat easier.
false<micros/micros/modules/networking/firewall.nix>networking.firewall.trustedInterfaces Link copied!
list of stringTraffic coming in from these interfaces will be accepted unconditionally. Traffic from the loopback (lo) interface will always be accepted.
[ ][
"enp0s2"
]<micros/micros/modules/networking/firewall.nix>networking.hostId Link copied!
null or stringThe 32-bit host ID of the machine, formatted as 8 hexadecimal characters.
You should try to make this ID unique among your machines. You can generate a random 32-bit ID using the following commands:
head -c 8 /etc/machine-id
(this derives it from the machine-id that systemd generates) or
head -c4 /dev/urandom | od -A none -t x4
The primary use case is to ensure when using ZFS that a pool isn't imported accidentally on a wrong machine.
null"4e98920d"<micros/micros/modules/networking/networking.nix>networking.hostName Link copied!
string matching the pattern ^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$The name of the machine. Leave it empty if you want to obtain it from a DHCP server (if using DHCP). The hostname must be a valid DNS label (see RFC 1035 section 2.3.1: "Preferred name syntax", RFC 1123 section 2.1: "Host Names and Numbers") and as such must not contain the domain part. This means that the hostname must start with a letter or digit, end with a letter or digit, and have as interior characters only letters, digits, and hyphen. The maximum length is 63 characters. Additionally it is recommended to only use lower-case characters. If (e.g. for legacy reasons) a FQDN is required as the Linux kernel network node hostname (uname --nodename) the option boot.kernel.sysctl."kernel.hostname" can be used as a workaround (but the 64 character limit still applies).
WARNING: Do not use underscores (_) or you may run into unexpected issues.
"micros"<micros/micros/modules/networking/networking.nix>networking.interfaces Link copied!
list of (submodule)The list of interfaces to configure. By default, all network interfaces detected on startup are brought up with DHCP. Use this to manually configure interfaces and set static IPs.
[ ]<micros/micros/modules/networking/networking.nix>networking.interfaces.*.dhcp Link copied!
null or booleanWhether to use DHCP for the interface. When null (default), DHCP is used if ipv4 has no manually configured addresses.
null<micros/micros/modules/networking/networking.nix>networking.interfaces.*.enable Link copied!
booleanWhether to enable the interface. This determines if the interface will have an entry in the /etc/network/interfaces file.
true<micros/micros/modules/networking/networking.nix>networking.interfaces.*.ipv4.address Link copied!
null or string matching the pattern ^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]).){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])/([1-9]|[1-2][0-9]|3[0-2])$IPV4 address given to the interface, with the subnet mask. Given as "x.x.x.x/xx".
null<micros/micros/modules/networking/networking.nix>networking.interfaces.*.ipv4.gateway Link copied!
null or string matching the pattern ^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]).){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$IPV4 address used as the network gateway. Given as "x.x.x.x".
null<micros/micros/modules/networking/networking.nix>networking.interfaces.*.ipv6.address Link copied!
null or string matching the pattern (([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/([1-9]|[1-9][0-9]|1[01][0-9]|12[0-8])IPV6 address given to the interface, with the subnet mask.
null<micros/micros/modules/networking/networking.nix>networking.interfaces.*.ipv6.gateway Link copied!
null or string matching the pattern (([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))IPV6 address used as the network gateway.
null<micros/micros/modules/networking/networking.nix>networking.interfaces.*.name Link copied!
stringName of the interface. This is used in the /etc/network/interfaces file and needs to be set to a valid network interface, e.g. eth0, ens1p0, wlp2s0, etc.
<micros/micros/modules/networking/networking.nix>networking.interfaces.*.slaac Link copied!
null or booleanWhether to use SLAAC for configuring IPV6 on the interface. When null (default), SLAAC is used if ipv6 has no manually configured addresses.
null<micros/micros/modules/networking/networking.nix>networking.nameservers Link copied!
list of string matching the pattern (([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])The list of nameservers used. This can be overrided by DHCP. Defaults to cloudflare DNS (1.1.1.1, 1.0.0.1).
[
"1.1.1.1"
"1.0.0.1"
]<micros/micros/modules/networking/networking.nix>networking.nftables.checkRuleset Link copied!
booleanRun nft check on the ruleset to spot syntax errors during build.
Because this is executed in a sandbox, the check might fail if it requires
access to any environmental factors or paths outside the Nix store.
To circumvent this, the ruleset file can be edited using the preCheckRuleset
option to work in the sandbox environment.
true<micros/micros/modules/networking/nftables.nix>networking.nftables.checkRulesetRedirects Link copied!
attribute set of absolute pathSet of paths that should be intercepted and rewritten while checking the ruleset
using pkgs.buildPackages.libredirect.
{ }<micros/micros/modules/networking/nftables.nix>networking.nftables.enable Link copied!
booleanWhether to enable nftables and use nftables based firewall if enabled. nftables is a Linux-based packet filtering framework intended to replace frameworks like iptables.
Note that if you have Docker enabled you will not be able to use nftables without intervention. Docker uses iptables internally to setup NAT for containers. This module disables the ip_tables kernel module, however Docker automatically loads the module. Please see <https://github.com/NixOS/nixpkgs/issues/24318#issuecomment-289216273> for more information.
There are other programs that use iptables internally too, such as libvirt. For information on how the two firewalls interact, see <https://wiki.nftables.org/wiki-nftables/index.php/Troubleshooting#Question_4._How_do_nftables_and_iptables_interact_when_used_on_the_same_system.3F>.
false<micros/micros/modules/networking/nftables.nix>networking.nftables.extraDeletions Link copied!
strings concatenated with "\n"Extra deletion commands to be run on every firewall start, reload and after stopping the firewall.
""''
# this makes deleting a non-existing table a no-op instead of an error
table inet some-table;
delete table inet some-table;
''<micros/micros/modules/networking/nftables.nix>networking.nftables.flattenRulesetFile Link copied!
booleanUse builtins.readFile rather than include to handle networking.nftables.rulesetFile. It is useful when you want to apply networking.nftables.preCheckRuleset to networking.nftables.rulesetFile.
Note
It is expected that networking.nftables.rulesetFile can be accessed from the build sandbox.
false<micros/micros/modules/networking/nftables.nix>networking.nftables.flushRuleset Link copied!
booleanWhether to enable flushing the entire ruleset on each reload.
falsetrue<micros/micros/modules/networking/nftables.nix>networking.nftables.preCheckRuleset Link copied!
strings concatenated with "\n"This script gets run before the ruleset is checked. It can be used to create additional files needed for the ruleset check to work, or modify the ruleset for cases the build environment cannot cover.
""sed 's/skgid meadow/skgid nogroup/g' -i ruleset.conf
<micros/micros/modules/networking/nftables.nix>networking.nftables.ruleset Link copied!
strings concatenated with "\n"The ruleset to be used with nftables. Should be in a format that can be loaded using "/bin/nft -f". The ruleset is updated atomically. Note that if the tables should be cleaned first, either:
- networking.nftables.flushRuleset = true; needs to be set (flushes all tables)
- networking.nftables.extraDeletions needs to be set
- or networking.nftables.tables can be used, which will clean up the table automatically
""''
# Check out https://wiki.nftables.org/ for better documentation.
# Table for both IPv4 and IPv6.
table inet filter {
# Block all incoming connections traffic except SSH and "ping".
chain input {
type filter hook input priority 0;
# accept any localhost traffic
iifname lo accept
# accept traffic originated from us
ct state {established, related} accept
# ICMP
# routers may also want: mld-listener-query, nd-router-solicit
ip6 nexthdr icmpv6 icmpv6 type { destination-unreachable, packet-too-big, time-exceeded, parameter-problem, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert } accept
ip protocol icmp icmp type { destination-unreachable, router-advertisement, time-exceeded, parameter-problem } accept
# allow "ping"
ip6 nexthdr icmpv6 icmpv6 type echo-request accept
ip protocol icmp icmp type echo-request accept
# accept SSH connections (required for a server)
tcp dport 22 accept
# count and drop any other traffic
counter drop
}
# Allow all outgoing connections.
chain output {
type filter hook output priority 0;
accept
}
chain forward {
type filter hook forward priority 0;
accept
}
}
''<micros/micros/modules/networking/nftables.nix>networking.nftables.rulesetFile Link copied!
null or absolute pathThe ruleset file to be used with nftables. Should be in a format that can be loaded using "nft -f". The ruleset is updated atomically.
null<micros/micros/modules/networking/nftables.nix>networking.nftables.tables Link copied!
attribute set of (submodule)Tables to be added to ruleset. Tables will be added together with delete statements to clean up the table before every update.
{ }{
filter = {
content = ''
# Check out https://wiki.nftables.org/ for better documentation.
# Table for both IPv4 and IPv6.
# Block all incoming connections traffic except SSH and "ping".
chain input {
type filter hook input priority 0;
# accept any localhost traffic
iifname lo accept
# accept traffic originated from us
ct state {established, related} accept
# ICMP
# routers may also want: mld-listener-query, nd-router-solicit
ip6 nexthdr icmpv6 icmpv6 type { destination-unreachable, packet-too-big, time-exceeded, parameter-problem, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert } accept
ip protocol icmp icmp type { destination-unreachable, router-advertisement, time-exceeded, parameter-problem } accept
# allow "ping"
ip6 nexthdr icmpv6 icmpv6 type echo-request accept
ip protocol icmp icmp type echo-request accept
# accept SSH connections (required for a server)
tcp dport 22 accept
# count and drop any other traffic
counter drop
}
# Allow all outgoing connections.
chain output {
type filter hook output priority 0;
accept
}
chain forward {
type filter hook forward priority 0;
accept
}
'';
family = "inet";
};
}<micros/micros/modules/networking/nftables.nix>networking.nftables.tables.<name>.content Link copied!
strings concatenated with "\n"The table content.
<micros/micros/modules/networking/nftables.nix>networking.nftables.tables.<name>.enable Link copied!
booleanEnable this table.
true<micros/micros/modules/networking/nftables.nix>networking.nftables.tables.<name>.family Link copied!
one of "ip", "ip6", "inet", "arp", "bridge", "netdev"Table family.
<micros/micros/modules/networking/nftables.nix>networking.nftables.tables.<name>.name Link copied!
stringTable name.
<micros/micros/modules/networking/nftables.nix>networking.timeServers Link copied!
list of stringThe set of NTP servers from which to synchronise.
[
"0.nixos.pool.ntp.org"
"1.nixos.pool.ntp.org"
"2.nixos.pool.ntp.org"
"3.nixos.pool.ntp.org"
]<micros/micros/modules/networking/networking.nix>nix.enable Link copied!
booleanWhether to enable Nix.
Disabling Nix makes the system hard to modify and the Nix programs and configuration will not be made available by NixOS itself.
false<micros/micros/modules/nix.nix>nix.nixPath Link copied!
list of stringThe default Nix expression search path, used by the Nix
evaluator to look up paths enclosed in angle brackets
(e.g. <nixpkgs>).
[ ]<micros/micros/modules/nix.nix>nix.package Link copied!
packageThis option specifies the Nix package instance to use throughout the system.
pkgs.nix<micros/micros/modules/nix.nix>nix.registry Link copied!
attribute set of (submodule)A system-wide flake registry.
{ }<micros/micros/modules/nix.nix>nix.registry.<name>.exact Link copied!
booleanWhether the from reference needs to match exactly. If set,
a from reference like nixpkgs does not
match with a reference like nixpkgs/nixos-20.03.
true<micros/micros/modules/nix.nix>nix.registry.<name>.flake Link copied!
null or (attribute set)The flake input from is rewritten to.
nullnixpkgs<micros/micros/modules/nix.nix>nix.registry.<name>.from Link copied!
attribute set of (string or signed integer or boolean or absolute path or package)The flake reference to be rewritten.
{ }{
id = "nixpkgs";
type = "indirect";
}<micros/micros/modules/nix.nix>nix.registry.<name>.to Link copied!
attribute set of (string or signed integer or boolean or absolute path or package)The flake reference from is rewritten to.
{ }{
owner = "my-org";
repo = "my-nixpkgs";
type = "github";
}<micros/micros/modules/nix.nix>nixpkgs.buildPlatform Link copied!
string or (attribute set)Specifies the platform on which NixOS should be built. By default, NixOS is built on the system where it runs, but you can change where it's built. Setting this option will cause NixOS to be cross-compiled.
For instance, if you're doing distributed multi-platform deployment, or if you're building machines, you can set this to match your development system and/or build farm.
Ignored when nixpkgs.pkgs is set.
config.nixpkgs.hostPlatform{
system = "x86_64-linux";
}<nixpkgs/nixos/modules/misc/nixpkgs.nix>nixpkgs.config Link copied!
nixpkgs configGlobal configuration for Nixpkgs. The complete list of Nixpkgs configuration options is in the Nixpkgs manual section on global configuration.
Ignored when nixpkgs.pkgs is set.
{ }{ allowBroken = true; allowUnfree = true; }
<nixpkgs/nixos/modules/misc/nixpkgs.nix>nixpkgs.crossSystem Link copied!
null or (attribute set)Systems with a recently generated hardware-configuration.nix
may instead specify only nixpkgs.buildPlatform,
or fall back to removing the nixpkgs.hostPlatform line from the generated config.
Specifies the platform for which NixOS should be
built. Specify this only if it is different from
nixpkgs.localSystem, the platform
on which NixOS should be built. In other
words, specify this to cross-compile NixOS. Otherwise it
should be set as null, the default. See its description in the
Nixpkgs manual for more details.
Ignored when nixpkgs.pkgs or hostPlatform is set.
null{
system = "aarch64-linux";
}<nixpkgs/nixos/modules/misc/nixpkgs.nix>nixpkgs.flake.setFlakeRegistry Link copied!
booleanWhether to pin nixpkgs in the system-wide flake registry (/etc/nix/registry.json) to the
store path of the sources of nixpkgs used to build the NixOS system.
This is on by default for NixOS configurations built with flakes.
This option makes nix run nixpkgs#hello reuse dependencies from the system, avoid
refetching nixpkgs, and have a consistent result every time.
Note that this option makes the NixOS closure depend on the nixpkgs sources, which may add undesired closure size if the system will not have any nix commands run on it.
"config.nixpkgs.flake.source != null"<micros/micros/modules/nixpkgs-flake.nix>nixpkgs.flake.setNixPath Link copied!
booleanWhether to set NIX_PATH to include nixpkgs=flake:nixpkgs such that <nixpkgs>
lookups receive the version of nixpkgs that the system was built with, in concert with
nixpkgs.flake.setFlakeRegistry.
This is on by default for NixOS configurations built with flakes.
This makes nix-build '<nixpkgs>' -A hello work out of the box on flake systems.
Note that this option makes the NixOS closure depend on the nixpkgs sources, which may add undesired closure size if the system will not have any nix commands run on it.
"config.nixpkgs.flake.source != null"<micros/micros/modules/nixpkgs-flake.nix>nixpkgs.flake.source Link copied!
null or string or absolute pathThe path to the nixpkgs sources used to build the system. This is automatically set up to be
the store path of the nixpkgs flake used to build the system if using
nixpkgs.lib.nixosSystem, and is otherwise null by default.
This can also be optionally set if the NixOS system is not built with a flake but still uses
pinned sources: set this to the store path for the nixpkgs sources used to build the system,
as may be obtained by builtins.fetchTarball, for example.
Note: the name of the store path must be "source" due to <https://github.com/NixOS/nix/issues/7075>.
"if (using nixpkgsFlake.lib.nixosSystem) then self.outPath else null""builtins.fetchTarball { name = \"source\"; sha256 = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\"; url = \"https://github.com/nixos/nixpkgs/archive/somecommit.tar.gz\"; }"<micros/micros/modules/nixpkgs-flake.nix>nixpkgs.hostPlatform Link copied!
string or (attribute set)Specifies the platform where the NixOS configuration will run.
To cross-compile, set also nixpkgs.buildPlatform.
Ignored when nixpkgs.pkgs is set.
{
system = "aarch64-linux";
}<nixpkgs/nixos/modules/misc/nixpkgs.nix>nixpkgs.localSystem Link copied!
attribute setSystems with a recently generated hardware-configuration.nix
do not need to specify this option, unless cross-compiling, in which case
you should set only nixpkgs.buildPlatform.
If this is somehow not feasible, you may fall back to removing the
nixpkgs.hostPlatform line from the generated config and
use the old options.
Specifies the platform on which NixOS should be built. When
nixpkgs.crossSystem is unset, it also specifies
the platform for which NixOS should be
built. If this option is unset, it defaults to the platform
type of the machine where evaluation happens. Specifying this
option is useful when doing distributed multi-platform
deployment, or when building virtual machines. See its
description in the Nixpkgs manual for more details.
Ignored when nixpkgs.pkgs or hostPlatform is set.
config.nixpkgs.system{
system = "aarch64-linux";
}<nixpkgs/nixos/modules/misc/nixpkgs.nix>nixpkgs.overlays Link copied!
list of (nixpkgs overlay)List of overlays to apply to Nixpkgs.
This option allows modifying the Nixpkgs package set accessed through the pkgs module argument.
For details, see the Overlays chapter in the Nixpkgs manual.
If the nixpkgs.pkgs option is set, overlays specified using nixpkgs.overlays will be applied after the overlays that were already included in nixpkgs.pkgs.
[ ][
(self: super: {
openssh = super.openssh.override {
hpnSupport = true;
kerberos = self.libkrb5;
};
})
]
<nixpkgs/nixos/modules/misc/nixpkgs.nix>nixpkgs.pkgs Link copied!
An evaluation of Nixpkgs; the top level attribute set of packagesIf set, the pkgs argument to all NixOS modules is the value of
this option, extended with nixpkgs.overlays, if
that is also set. Either nixpkgs.crossSystem or
nixpkgs.localSystem will be used in an assertion
to check that the NixOS and Nixpkgs architectures match. Any
other options in nixpkgs.*, notably config,
will be ignored.
If unset, the pkgs argument to all NixOS modules is determined as shown in the default value for this option.
The default value imports the Nixpkgs source files
relative to the location of this NixOS module, because
NixOS and Nixpkgs are distributed together for consistency,
so the nixos in the default value is in fact a
relative path. The config, overlays,
localSystem, and crossSystem come
from this option's siblings.
This option can be used by applications like NixOps to increase
the performance of evaluation, or to create packages that depend
on a container that should be built with the exact same evaluation
of Nixpkgs, for example. Applications like this should set
their default value using lib.mkDefault, so
user-provided configuration can override it without using
lib.
Note that using a distinct version of Nixpkgs with NixOS may be an unexpected source of problems. Use this option with care.
import "${nixos}/.." {
inherit (config.nixpkgs) config overlays localSystem crossSystem;
}
import <nixpkgs> {}<nixpkgs/nixos/modules/misc/nixpkgs.nix>nixpkgs.system Link copied!
stringThis option does not need to be specified for NixOS configurations
with a recently generated hardware-configuration.nix.
Specifies the Nix platform type on which NixOS should be built.
It is better to specify nixpkgs.localSystem instead.
{
nixpkgs.system = ..;
}
is the same as
{
nixpkgs.localSystem.system = ..;
}
See nixpkgs.localSystem for more information.
Ignored when nixpkgs.pkgs, nixpkgs.localSystem or nixpkgs.hostPlatform is set.
Traditionally `builtins.currentSystem`, but unset when invoking NixOS through `lib.nixosSystem`.
"i686-linux"<nixpkgs/nixos/modules/misc/nixpkgs.nix>runit.package Link copied!
packagePackage to use as the runit executable
<derivation runit-2.3.1>runit.stage-1.script Link copied!
strings concatenated with "\n"Runit's initial start script
''
#!/nix/store/gw6fqdf6sd50az8lgwis0bzg5nk283db-busybox-1.37.0/bin/ash
PATH=/run/booted-system/sw/bin
# Link /bin/sh from environment.binsh, defaults to ash from buxybox.
mkdir /bin
ln -s /nix/store/gw6fqdf6sd50az8lgwis0bzg5nk283db-busybox-1.37.0/bin/ash /bin/sh
# disable DPMS on tty's
echo -ne "\033[9;0]" > /dev/tty0
touch /etc/runit/stopit
chmod 0 /etc/runit/stopit
''runit.stage-2.script Link copied!
strings concatenated with "\n"Runit's main service runner script
''
#!/nix/store/gw6fqdf6sd50az8lgwis0bzg5nk283db-busybox-1.37.0/bin/ash
cat /proc/uptime
# Watch the /etc/service directory for files
# used to configure a monitored service.
mkdir -p /etc/service
PATH=/run/wrappers/bin:/run/booted-system/sw/bin
exec env - PATH=$PATH /nix/store/gmwg1y3hz8k8377iw8ll2d0xsf99c3fg-runit-2.3.1/bin/runsvdir -P /etc/service
''runit.stage-3.script Link copied!
strings concatenated with "\n"Runit shutdown script
''
#!/nix/store/gw6fqdf6sd50az8lgwis0bzg5nk283db-busybox-1.37.0/bin/ash
echo Waiting for services to stop...
/nix/store/gmwg1y3hz8k8377iw8ll2d0xsf99c3fg-runit-2.3.1/bin/sv force-stop /etc/service/*
/nix/store/gmwg1y3hz8k8377iw8ll2d0xsf99c3fg-runit-2.3.1/bin/sv exit /etc/service/*
echo Sending TERM signal to processes...
/nix/store/gw6fqdf6sd50az8lgwis0bzg5nk283db-busybox-1.37.0/bin/pkill -TERM -v -s 0,1
sleep 1
echo Sending KILL signal to processes...
/nix/store/gw6fqdf6sd50az8lgwis0bzg5nk283db-busybox-1.37.0/bin/pkill -KILL -v -s 0,1
echo Unmounting filesystems, disabling swap...
swapoff -a
umount -r -a -t nosysfs,noproc,nodevtmpfs,notmpfs
echo Remounting rootfs read-only...
mount -o remount,ro /
sync
''security.pam.enable Link copied!
booleanWhether to enable PAM.
falsetrue<micros/micros/modules/security/pam.nix>security.wrappers Link copied!
attribute set of (submodule)This option effectively allows adding setuid/setgid bits, capabilities,
changing file ownership and permissions of a program without directly
modifying it. This works by creating a wrapper program in a directory
(not configurable), which is then added to the shell PATH.
{ }{
# a setuid root program
doas =
{ setuid = true;
owner = "root";
group = "root";
source = "${pkgs.doas}/bin/doas";
};
# a setgid program
locate =
{ setgid = true;
owner = "root";
group = "mlocate";
source = "${pkgs.locate}/bin/locate";
};
# a program with the CAP_NET_RAW capability
ping =
{ owner = "root";
group = "root";
capabilities = "cap_net_raw+ep";
source = "${pkgs.iputils.out}/bin/ping";
};
}
<micros/micros/modules/security/wrappers.nix>security.wrappers.<name>.capabilities Link copied!
strings concatenated with ","A comma-separated list of capability clauses to be given to the wrapper program. The format for capability clauses is described in the “TEXTUAL REPRESENTATION” section of the cap_from_text(3) manual page. For a list of capabilities supported by the system, check the capabilities(7) manual page.
Note
cap_setpcap, which is required for the wrapper
program to be able to raise caps into the Ambient set is NOT raised
to the Ambient set so that the real program cannot modify its own
capabilities!! This may be too restrictive for cases in which the
real program needs cap_setpcap but it at least leans on the side
security paranoid vs. too relaxed.
""<micros/micros/modules/security/wrappers.nix>security.wrappers.<name>.enable Link copied!
booleanWhether to enable the wrapper.
true<micros/micros/modules/security/wrappers.nix>security.wrappers.<name>.group Link copied!
stringThe group of the wrapper program.
<micros/micros/modules/security/wrappers.nix>security.wrappers.<name>.owner Link copied!
stringThe owner of the wrapper program.
<micros/micros/modules/security/wrappers.nix>security.wrappers.<name>.permissions Link copied!
file mode stringThe permissions of the wrapper program. The format is that of a
symbolic or numeric file mode understood by chmod.
"u+rx,g+x,o+x""a+rx"<micros/micros/modules/security/wrappers.nix>security.wrappers.<name>.program Link copied!
null or stringThe name of the wrapper program. Defaults to the attribute name.
"‹name›"<micros/micros/modules/security/wrappers.nix>security.wrappers.<name>.setgid Link copied!
booleanWhether to add the setgid bit the wrapper program.
false<micros/micros/modules/security/wrappers.nix>security.wrappers.<name>.setuid Link copied!
booleanWhether to add the setuid bit the wrapper program.
false<micros/micros/modules/security/wrappers.nix>security.wrappers.<name>.source Link copied!
absolute pathThe absolute path to the program to be wrapped.
<micros/micros/modules/security/wrappers.nix>services.chronyd.enable Link copied!
booleanWhether to enable Enable chronyd time server.
truetrue<micros/micros/modules/services/chronyd.nix>services.chronyd.package Link copied!
packageThe chrony package to use.
pkgs.chrony<micros/micros/modules/services/chronyd.nix>services.getty.enable Link copied!
booleanWhether to enable getty.
falsetrue<micros/micros/modules/services/getty.nix>services.getty.terminal Link copied!
stringTerminal to start getty in
"/dev/ttyS0"<micros/micros/modules/services/getty.nix>services.mdevd.enable Link copied!
booleanWhether to enable Enable mdevd device manager.
truetrue<micros/micros/modules/services/mdevd.nix>services.nix-daemon.enable Link copied!
booleanWhether to enable nix-daemon.
falsetrue<micros/micros/modules/services/nix-daemon.nix>services.nix-daemon.package Link copied!
packageThe nix package to use.
pkgs.nix<micros/micros/modules/services/nix-daemon.nix>services.rngd.enable Link copied!
booleanWhether to enable rngd.
falsetrue<micros/micros/modules/services/rngd.nix>services.rngd.package Link copied!
packageThe rng-tools package to use.
pkgs.rng-tools<micros/micros/modules/services/rngd.nix>services.sshd.authorizedKeysFiles Link copied!
list of stringSpecify the rules for which files to read on the host.
These are paths relative to the host root file system or home
directories and they are subject to certain token expansion rules.
See AuthorizedKeysFile in man sshd_config for details.
[
"%h/.ssh/authorized_keys"
"/etc/ssh/authorized_keys.d/%u"
]<micros/micros/modules/services/sshd.nix>services.sshd.enable Link copied!
booleanWhether to enable sshd.
falsetrue<micros/micros/modules/services/sshd.nix>services.sshd.hostKeys Link copied!
list of (attribute set)MicrOS can automatically generate SSH host keys. This option specifies the path, type and size of each key. See ssh-keygen(1) for supported types and sizes.
[
{
bits = 4096;
path = "/etc/ssh/ssh_host_rsa_key";
type = "rsa";
}
{
path = "/etc/ssh/ssh_host_ed25519_key";
type = "ed25519";
}
]<micros/micros/modules/services/sshd.nix>services.sshd.package Link copied!
packageThe openssh package to use.
pkgs.openssh<micros/micros/modules/services/sshd.nix>system.activationScripts Link copied!
attribute set of (string or (submodule))A set of shell script fragments that are executed when a NixOS
system configuration is activated. Examples are updating
/etc, creating accounts, and so on. Since these are executed
every time you boot the system or run
nixos-rebuild, it's important that they are
idempotent and fast.
{ }{
stdio = {
# Run after /dev has been mounted
deps = [ "specialfs" ];
text =
''
# Needed by some programs.
ln -sfn /proc/self/fd /dev/fd
ln -sfn /proc/self/fd/0 /dev/stdin
ln -sfn /proc/self/fd/1 /dev/stdout
ln -sfn /proc/self/fd/2 /dev/stderr
'';
};
}
system.build Link copied!
open submodule of lazy attribute set of unspecified valueAttribute set of derivations used to set up the system.
{ }<nixpkgs/nixos/modules/system/build.nix>system.etc.overlay.enable Link copied!
booleanMount /etc as an overlayfs instead of generating it via a perl script.
Note: This is currently experimental. Only enable this option if you're confident that you can recover your system if it breaks.
false<nixpkgs/nixos/modules/system/etc/etc.nix>system.etc.overlay.mutable Link copied!
booleanWhether to mount /etc mutably (i.e. read-write) or immutably (i.e. read-only).
If this is false, only the immutable lowerdir is mounted. If it is true, a writable upperdir is mounted on top.
true<nixpkgs/nixos/modules/system/etc/etc.nix>system.logging.enable Link copied!
booleanWhether to enable Enable syslog daemon.
truetrue<micros/micros/modules/system/syslog.nix>system.logging.syslogConfig Link copied!
strings concatenated with "\n"Contents of /etc/syslog.conf file
''
# /etc/syslog.conf - Configuration file for syslogd(8)
#
# For information about the format of this file, see syslog.conf(5)
#
#
# First some standard log files. Log by facility.
#
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/var/log/syslog
#cron.* /var/log/cron.log
#daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
#lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
#user.* -/var/log/user.log
#
# Logging for the mail system. Split it up so that
# it is easy to write scripts to parse these files.
#
#mail.info -/var/log/mail.info
#mail.warn -/var/log/mail.warn
mail.err /var/log/mail.err
#mail.*;mail.!=info -/var/log/mail
#mail,news.=info -/var/log/info
# The tcp wrapper loggs with mail.info, we display all
# the connections on tty12
#
#mail.=info /dev/tty12
#
# Some "catch-all" log files.
#
#*.=debug;\
# auth,authpriv.none;\
# news.none;mail.none -/var/log/debug
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
cron,daemon.none;\
mail,news.none -/var/log/messages
#
# Store all critical events, except kernel logs, in critical RFC5424 format.
# Override global log rotation settings, rotate every 10MiB, keep 5 old logs,
#
#*.=crit;kern.none /var/log/critical ;rotate=10M:5,RFC5424
# Example of sending events to remote syslog server.
# All events from notice and above, except auth, authpriv
# and any kernel message are sent to server finlandia in
# RFC5424 formatted output.
#
#*.notice;auth,authpriv.none;\
# kern.none @finlandia ;RFC5424
# Emergencies are sent to anyone logged in
#
*.=emerg *
# Priority alert and above are sent to the operator
#
#*.alert root,joey
#
# Secure mode, same as -s, none(0), on(1), full(2). When enabled
# only logging to remote syslog server possible, with full secure
# mode, not even that is possible. We default to prevent syslogd
# from opening UDP/514 and receiving messages from other systems.
#
secure_mode 1
#
# Global log rotation, same as -r SIZE:COUNT, command line wins.
#
#rotate_size 1M
#rotate_count 5
#
# Include all config files in /etc/syslog.d/
#
include /etc/syslog.d/*.conf
''<micros/micros/modules/system/syslog.nix>system.logging.syslogFlags Link copied!
stringFlags passed to syslog executable.
"-F -p /dev/log"<micros/micros/modules/system/syslog.nix>system.logging.syslogPackage Link copied!
string or packageSyslog daemon to use for system logging. Defaults to busybox's syslog implementation. If the option is set to a derivation, lib.getExe is used to get the executable file. If the option is set to a string, it is executed directly.
"/nix/store/9vhk64sqmmjqj3sxkxykpbc7zz0cn4rq-sysklogd-2.7.2/bin/syslogd"<micros/micros/modules/system/syslog.nix>system.name Link copied!
stringThe name of the system used in the system.build.toplevel derivation.
That derivation has the following name:
"nixos-system-${config.system.name}-${config.system.nixos.label}"
if config.networking.hostName == ""
then "unnamed"
else config.networking.hostName;
<micros/micros/modules/system/name.nix>systemd.services Link copied!
unspecified value<micros/micros/modules/systemd-compat.nix>systemd.tmpfiles Link copied!
unspecified value<micros/micros/modules/systemd-compat.nix>systemd.user Link copied!
unspecified value<micros/micros/modules/systemd-compat.nix>users Link copied!
attribute set of (submodule)Attrset of users.
{ }<micros/micros/modules/config/users.nix>users.<name>.gid Link copied!
null or signed integerAccount group ID
null<micros/micros/modules/config/users.nix>users.<name>.home Link copied!
absolute pathAccount home directory
"/home/‹name›"<micros/micros/modules/config/users.nix>users.<name>.name Link copied!
stringAccount Username
""<micros/micros/modules/config/users.nix>users.<name>.packages Link copied!
list of packageUser-wide package list
[ ]<micros/micros/modules/config/users.nix>users.<name>.password Link copied!
stringHashed account password
"!"<micros/micros/modules/config/users.nix>users.<name>.shell Link copied!
null or package or absolute pathAccount login shell
"/run/booted-system/sw/bin/ash"<micros/micros/modules/config/users.nix>users.<name>.uid Link copied!
null or signed integerAccount User ID
null<micros/micros/modules/config/users.nix>virtualisation.cores Link copied!
positive integer, meaning >0Specify the number of cores the guest is permitted to use. The number can be higher than the available cores on the host system.
1<micros/micros/modules/virtualisation/qemu.nix>virtualisation.forwardPorts Link copied!
list of (submodule)When using the SLiRP user networking (default), this option allows to forward ports to/from the host/guest.
Warning
If the NixOS firewall on the virtual machine is enabled, you also have to open the guest ports to enable the traffic between host and guest.
Note
Currently QEMU supports only IPv4 forwarding.
[ ][
# forward local port 2222 -> 22, to ssh into the VM
{ from = "host"; host.port = 2222; guest.port = 22; }
# forward local port 80 -> 10.0.2.10:80 in the VLAN
{ from = "guest";
guest.address = "10.0.2.10"; guest.port = 80;
host.address = "127.0.0.1"; host.port = 80;
}
]
<micros/micros/modules/virtualisation/qemu.nix>virtualisation.forwardPorts.*.from Link copied!
one of "host", "guest"Controls the direction in which the ports are mapped:
"host"means traffic from the host ports is forwarded to the given guest port."guest"means traffic from the guest ports is forwarded to the given host port.
"host"<micros/micros/modules/virtualisation/qemu.nix>virtualisation.forwardPorts.*.guest.address Link copied!
stringThe IPv4 address on the guest VLAN.
""<micros/micros/modules/virtualisation/qemu.nix>virtualisation.forwardPorts.*.guest.port Link copied!
16 bit unsigned integer; between 0 and 65535 (both inclusive)The guest port to be mapped.
<micros/micros/modules/virtualisation/qemu.nix>virtualisation.forwardPorts.*.host.address Link copied!
stringThe IPv4 address of the host.
""<micros/micros/modules/virtualisation/qemu.nix>virtualisation.forwardPorts.*.host.port Link copied!
16 bit unsigned integer; between 0 and 65535 (both inclusive)The host port to be mapped.
<micros/micros/modules/virtualisation/qemu.nix>virtualisation.forwardPorts.*.proto Link copied!
one of "tcp", "udp"The protocol to forward.
"tcp"<micros/micros/modules/virtualisation/qemu.nix>virtualisation.memorySize Link copied!
positive integer, meaning >0The memory size in megabytes of the virtual machine.
1024<micros/micros/modules/virtualisation/qemu.nix>virtualisation.networkingOptions Link copied!
list of stringNetworking-related command-line options that should be passed to qemu. The default is to use userspace networking (SLiRP). See the QEMU Wiki on Networking for details.
If you override this option, be advised to keep
${QEMU_NET_OPTS:+,$QEMU_NET_OPTS} (as seen in the example)
to keep the default runtime behaviour.
[ ][
"-net nic,netdev=user.0,model=virtio"
"-netdev user,id=user.0,\${QEMU_NET_OPTS:+,$QEMU_NET_OPTS}"
]<micros/micros/modules/virtualisation/qemu.nix>