Commit graph

2177 commits

Author SHA1 Message Date
Menken Philipp bb36ed77b8 nixos/virtualbox: Enable virtualbox guest additions module on aarch64 2025-08-11 22:14:21 +02:00
Maximilian Bosch 0dd4477d19
Merge: Fix: Correct podman systemd service name (#425170) 2025-08-11 18:39:10 +02:00
André Lima 28d3245201
nixos/libvirtd: allow changing firewall backend 2025-08-10 21:06:54 +01:00
Yethal 68710f4064 virtualisation/oci-containers: fix podman systemd service name 2025-08-04 10:01:24 +02:00
nicoo 19c9496c3e nixos/oci-containers: clean-up dependsOn example
This is more compact, and removes a syntax error.
2025-08-01 10:28:53 +02:00
nicoo 79b1189b5d nixos/oci-containers: remove overuse of literalExpression
This forced examples to be typeset with extraneous linebreaks,
as well as failed to detect syntax errors in examples.
2025-08-01 10:27:41 +02:00
Philip Taron 71d8c89d62
qemu-vm: create erofs with hard-dereference flag (#395494) 2025-07-24 05:32:39 -07:00
Wolfgang Walther 5a0711127c
treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Paul Meyer bd184be272 qemu-vm: create erofs with hard-dereference flag
This will ensure reproducibility between different nixos systems, where
one system has store optimization enabled (which will hardling similar
files in the nix store) and the other doesn't. Without the flag, the
same image, built on the two different systems, will have a different
number of inodes. The flag will dereference hardlinks and copy them
into the image as different inodes.

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2025-07-24 07:46:37 +02:00
phaer b033e0c4b6
virtualisation/disk-image: fix image.extension 2025-07-18 11:12:09 -07:00
Rafael Fernández López 117bbae49c
nvidia-container-toolkit: reintroduce nvidia runtime wrappers
This allows users to keep using `docker run --gpus`. Despite CDI is
the recommended way to expose GPU's to containers nowadays, allow
users to keep using the old `--gpus` method.
2025-07-16 22:38:11 +02:00
nixpkgs-ci[bot] 8d8db2ff25
Merge master into staging-next 2025-07-12 00:17:12 +00:00
Philip Taron 8279ffe622
treewide: specify that mebibytes are used when it's ambiguous (#424169) 2025-07-11 12:29:33 -07:00
Axel Karjalainen 7159ab6f43 treewide: specify where mebibytes are used when it's ambiguous 2025-07-11 00:44:23 +03:00
K900 b960b040a2 Merge remote-tracking branch 'origin/master' into staging-next 2025-07-08 15:12:10 +03:00
Sandro 30c1ef051b
nixos/ec2-data: fix eval 2025-07-08 11:57:40 +02:00
K900 e2c8c4260d Merge remote-tracking branch 'origin/master' into staging-next 2025-07-07 10:09:49 +03:00
jade f43a088157
nixos-containers: Added flake option (#413463) 2025-07-06 19:24:39 -07:00
Gwendolyn Kornak b5b04bb146 nixos/nixos-containers: add flake to container start script
Integrated the flake container setup into the spawn script for systemd-nspawn.
The trickiest part of this was ensuring the underlying per-container is built.
With the .conf file created, running `nixos-container update` creates all the necessary per-container structure.
We call this command at start to ensure the structure is created only if the per-container system isnt there.
Note: This also means the flake gets updated to branch HEAD when the container is started for the first time.
2025-07-05 17:22:15 -07:00
Gwendolyn Kornak 9a3173dacd nixos/nixos-containers: add flake option
While the nixos-container command allows for the creation of containers pointing to a flake, the declarative module doesn't have this option.
Adds the flake option for nixos-container declarative approach. Creates the /etc/nixos-container .conf file similar to how the command preforms it.
2025-07-05 17:21:37 -07:00
Martin Weinelt c21be3563e
nixos/ec2-data: use hostname-debian to set hostname from metadata
This is the simpler, more lightweight and better maintained version of
the hostname utility.
2025-07-04 06:53:11 +02:00
nixpkgs-ci[bot] 4725dc1d5d
Merge staging-next into staging 2025-07-03 18:06:42 +00:00
Sandro Jäckel f88e1c39e9
treewide: move StartLimitIntervalSec/StartLimitBurst to unitConfig 2025-07-03 15:48:28 +02:00
nixpkgs-ci[bot] e17ff436c8
Merge staging-next into staging 2025-07-01 18:06:27 +00:00
nixpkgs-ci[bot] 367477b054
Merge staging-next into staging 2025-06-24 18:06:44 +00:00
Fernando Rodrigues 4a0180f434
nixos/xen: dehardcode the .pad section from the UKI builder
Upstream, intentionally or not, no longer appends the EFI image
with a .pad section for us to hook the rest of the UKI to. This
simply dehardcodes .pad from the awk script, instead using the
very last section in the binary. (Currently .reloc)

Co-authored-by: Yaroslav Bolyukin <iam@lach.pw>
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
2025-06-24 11:11:39 -03:00
wxt ee0937ff0d nixos/waydroid: allow override waydroid 2025-06-24 20:54:30 +08:00
zimbatm 39c01d22bf net-tools: rename from nettools
By being in sync with the pname, it makes it easier to walk back from
the pname that shows in the /nix/store back to the attribute.

This change should not cause any rebuild.
2025-06-21 19:57:36 +02:00
Adam C. Stephens 9d9e0f911c
nixos/incus: fix AppArmor issue (#415057) 2025-06-13 13:46:57 -04:00
John Titor c87464cb0c
Revert "treewide: migrate nixos modules to networking.hosts"
This reverts commit cd64f1bd87.
2025-06-09 00:10:05 +05:30
MakiseKurisu dd5faa98ae
nixos/incus: update AppArmor profile for new versions 2025-06-09 00:32:43 +08:00
John Titor cd64f1bd87 treewide: migrate nixos modules to networking.hosts
Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>
2025-06-07 23:09:46 +05:30
Peder Bergebakken Sundt c77ac9dfc3 treewide: fix typos 2025-06-02 16:07:07 +02:00
Someone 57390c8b91
virtualisation/docker: fix nvidia container wrapper (#407290) 2025-05-27 09:34:51 +00:00
John Titor ad331efcaf nixos/qemu-vm: useBootPartition -> useBIOSBoot
useBootPartition was ambiguous, this makes the option more like useEFIBoot

Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>
2025-05-26 14:06:42 +05:30
sanana c156a809e3 nixosTests.limine.bios: init
This patch adds a NixOS test for Limine on BIOS systems. It also fixes
some formatting in `nixos/lib/make-disk-image.nix`.

Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>
2025-05-26 14:06:42 +05:30
sanana 95355b4d94 nixos/qemu-vm: add option for a separate boot partition on BIOS
This patch adds the option `virtualisation.useBootPartition` which
creates a separate boot partition on BIOS systems using the new
`legacy+boot` partition layout type in `nixos/lib/make-disk-image.nix`.
2025-05-26 14:06:42 +05:30
Ramses 4c9b7995bf
nixos/vmware-host: avoid IFD (#404954) 2025-05-17 23:14:42 +02:00
Rafael Fernández López 7e42e4431b virtualisation/docker: fix nvidia container wrapper 2025-05-15 10:27:23 +02:00
Arne Keller 4d4f8628cd
nixos/libvirtd: Use preferred version of iptables (#228625) 2025-05-10 22:23:51 +02:00
Zhaofeng Li 13bb852869 nixos/libvirtd: Use preferred version of iptables 2025-05-10 12:49:47 -06:00
js6pak 6fdd4c90e5
nixos/vmware-host: avoid IFD 2025-05-07 17:34:35 +02:00
codgician 16a7d7e982
waagent: support AutoUpdate.UpdateToLatestVersion in module 2025-05-07 17:07:53 +08:00
r-vdp eec01220a4
nixos/qemu-guest-agent: fix udevadm verify issues 2025-05-05 12:08:59 +02:00
Maximilian Bosch b539370717
Merge: nixos/oci-containers: stricter dependencies for rootless containers with sdnotify=healthy (#394039) 2025-05-02 19:46:44 +02:00
Maximilian Bosch 344ee0cf07
nixos/oci-containers: stricter dependencies for rootless containers with sdnotify=healthy
After running this configuration for a while, we
noticed that the containers didn't get back up once and the services
failed with the following error:

    Error: current system boot ID differs from cached boot ID; an unhandled reboot has occurred.

This is hard to reproduce and seems to be a timing issue. However,
the logs indicated another issue that this patch now solves:

* The ExecStartPost= indicated that the user session got stopped before
  which is required or sdnotify=healthy. Add explicit ordering for
  user@. This unfortunately requires a statically declared uid.
2025-04-30 14:23:25 +02:00
illustris 5803bdb9fc
Revert "Use mkImageMediaOverride for filesystem attributes of various images" 2025-04-29 08:41:26 +05:30
Maximilian Bosch 9cd14670ad
nixos/oci-containers: escape login.username
When using e.g. GitLab as container registry, the token name may be the
username. However, the token name can contain special characters
including spaces breaking the registry login like this:

    Apr 25 15:35:48 test42 pre-start[294091]: image doesn't exist locally and login failed
    Apr 25 15:35:52 test42 pre-start[294289]: Error: accepts at most 1 arg(s), received 2
    Apr 25 15:35:52 test42 pre-start[294297]: Error: registry.example.com/foo/bar/baz: image not known

Applying `escapeShellArg` on it fixes the problem.
2025-04-25 15:39:00 +02:00
jopejoe1 e6d927fcfd
cloudstack: add to image/images (#398556) 2025-04-24 19:03:53 +02:00
jopejoe1 326702f8bb
Use mkImageMediaOverride for filesystem attributes of various images (#397330) 2025-04-24 18:54:06 +02:00
lassulus b8d7097244
nixos/containers: fix shell error when privateUsers=no (#396174) 2025-04-18 17:53:51 -07:00
Aleksana af39bcec09
gce-images: drop (#396780) 2025-04-17 09:49:14 +08:00
phaer d7e76ed0a2 cloudstack: add to image/images
This was an oversight in https://github.com/NixOS/nixpkgs/pull/347275,
so it's currently missing from the variants listed in nixos-rebuild build-image
2025-04-14 14:03:58 +02:00
phaer 887f7d33e0 virtualisation/openstack: use mkImageMediaOverride...
...for filesystem options. Before this change,
users would typically encounter conflicting option definitions
when trying to build an image for a generic nixos closure, i.e.
`nixos-rebuild build-image --image-variant openstack-zfs --flake .#my-host`
2025-04-11 14:33:45 +02:00
phaer 6f83796aa5 virtualisation/google-compute-config: use mkImageMediaOverride...
...for filesystem and bootloader options. Before this change,
users would typically encounter conflicting option definitions
when trying to build an image for a generic nixos closure, i.e.
`nixos-rebuild build-image --image-variant google-compute-config --flake .#my-host`
2025-04-11 12:54:12 +02:00
phaer bf2b3f0286 virtualisation/digital-ocean-config: use mkImageMediaOverride...
...for filesystem options. Before this change,
users would typically encounter conflicting option definitions
when trying to build an image for a generic nixos closure, i.e.
`nixos-rebuild build-image --image-variant digital-ocean --flake .#my-host`
2025-04-11 12:54:12 +02:00
phaer a79571b081 virtualisation/azure-image: use mkImageMediaOverride...
...for filesystem options. Before this change,
users would typically encounter conflicting option definitions
when trying to build an image for a generic nixos closure, i.e.
`nixos-rebuild build-image --image-variant azure --flake .#my-host`
2025-04-11 12:54:12 +02:00
phaer 2f7435b5ca virtualisation/hyperv-image: use mkImageMediaOverride...
...for filesystem options. Before this change,
users would typically encounter conflicting option definitions
when trying to build an image for a generic nixos closure, i.e.
`nixos-rebuild build-image --image-variant hyperv --flake .#my-host`
2025-04-11 12:54:12 +02:00
phaer 61ba044658 virtualisation/oci-common: use mkImageMediaOverride...
...for filesystem options. Before this change,
users would typically encounter conflicting option definitions
when trying to build an image for a generic nixos closure, i.e.
`nixos-rebuild build-image --image-variant common --flake .#my-host`
2025-04-11 12:54:12 +02:00
phaer 2742c7163a virtualisation/kubevirt: use mkImageMediaOverride...
...for filesystem  options. Before this change,
users would typically encounter conflicting option definitions
when trying to build an image for a generic nixos closure, i.e.
`nixos-rebuild build-image --image-variant kubevirt --flake .#my-host`
2025-04-11 12:54:12 +02:00
phaer 4327e179f7 virtualisation/virtualbox-image: use mkImageMediaOverride...
...for filesystem and options. Before this change,
users would typically encounter conflicting option definitions
when trying to build an image for a generic nixos closure, i.e.
`nixos-rebuild build-image --image-variant virtualbox --flake .#my-host`
2025-04-11 12:54:12 +02:00
phaer 864030e5e8 virtualisation/vmware-image: use mkImageMediaOverride...
...for filesystem options. Before this change, users would typically encounter conflicting option definitions when trying to build an image for a generic nixos closure, i.e. `nixos-rebuild build-image --image-variant vmware --flake .#my-host`
2025-04-11 12:54:11 +02:00
phaer c5d383a797 virtualisation/disk-image: use mkImageMediaOverride...
...for filesystem options. Before this change, users would typically encounter conflicting option definitions when trying to build an image for a generic nixos closure, i.e. `nixos-rebuild build-image --image-variant qemu --flake .#my-host`
2025-04-11 12:54:11 +02:00
phaer 3718f356c0 virtualisation/promxox-image: use mkImageMediaOverride...
...for filesystem options. Before this change,
users would typically encounter conflicting option definitions
when trying to build an image for a generic nixos closure, i.e.
`nixos-rebuild build-image --image-variant proxmox --flake .#my-host`
2025-04-11 12:54:11 +02:00
phaer ae02740156 virtualisation/proxmox-image: remove obsolete proxmox.qemuConf.diskSize usage
This was an oversight in my commit
d37a3ea1ef, and results in the following
eval warning when proxmox images are used: `Obsolete option
`proxmox.qemuConf.diskSize' is used. It was renamed to
`virtualisation.diskSize'.`
2025-04-11 12:54:11 +02:00
phaer 9e704d7263 virtualisation/linode-config: use mkImageMediaOverride...
...for filesystem options. Before this change, users would typically encounter conflicting option definitions when trying to build an image for a generic nixos closure, i.e. `nixos-rebuild build-image --image-variant linode --flake .#my-host`
2025-04-11 12:54:11 +02:00
phaer a80eca86d5 virtualisation/linode-config: drop "with; lib" 2025-04-11 12:35:41 +02:00
Franz Pletz 70f67d28f7
nixos/virtualisation: add contents setting to googleComputeImage (#393749) 2025-04-09 13:55:55 +02:00
Adam Chance 38f2ca6b80 nixos/virtualisation: add contents setting to googleComputeImage
Allow placing files and directories in the image
2025-04-08 11:33:50 +01:00
phaer 8bdc44ec9a gce-images: drop
It's hopefully out-dated, "latest" release points to 20.09 and no
in-tree usage could be found. Feel free to update and re-introduce if
needed.
2025-04-07 11:22:52 +02:00
Louis Opter 9d3a171dbf nixos/containers: fix shell error when privateUsers=no
Details in #387773.
2025-04-05 00:36:42 +00:00
Adam C. Stephens 21197daa39
incus: build and expose documentation 2025-04-03 16:00:08 +00:00
Silvan Mosberger 374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
Adam C. Stephens 62d611a22b
nixos/incus: add AppArmor rules (#386060) 2025-04-01 12:51:34 -04:00
Adam C. Stephens 9ff6900615
incus: 6.10.1 -> 6.11.0
https://discuss.linuxcontainers.org/t/incus-6-11-has-been-released/23322
https://github.com/lxc/incus/releases/tag/v6.11.0
2025-03-28 16:58:33 -04:00
MakiseKurisu 9b7d65ad87
nixos/incus: add AppArmor rules to allow access to Nix store
Fix #350012
2025-03-26 21:01:14 +08:00
Arian van Putten 12c098f0ca nixos/amazon-ec2-amis: remove 2025-03-22 12:25:18 +00:00
Robert Hensing 202ac0e3d2
nixos: Cut off virtualisation.vmVariant.virtualisation.vmVariant (#390717) 2025-03-21 15:58:59 +00:00
Robert Hensing 9aab8b86c7 nixos: Cut off virtualisation.vmVariant.virtualisation.vmVariant
This produced an unnecessarily infinitely deep config tree.

The "cut off" option can be written to, but not read from.
Being written to is important, because it allows users to
conveniently define vmVariant config without having to check
isVmVariant.

There's a small chance that someone *reads* from vmVariant config
in their normal config, and for them it will not be possible
to evaluate with `nixos-rebuild build-vm` anymore.

If this is a problem, we could perhaps make the vmVariant root
appear instead of the `throw` error.
This could also be done using mkOption apply.
2025-03-20 22:30:12 +00:00
evplus c3f61d1cbd nixos/incus ensure br_netfilter module is enabled 2025-03-19 22:56:07 +01:00
Sandro 86f44b004d
nixos/nixos-containers: user options take precedence over module ones (#388409) 2025-03-19 18:59:56 +01:00
WilliButz 41c7225648
podman: use serviceConfig.ExecStart instead of script (#390731) 2025-03-19 12:06:33 +01:00
Benedikt Ritter ef2bde5a13
docker: use serviceConfig.ExecStart instead of script 2025-03-19 11:12:59 +01:00
Benedikt Ritter ccdfb91b48
podman: use serviceConfig.ExecStart instead of script 2025-03-19 11:08:18 +01:00
Todd Brown b5c9cecbcc
nixos/docker: add auto prune randomizedDelaySec and persistent options (#301547)
docker: add auto prune randomizedDelaySec and persistent options

Options mirror nix garbage collection
2025-03-16 10:56:31 +01:00
Bruce Toll ae4750868c nixos/ec2-data fix host fingerprint output to console (regression)
PR #322282 introduced a regression that causes the previous display of
the ssh host key fingerprints to get directed to the journal rather than
the console (as intended). Thus, the console only logs an empty set of
fingerprints:

    -----BEGIN SSH HOST KEY FINGERPRINTS-----
    -----END SSH HOST KEY FINGERPRINTS-----

The fix is to reorder the bash statement that invokes ssh-keygen so
that the ssh-keygen output is directed to /dev/console.
2025-03-15 13:16:03 -04:00
Marie Ramlow 342c4f300b nixos/{renovate, libvirtd}: fix typo 2025-03-15 00:30:21 +05:30
Emma Miler 542a053b32 nixos/oci-containers: add autoRemoveOnStop option
Adds the autoRemoveOnStop option to allow stopped or killed containers to stay around after stop. Default behaviour remains the same.
2025-03-10 19:35:47 +01:00
Kevin Boulain c2d4e8f4cb nixos/nixos-containers: user options take precedence over module ones
I think this is the norm in NixOS modules. This allows to start a
container with '--volatile=overlay --link-journal=host' in order to
persist logs across runs of a container running with a temporary root.
While '--ephemeral' omits '--link-journal=try-guest', it's not possible
to run an ephemeral container when linking the journal:
https://github.com/systemd/systemd/issues/1666
2025-03-09 11:08:56 +01:00
Maximilian Bosch 7d443d378b
nixos/oci-containers: support rootless containers & healthchecks
Closes #259770
Closes #207050

The motivation for the former is to not execute the container as root,
so you don't have to `sudo -i` to perform podman management tasks.

The idea behind healthchecks is to be able to keep the unit in the
activating state until the container is healthy, only then then unit is
marked as active.

The following changes were necessary:

* Move the ctr-id into `/run/${containerName}` to make podman can
  actually write to it since it's now in its RuntimeDirectory.

* Make `sdnotify` option configurable (`healthy` for healthchecks that
  must pass, default remains `conmon`).

* Set Delegate=yes for `sdnotify=healthy` to make sure a rootless
  container can actually talk to sd_notify[1].

* Add a warning that lingering must be enabled to have a `systemd --user`
  instance running which is required for the cgroup support to work
  properly.

* Added a testcase for rootless containers with both conmon and
  healthchecks.

[1] https://github.com/containers/podman/discussions/20573#discussioncomment-7612481
2025-02-27 11:08:33 +01:00
Sandro c2fbe453e6
nixos/libvirtd: fix path in hooks.network desc (#372951) 2025-02-19 21:32:22 +01:00
Ramses 51e84098b5
nixos-container: avoid subshell when testing $PRIVATE_USERS (#383056) 2025-02-19 10:46:48 +01:00
Jean-Baptiste Giraudeau 57c96ff6ef
nixos-container: avoid subshell when testing $PRIVATE_USERS
So that the script is not rejected by https://www.shellcheck.net/wiki/SC2235
 under `systemd.enableStrictShellChecks = true;`
2025-02-18 09:41:55 +01:00
Sandro 86f9eeb816
nixos-container: add support for --private-users (#362210) 2025-02-18 00:09:56 +01:00
Adam C. Stephens 8780973144
incus.ui: 0.7 -> incus-0.14.6, rename to incus-ui-canonical (#382440) 2025-02-16 17:43:56 -05:00
Adam C. Stephens ad53a8451f
incus-ui-canonical: rename from incus.ui 2025-02-16 17:33:03 -05:00
Christian Kögler bbd8de2fdd
nixos-container: do not touch os-release if it is a symlink (#353366) 2025-02-16 07:43:34 +01:00
Jean-Baptiste Giraudeau c8f83ec641
nixos-container: add support for --private-users
imply bind mounts with idmap option when user namespacing is enabled,
 so that /nix/store and friends are correctly own by root user.
2025-02-12 14:28:57 +01:00
Robert Hensing 0b47fba230 Revert "nixos/nixpkgs: make config.nixpkgs.{localSystem,crossSystem,buildPlatform,hostPlatform} write only"
This reverts commit 0a19371146.
2025-02-05 14:29:18 +01:00
Florian Klink 4742e5b16e
nixos/azure: move image-specific configs from azure-common to azure-image, fix console output (#359365) 2025-02-02 22:57:49 +02:00