20 Commits
Author SHA1 Message Date
Floweynt 9db09ba9d6 Merge branch 'master' into frcc-kvm
diff-pr / dix (pull_request) Successful in 6m50s
flake-check / flake-check (pull_request) Failing after 2m0s
lint / lint (pull_request) Failing after 1m51s
2026-09-10 11:33:34 -05:00
Floweynt 3e5e4cfc1d try fixing gitea ci: v15
diff-tag / dix (push) Successful in 6m9s
flake-check / flake-check (push) Failing after 1m56s
lint / lint (push) Failing after 1m42s
2026-09-10 11:29:01 -05:00
Floweynt 8c20c5850d try fixing gitea ci: v14
diff-tag / dix (push) Successful in 7m27s
flake-check / flake-check (push) Failing after 1m30s
lint / lint (push) Canceled after 1m37s
2026-09-10 11:18:31 -05:00
Floweynt df615ba3c1 try fixing gitea ci: v14
diff-tag / dix (push) Canceled after 1m4s
flake-check / flake-check (push) Canceled after 10s
lint / lint (push) Canceled after 3m44s
2026-09-10 11:13:32 -05:00
Floweynt b8d64efc11 try fixing gitea ci: v13
diff-tag / dix (push) Canceled after 15m6s
flake-check / flake-check (push) Failing after 23m52s
lint / lint (push) Canceled after 18m24s
2026-09-10 10:28:40 -05:00
Floweynt 7f3068f51c try fixing gitea ci: v12
diff-tag / dix (push) Failing after 6s
flake-check / flake-check (push) Failing after 6s
lint / lint (push) Failing after 4m51s
2026-09-10 10:09:33 -05:00
Floweynt fded1cd233 try fixing gitea ci: v11
diff-tag / dix (push) Failing after 6s
flake-check / flake-check (push) Failing after 6s
lint / lint (push) Failing after 6s
2026-09-10 10:06:23 -05:00
Floweynt b62ecdd957 try fixing gitea ci: v10
diff-tag / dix (push) Failing after 6s
flake-check / flake-check (push) Failing after 6s
lint / lint (push) Failing after 6s
2026-09-10 10:00:15 -05:00
Floweynt 0d08a1a521 try fixing gitea ci: v9
diff-tag / dix (push) Failing after 7s
flake-check / flake-check (push) Failing after 7s
lint / lint (push) Failing after 6s
2026-09-10 09:47:48 -05:00
Floweynt ea4fa7c55c try fixing gitea ci: v8
diff-tag / dix (push) Failing after 2s
flake-check / flake-check (push) Failing after 2s
lint / lint (push) Failing after 1s
2026-09-10 09:33:51 -05:00
Floweynt 7df803484d try fixing gitea ci: v7
diff-tag / dix (push) Failing after 2s
flake-check / flake-check (push) Failing after 1s
lint / lint (push) Failing after 2s
2026-09-10 09:21:05 -05:00
Floweynt 83a84fd0f4 try fixing gitea ci: v6
diff-tag / dix (push) Failing after 1s
flake-check / flake-check (push) Failing after 1s
lint / lint (push) Failing after 1s
2026-09-10 08:57:25 -05:00
Floweynt 15cae9a40d try fixing gitea ci: v5
diff-tag / dix (push) Failing after 0s
flake-check / flake-check (push) Failing after 0s
lint / lint (push) Failing after 0s
2026-09-09 23:48:01 -05:00
Floweynt 780bdb7c13 try fixing gitea ci: v4
diff-tag / dix (push) Failing after 1s
flake-check / flake-check (push) Failing after 0s
lint / lint (push) Failing after 0s
2026-09-09 23:19:28 -05:00
Floweynt 6e4c303ade try fixing gitea ci: v3
diff-tag / dix (push) Failing after 0s
flake-check / flake-check (push) Failing after 1s
lint / lint (push) Failing after 0s
2026-09-09 23:10:34 -05:00
Floweynt ed244dd9f3 try fixing gitea ci: v2
flake-check / flake-check (push) Canceled after 0s
lint / lint (push) Canceled after 0s
diff-tag / dix (push) Failing after 0s
2026-09-09 22:37:36 -05:00
Floweynt 8d61167757 try fixing gitea ci
flake-check / flake-check (push) Canceled after 0s
lint / lint (push) Canceled after 0s
diff-tag / dix (push) Failing after 1s
2026-09-09 22:22:17 -05:00
Floweynt 73187bcc9b test something
flake-check / flake-check (push) Canceled after 0s
lint / lint (push) Canceled after 0s
diff-tag / dix (push) Failing after 0s
2026-09-09 22:12:37 -05:00
Floweynt d3b1db7836 try and get CI workflow to work
flake-check / flake-check (push) Canceled after 0s
lint / lint (push) Canceled after 0s
diff-tag / dix (push) Failing after 0s
2026-09-09 20:11:43 -05:00
Autumn Liu 33ccab9ad4 frcc experiments
diff-pr / dix (pull_request) Canceled after 0s
flake-check / flake-check (pull_request) Canceled after 0s
lint / lint (pull_request) Canceled after 0s
2026-09-09 17:58:14 -05:00
10 changed files with 105 additions and 64 deletions
+4 -9
View File
@@ -13,26 +13,21 @@ concurrency:
jobs:
dix:
runs-on: ubuntu-latest
runs-on: nix
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: worktree base for diff
run: git worktree add "$RUNNER_TEMP/base" "${{ github.event.pull_request.base.sha }}"
- name: build closures and render diff
run: |
nix run .#ci -- diff "$RUNNER_TEMP/base" . \
nix run -L .#ci -- diff "$RUNNER_TEMP/base" . \
"### System closure diff vs \`${{ github.event.pull_request.base.ref }}\`" \
> "$RUNNER_TEMP/comment.md"
nix run .#ci -- inspect-diff "$RUNNER_TEMP/base" . \
nix run -L .#ci -- inspect-diff "$RUNNER_TEMP/base" . \
"### Inspection diff vs \`${{ github.event.pull_request.base.ref }}\`" \
>> "$RUNNER_TEMP/comment.md"
@@ -42,4 +37,4 @@ jobs:
API: ${{ github.api_url }}
REPO: ${{ github.repository }}
PR: ${{ github.event.pull_request.number }}
run: nix run .#ci -- post-comment "<!-- dix-diff -->" "$RUNNER_TEMP/comment.md"
run: nix run -L .#ci -- post-comment "<!-- dix-diff -->" "$RUNNER_TEMP/comment.md"
+3 -8
View File
@@ -9,17 +9,12 @@ permissions:
jobs:
dix:
runs-on: ubuntu-latest
runs-on: nix
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: diff latest tag against HEAD
run: |
tag=$(git tag --sort=-creatordate | head -n1)
@@ -30,8 +25,8 @@ jobs:
git worktree add "$RUNNER_TEMP/old" "$tag"
head=$(git rev-parse --short HEAD)
{
nix run .#ci -- diff "$RUNNER_TEMP/old" . \
nix run -L .#ci -- diff "$RUNNER_TEMP/old" . \
"# System closure diff: \`$tag\` -> \`$head\`"
nix run .#ci -- inspect-diff "$RUNNER_TEMP/old" . \
nix run -L .#ci -- inspect-diff "$RUNNER_TEMP/old" . \
"# Inspection diff: \`$tag\` -> \`$head\`"
} | tee -a "$GITHUB_STEP_SUMMARY"
+1 -6
View File
@@ -14,13 +14,8 @@ concurrency:
jobs:
flake-check:
runs-on: ubuntu-latest
runs-on: nix
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
- run: nix flake check -L
+3 -8
View File
@@ -11,16 +11,11 @@ permissions:
jobs:
update:
runs-on: ubuntu-latest
runs-on: nix
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
- run: nix flake update
- run: nix flake update -L
- name: open/update PR
env:
@@ -29,5 +24,5 @@ jobs:
REPO: ${{ github.repository }}
run: |
printf 'Automated `nix flake update`.\n' > "$RUNNER_TEMP/body.md"
nix run .#ci -- open-pr \
nix run -L .#ci -- open-pr \
flake-update "$GITHUB_REF_NAME" "flake.lock: update inputs" "$RUNNER_TEMP/body.md" automated
+3 -8
View File
@@ -15,15 +15,10 @@ concurrency:
jobs:
lint:
runs-on: ubuntu-latest
runs-on: nix
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: pick reporter
run: |
if [ "${{ github.event_name }}" = pull_request ]; then
@@ -33,9 +28,9 @@ jobs:
fi
- name: run linters
run: nix run .#ci -- lint . "$RUNNER_TEMP/findings"
run: nix run -L .#ci -- lint . "$RUNNER_TEMP/findings"
- name: report findings
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: nix run .#ci -- lint-report "$REPORTER" "$RUNNER_TEMP/findings"
run: nix run -L .#ci -- lint-report "$REPORTER" "$RUNNER_TEMP/findings"
+4 -9
View File
@@ -11,18 +11,13 @@ permissions:
jobs:
scan:
runs-on: ubuntu-latest
runs-on: nix
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: scan host closures
id: scan
run: echo "count=$(nix run .#ci -- vulnix . "$RUNNER_TEMP/issue.md")" >> "$GITHUB_OUTPUT"
run: echo "count=$(nix run -L .#ci -- vulnix . "$RUNNER_TEMP/issue.md")" >> "$GITHUB_OUTPUT"
- name: file/update issue
if: steps.scan.outputs.count != '0'
@@ -30,7 +25,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
API: ${{ github.api_url }}
REPO: ${{ github.repository }}
run: nix run .#ci -- upsert-issue vulnix "vulnix: known vulnerabilities in system closure" "$RUNNER_TEMP/issue.md"
run: nix run -L .#ci -- upsert-issue vulnix "vulnix: known vulnerabilities in system closure" "$RUNNER_TEMP/issue.md"
- name: close resolved issue
if: steps.scan.outputs.count == '0'
@@ -38,4 +33,4 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
API: ${{ github.api_url }}
REPO: ${{ github.repository }}
run: nix run .#ci -- close-issue vulnix
run: nix run -L .#ci -- close-issue vulnix
+1 -1
View File
@@ -17,7 +17,7 @@ def run(*args, **kw):
def nix(*args):
return run("nix", "--extra-experimental-features", "nix-command flakes", *args, check=True, capture_output=True).stdout
return run("nix", "--extra-experimental-features", "nix-command flakes", "-L", *args, check=True, stdout=subprocess.PIPE).stdout
def git(*args, check=True):
+34 -13
View File
@@ -8,6 +8,9 @@ let
inherit (dsl) mkContainer mkVm;
inherit (hostInfo.paths) data secrets;
pubSshPort = 23;
intSshPort = 23 + 8000;
ciRunnerData = "${data}/web/git-ci-runner";
ciRunnerSecrets = "${secrets}/ci-runner";
in
@@ -17,8 +20,8 @@ in
net.access = [ { to = "@internet"; } ];
net.forward.tcp = [
{
host = 23;
container = 8023;
host = pubSshPort;
container = intSshPort;
}
];
svc.autoStart = true;
@@ -38,7 +41,8 @@ in
ROOT_URL = "https://git.floweytf.com/";
START_SSH_SERVER = true;
BUILTIN_SSH_SERVER_USER = "git";
SSH_PORT = 8023;
SSH_PORT = pubSshPort;
SSH_LISTEN_PORT = intSshPort;
};
service.DISABLE_REGISTRATION = true;
};
@@ -53,6 +57,7 @@ in
ci-runner = mkVm {
name = "ci-runner";
includedInTests = false;
net.access = [
{
to = "git";
@@ -62,7 +67,7 @@ in
];
svc.autoStart = true;
resources.cpu = 4;
resources.mem = "8G";
resources.mem = "32G";
resources.fs = [
{
proto = "virtiofs";
@@ -80,7 +85,7 @@ in
proto = "virtiofs";
tag = "runner-state";
source = "${ciRunnerData}/runner-state";
mountPoint = "/var/lib/gitea-runner";
mountPoint = "/var/lib/private/gitea-runner";
}
{
proto = "virtiofs";
@@ -100,20 +105,24 @@ in
let
runnerInstanceName = "ci-runner";
ciJobContents = with pkgs; [
bashInteractive
coreutils
gitMinimal
nixVersions.latest
nodejs
cacert
(writeTextDir "etc/nix/nix.conf" "experimental-features = nix-command flakes\n")
];
ciJobImage = pkgs.dockerTools.buildLayeredImage {
name = "ci-job-image";
tag = "latest";
contents = with pkgs; [
bashInteractive
coreutils
gitMinimal
nixVersions.latest
nodejs
cacert
];
contents = ciJobContents;
config = {
Cmd = [ "/bin/sh" ];
Env = [
"PATH=${lib.makeBinPath ciJobContents}"
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
"NIX_SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
"NIX_REMOTE=daemon"
@@ -125,6 +134,10 @@ in
boot.kernelModules = [ "kvm-intel" ];
boot.extraModprobeConfig = "options kvm_intel nested=1";
# volume-mounted into CI containers; must be in VM's store so
# image symlinks (/bin/node etc.) resolve through the mount
system.extraDependencies = ciJobContents;
microvm.writableStoreOverlay = "/nix/.rw-store";
nix.settings = {
@@ -142,7 +155,15 @@ in
};
# nix.optimise.automatic = true; - doesn't work with microvm.writableStoreOverlay
services.journald.extraConfig = "ForwardToConsole=yes";
virtualisation.containerd.enable = true;
virtualisation.containerd.settings.plugins."io.containerd.snapshotter.v1.overlayfs".mount_options = [ "userxattr" ];
virtualisation.docker.enable = true;
virtualisation.docker.extraOptions = "--containerd /run/containerd/containerd.sock";
systemd.services.docker.wants = [ "containerd.service" ];
systemd.services.docker.after = [ "containerd.service" ];
systemd.services.load-ci-job-image = {
description = "Load the CI job Docker image";
+31 -1
View File
@@ -61,16 +61,27 @@ let
net ? { },
resources ? { },
traits ? [ ],
isolation ? { },
}:
mkContainer {
inherit name;
inherit net resources;
svc.autoStart = true;
isolation.nixDaemon = nixDaemon;
isolation = { nixDaemon = nixDaemon; } // isolation;
traits = [ sshTrait ] ++ traits;
packages = with pkgs; [ tmux ] ++ packages;
miscProperties = self._sshpiperRegister routingInfo;
};
kvmTrait = {
containerConfig =
{ pkgs, ... }:
{
users.users.runner.extraGroups = [ "wheel" ];
security.sudo.wheelNeedsPassword = false;
environment.systemPackages = [ pkgs.qemu_kvm ];
};
};
in
{
ssh-admin = mkSsh {
@@ -121,6 +132,25 @@ in
mem = "16G";
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 = [
{
username = "autumn";
+21 -1
View File
@@ -228,6 +228,17 @@ rec {
: systemd-nspawn user namespacing; see `--private-users=` in
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`
: Arbitrary data attached to the result. Used for cross-container discovery
via `collectContainers`.
@@ -272,6 +283,8 @@ rec {
bindMounts = resources.fs or { };
allowsNixDaemon = isolation.nixDaemon or false;
privateUsers = isolation.privateUsers or "pick";
allowedDevices = isolation.allowedDevices or [ ];
additionalCapabilities = isolation.additionalCapabilities or [ ];
allowInternet = hasInternetAccess access;
allBindMounts = builtins.foldl' (acc: t: acc // (t.resources.fs or { })) { } traits // bindMounts;
@@ -368,7 +381,12 @@ rec {
kind = "nspawn";
miscProperties = flattenMiscProp self miscProperties;
nixosContainer = {
inherit autoStart privateUsers;
inherit
autoStart
privateUsers
allowedDevices
additionalCapabilities
;
bindMounts = { };
extraFlags = bindMountExtraFlags;
privateNetwork = true;
@@ -553,6 +571,8 @@ rec {
Destination = "0.0.0.0/0";
Gateway = hostAddr;
};
networkConfig.DNS = [ hostAddr ];
networkConfig.Domains = [ "~." "containers" ];
linkConfig.RequiredForOnline = if allowInternet then "routable" else "degraded";
};
networking.enableIPv6 = false;