Author SHA1 Message Date
Autumn Liu 096908ac39 frcc experiments
diff-pr / dix (pull_request) Successful in 6m43s
flake-check / flake-check (pull_request) Successful in 4m42s
lint / lint (pull_request) Failing after 1m47s
2026-09-10 18:31:09 -05:00
4 changed files with 54 additions and 6 deletions
-1
View File
@@ -26,7 +26,6 @@ jobs:
if: always() if: always()
env: env:
REVIEWDOG_GITEA_API_TOKEN: ${{ secrets.GITEA_TOKEN }} REVIEWDOG_GITEA_API_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITEA_ADDRESS: ${{ github.server_url }}
run: | run: |
if [ "${{ github.event_name }}" = pull_request ]; then if [ "${{ github.event_name }}" = pull_request ]; then
nix run -L .#ci -- lint-report gitea-pr-review "$RUNNER_TEMP/findings" nix run -L .#ci -- lint-report gitea-pr-review "$RUNNER_TEMP/findings"
+4 -3
View File
@@ -163,9 +163,10 @@ in
trusted-public-keys = [ "microvm.cachix.org-1:oXnBc6hRE3eX5rSYdRyMYXnfzcCxC7yKPTbZXALsqys=" ]; trusted-public-keys = [ "microvm.cachix.org-1:oXnBc6hRE3eX5rSYdRyMYXnfzcCxC7yKPTbZXALsqys=" ];
}; };
nix.settings = { nix.gc = {
min-free = 5 * 1024 * 1024 * 1024; automatic = true;
max-free = 10 * 1024 * 1024 * 1024; dates = "daily";
options = "--delete-older-than 14d";
}; };
# nix.optimise.automatic = true; - doesn't work with microvm.writableStoreOverlay # nix.optimise.automatic = true; - doesn't work with microvm.writableStoreOverlay
+31 -1
View File
@@ -61,16 +61,27 @@ let
net ? { }, net ? { },
resources ? { }, resources ? { },
traits ? [ ], traits ? [ ],
isolation ? { },
}: }:
mkContainer { mkContainer {
inherit name; inherit name;
inherit net resources; inherit net resources;
svc.autoStart = true; svc.autoStart = true;
isolation.nixDaemon = nixDaemon; isolation = { nixDaemon = nixDaemon; } // isolation;
traits = [ sshTrait ] ++ traits; traits = [ sshTrait ] ++ traits;
packages = with pkgs; [ tmux ] ++ packages; packages = with pkgs; [ tmux ] ++ packages;
miscProperties = self._sshpiperRegister routingInfo; miscProperties = self._sshpiperRegister routingInfo;
}; };
kvmTrait = {
containerConfig =
{ pkgs, ... }:
{
users.users.runner.extraGroups = [ "wheel" ];
security.sudo.wheelNeedsPassword = false;
environment.systemPackages = [ pkgs.qemu_kvm ];
};
};
in in
{ {
ssh-admin = mkSsh { ssh-admin = mkSsh {
@@ -121,6 +132,25 @@ in
mem = "16G"; mem = "16G";
cpu = 65; cpu = 65;
}; };
traits = [ kvmTrait ];
isolation.allowedDevices = [
{
node = "/dev/kvm";
modifier = "rw";
}
{
node = "/dev/vhost-net";
modifier = "rw";
}
{
node = "/dev/net/tun";
modifier = "rwm";
}
];
isolation.additionalCapabilities = [
"CAP_NET_ADMIN"
"CAP_MKNOD"
];
routingInfo = [ routingInfo = [
{ {
username = "autumn"; username = "autumn";
+19 -1
View File
@@ -228,6 +228,17 @@ rec {
: systemd-nspawn user namespacing; see `--private-users=` in : systemd-nspawn user namespacing; see `--private-users=` in
systemd-nspawn(1). Bind mounts always go through idmapped `--bind`. systemd-nspawn(1). Bind mounts always go through idmapped `--bind`.
`isolation.allowedDevices`
: List of `{ node; modifier; }` host devices to grant the container's
cgroup access to; see `containers.<name>.allowedDevices` in the NixOS
manual. nspawn bind-mounts a handful of devices (`/dev/kvm`,
`/dev/net/tun`, ...) into the container itself once the cgroup allows it -
this doesn't need a matching `resources.fs` bind mount.
`isolation.additionalCapabilities`
: Extra Linux capabilities granted to the container; see
`containers.<name>.additionalCapabilities` in the NixOS manual.
`miscProperties` `miscProperties`
: Arbitrary data attached to the result. Used for cross-container discovery : Arbitrary data attached to the result. Used for cross-container discovery
via `collectContainers`. via `collectContainers`.
@@ -272,6 +283,8 @@ rec {
bindMounts = resources.fs or { }; bindMounts = resources.fs or { };
allowsNixDaemon = isolation.nixDaemon or false; allowsNixDaemon = isolation.nixDaemon or false;
privateUsers = isolation.privateUsers or "pick"; privateUsers = isolation.privateUsers or "pick";
allowedDevices = isolation.allowedDevices or [ ];
additionalCapabilities = isolation.additionalCapabilities or [ ];
allowInternet = hasInternetAccess access; allowInternet = hasInternetAccess access;
allBindMounts = builtins.foldl' (acc: t: acc // (t.resources.fs or { })) { } traits // bindMounts; allBindMounts = builtins.foldl' (acc: t: acc // (t.resources.fs or { })) { } traits // bindMounts;
@@ -368,7 +381,12 @@ rec {
kind = "nspawn"; kind = "nspawn";
miscProperties = flattenMiscProp self miscProperties; miscProperties = flattenMiscProp self miscProperties;
nixosContainer = { nixosContainer = {
inherit autoStart privateUsers; inherit
autoStart
privateUsers
allowedDevices
additionalCapabilities
;
bindMounts = { }; bindMounts = { };
extraFlags = bindMountExtraFlags; extraFlags = bindMountExtraFlags;
privateNetwork = true; privateNetwork = true;