Commit Graph
930166 Commits
Author SHA1 Message Date
Jeremy FleischmanandKierán Meinhardt 4bd5482aa6 nixos/nspawn-container: init a new nspawn-container profile
This shares a lot in common with the
<nixos/modules/virtualisation/nixos-containers.nix> infrastructure, but
is designed to behave like our `qemu-vm.nix` profile (provides a lot of
the same `virtualisation.*` options, produces a simple script you can
run).

This lays the groundwork to be able to rework the nixos test
infrastructure to allow for containers as well as qemu nodes. That work
isn't quite done yet, but if you want more context, you can see the
followup work in <https://github.com/applicative-systems/nixpkgs/compare/nspawn-container-profile...applicative-systems:nixpkgs:nixos-test-containers>.

Credit due to the [Clan.lol](https://clan.lol/) team for first
implementing this. I'm just cleaning it up and making it play nicely
with upstream.

To try it out, create a `demo.nix`:

```nix
let
  pkgs = import ./. { };
  mkContainer =
    {
      nodeNumber,
      vlans,
    }:
    pkgs.nixos (
      {
        config,
        modulesPath,
        pkgs,
        lib,
        ...
      }:
      let
        interfaces = lib.attrValues config.virtualisation.allInterfaces;

        # Automatically assign IP addresses to requested interfaces.
        assignIPs = lib.filter (i: i.assignIP) interfaces;
        ipInterfaces = lib.forEach assignIPs (
          i:
          lib.nameValuePair i.name {
            ipv4.addresses = [
              {
                address = "192.168.${toString i.vlan}.${toString nodeNumber}";
                prefixLength = 24;
              }
            ];
          }
        );
      in
      {
        imports = [ "${modulesPath}/virtualisation/nspawn-container" ];
        users.users.root.password = "";

        networking.hostName = "c${toString nodeNumber}";
        virtualisation.vlans = vlans;
        networking.interfaces = lib.listToAttrs ipInterfaces;

        environment.systemPackages = [ pkgs.neovim ];
        system.stateVersion = lib.trivial.release;
      }
    );
in
{
  container1 = mkContainer {
    nodeNumber = 1;
    vlans = [ 1 ];
  };
  container2 = mkContainer {
    nodeNumber = 2;
    vlans = [ 2 ];
  };
  container12 = mkContainer {
    nodeNumber = 12;
    vlans = [
      1
      2
    ];
  };
}
```

Build and run the machines in separate terminals (unfortunately,
`systemd-nspawn` requires `sudo`):

```console
$ sudo $(nix-build ./demo.nix -A container1.config.system.build.nspawn)/bin/run-c1-nspawn
$ sudo $(nix-build ./demo.nix -A container2.config.system.build.nspawn)/bin/run-c2-nspawn
$ sudo $(nix-build ./demo.nix -A container12.config.system.build.nspawn)/bin/run-c12-nspawn
```

You can log into this machines as `root`, and verify they can ping each
other:

`c1` can ping `c12`:

```
[root@c1:~]# ping 192.168.1.12 -c 1
PING 192.168.1.12 (192.168.1.12) 56(84) bytes of data.
64 bytes from 192.168.1.12: icmp_seq=1 ttl=64 time=0.164 ms
...
```

So can `c2`:

```
[root@c2:~]# ping 192.168.2.12
PING 192.168.2.12 (192.168.2.12) 56(84) bytes of data.
64 bytes from 192.168.2.12: icmp_seq=1 ttl=64 time=0.127 ms
```
2026-01-19 10:36:37 +01:00
nixpkgs-ci[bot]andGitHub 9a9938e5fe pkgsite: 0-unstable-2026-01-07 -> 0-unstable-2026-01-16 (#481146) 2026-01-19 08:41:49 +00:00
FélixandGitHub 7eeed29d5c pleroma: 2.9.1 -> 2.10.0 (#479989) 2026-01-19 08:38:33 +00:00
nixpkgs-ci[bot]andGitHub 0ef1c5b62b re-isearch: 2.20220925.4.0a-unstable-2025-12-30 -> 2.20220925.4.0a-unstable-2026-01-14 (#481502) 2026-01-19 08:21:19 +00:00
nixpkgs-ci[bot]andGitHub a30890129f prl-tools: 26.2.0-57363 -> 26.2.1-57371 (#481565) 2026-01-19 08:21:17 +00:00
nixpkgs-ci[bot]andGitHub 63bff05de2 whisper-cpp: 1.8.2 -> 1.8.3 (#481446) 2026-01-19 08:05:33 +00:00
Ulrik StridandGitHub b203a44b4d ocamlPackages.happy-eyeballs-miou-unix: init at 2.0.1 (#480490) 2026-01-19 08:04:55 +00:00
Jan TojnarandGitHub ce2f6a0566 libwpe-fdo: 1.16.0 -> 1.16.1 (#462744) 2026-01-19 08:03:39 +00:00
Ulrik StridandGitHub 543a95a9bf ocamlPackages.mlx: 0.10 → 0.11 (#479914) 2026-01-19 08:03:11 +00:00
R. Ryantm b94694e8e5 prl-tools: 26.2.0-57363 -> 26.2.1-57371 2026-01-19 07:26:28 +00:00
nixpkgs-ci[bot]andGitHub f638e6365d memcached-exporter: 0.15.4 -> 0.15.5 (#480987) 2026-01-19 07:19:00 +00:00
nixpkgs-ci[bot]andGitHub dae96a269f dopamine: 3.0.1 -> 3.0.2 (#481358) 2026-01-19 07:01:29 +00:00
Marcus RambergandGitHub 0c6a368699 cloudflare-warp{,-headless}: fix updateScript shell script (#481417) 2026-01-19 07:00:09 +00:00
Fabian AffolterandGitHub f5dfaffa8e python313Packages.iamdata: 0.1.202601171 -> 0.1.202601181 (#481277) 2026-01-19 06:46:00 +00:00
Paul MeyerandGitHub 48ab6e2ede vscode-extensions.sourcegraph.amp: 0.0.1768263519 -> 0.0.1768796962 (#481534) 2026-01-19 06:33:01 +00:00
Vladimír ČunátandGitHub 87ae6865c0 thunderbird-140-unwrapped: 140.6.0esr -> 140.7.0esr (#481528) 2026-01-19 06:28:13 +00:00
Fabian Affolter b80dbdeb19 python313Packages.iamdata: 0.1.202601181 -> 0.1.202601191
Diff: https://github.com/cloud-copilot/iam-data-python/compare/v0.1.202601181...v0.1.202601191

Changelog: https://github.com/cloud-copilot/iam-data-python/releases/tag/v0.1.202601191
2026-01-19 07:26:37 +01:00
Fabian Affolter f819465138 python313Packages.iamdata: 0.1.202601171 -> 0.1.202601181
Diff: https://github.com/cloud-copilot/iam-data-python/compare/v0.1.202601171...v0.1.202601181

Changelog: https://github.com/cloud-copilot/iam-data-python/releases/tag/v0.1.202601181
2026-01-19 07:26:29 +01:00
nixpkgs-ci[bot]andGitHub 27b5557239 reqable: 3.0.33 -> 3.0.34 (#481527) 2026-01-19 05:56:30 +00:00
nixpkgs-ci[bot]andGitHub 8850aaecf5 gitlogue: 0.6.0 -> 0.7.0 (#481535) 2026-01-19 05:41:06 +00:00
nixpkgs-ci[bot]andGitHub 5e31aa9259 probe-rs-tools: 0.30.0 -> 0.31.0 (#481202) 2026-01-19 05:21:51 +00:00
R. Ryantm 29c12fa043 gitlogue: 0.6.0 -> 0.7.0 2026-01-19 05:09:21 +00:00
R. Ryantm a7b9dc20cb vscode-extensions.sourcegraph.amp: 0.0.1768263519 -> 0.0.1768796962 2026-01-19 05:07:17 +00:00
nixpkgs-ci[bot]andGitHub 0311983f85 amp-cli: 0.0.1768219292-g8af118 -> 0.0.1768760544-gf06f5a (#481397) 2026-01-19 04:41:29 +00:00
Austin HorstmanandGitHub a46f7740d8 grimblast: 0.1-unstable-2025-12-18 -> 0.1-unstable-2026-01-14 (#481524) 2026-01-19 04:41:13 +00:00
R. Ryantm 20c968ca4b thunderbird-140-unwrapped: 140.6.0esr -> 140.7.0esr 2026-01-19 04:30:52 +00:00
R. Ryantm 799970f5f3 reqable: 3.0.33 -> 3.0.34 2026-01-19 04:27:20 +00:00
nixpkgs-ci[bot]andGitHub c2a93d11e6 equicord: 2025-12-25 -> 2026-01-19 (#475691) 2026-01-19 04:15:36 +00:00
R. Ryantm 2a2bf4dc7f grimblast: 0.1-unstable-2025-12-18 -> 0.1-unstable-2026-01-14 2026-01-19 04:13:23 +00:00
R. Ryantm e26cb66c2b equicord: 2025-12-25 -> 2026-01-19 2026-01-19 02:45:31 +00:00
Fabian AffolterandGitHub 7037463125 python3Packages.types-regex: 2025.11.3.20251106 -> 2026.1.15.20260116 (#481469) 2026-01-19 02:31:36 +00:00
dishandGitHub 9157b505d8 aliases: add speed_dreams (#481501) 2026-01-19 02:27:06 +00:00
Mio f8efb53897 aliases: add speed_dreams 2026-01-19 13:20:33 +11:00
R. Ryantm 9f51394145 re-isearch: 2.20220925.4.0a-unstable-2025-12-30 -> 2.20220925.4.0a-unstable-2026-01-14 2026-01-19 02:15:11 +00:00
Fabian AffolterandGitHub 3f6f41c766 python313Packages.types-regex: migrate to finalAttrs
- add doCheck
2026-01-19 02:58:04 +01:00
EmilyandGitHub ae2975e0e5 chromium: fix unsubstituted placeholders in .desktop (#481440) 2026-01-19 01:32:29 +00:00
Doron BeharandGitHub b47158fe03 selfci: init at 0-unstable-2026-01-17 (#481172) 2026-01-19 01:07:16 +00:00
Wael NasreddineandGitHub 1b69597612 ssh-agent-mux: init at v0.2.0 (#481456) 2026-01-19 00:58:20 +00:00
Yohann BonifaceandGitHub 1555e54f51 argo-workflows: tweak repo name (#480265) 2026-01-19 00:54:05 +00:00
Yohann BonifaceandGitHub 4f1b9e0429 treewide: drop myself as maintainer from packages I don't maintain anymore (#481320) 2026-01-19 00:41:43 +00:00
Peder Bergebakken SundtandGitHub bde0902288 curv: 0.5-unstable-2025-01-20 -> 0.5-unstable-2026-01-17; enable jit; bump to eigen_5 (#477571) 2026-01-19 00:39:23 +00:00
Cosima NeidahlandGitHub 7b9b0b74d6 rcu: 4.0.32 -> 4.0.33 (#481284) 2026-01-19 00:32:17 +00:00
Philip TaronandGitHub c084c00fa1 maintainers: add figsoda (#481434) 2026-01-19 00:25:11 +00:00
Thiago Kenji OkadaandGitHub 4e9f383aa8 libretro.beetle-pce-fast: 0-unstable-2025-11-14 -> 0-unstable-2026-01-16 (#481099) 2026-01-19 00:21:26 +00:00
Herwig Hochleitner f338554235 curv: use eigen_5 2026-01-19 01:18:08 +01:00
Herwig Hochleitner 7a3da12e6c curv: add gcc wrapper for -Ojit 2026-01-19 01:18:08 +01:00
Herwig Hochleitner 9da49e68e1 curv: 0.5-unstable-2025-01-20 -> 0.5-unstable-2026-01-17 2026-01-19 01:18:08 +01:00
kirillrdyandGitHub 42c8ee3b52 halide: 19.0.0 -> 21.0.0 (#481268) 2026-01-18 23:44:12 +00:00
Doron BeharandGitHub d21c3deb3a lua.pkgs.cqueues: fix cross compilation (#480192) 2026-01-18 23:40:41 +00:00
Martin WeineltandGitHub cb1d39a0ef treewide: replace django_5_2 with django_5 (#481441) 2026-01-18 23:36:51 +00:00