Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9db09ba9d6 | ||
|
|
3e5e4cfc1d | ||
|
|
8c20c5850d | ||
|
|
df615ba3c1 | ||
|
|
b8d64efc11 | ||
|
|
7f3068f51c | ||
|
|
fded1cd233 | ||
|
|
b62ecdd957 | ||
|
|
0d08a1a521 | ||
|
|
ea4fa7c55c | ||
|
|
7df803484d | ||
|
|
83a84fd0f4 | ||
|
|
15cae9a40d | ||
|
|
780bdb7c13 | ||
|
|
6e4c303ade | ||
|
|
ed244dd9f3 | ||
|
|
8d61167757 | ||
|
|
73187bcc9b | ||
|
|
d3b1db7836 | ||
|
|
33ccab9ad4 |
@@ -13,26 +13,21 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
dix:
|
dix:
|
||||||
runs-on: ubuntu-latest
|
runs-on: nix
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- uses: cachix/install-nix-action@v31
|
|
||||||
with:
|
|
||||||
extra_nix_config: |
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
|
|
||||||
- name: worktree base for diff
|
- name: worktree base for diff
|
||||||
run: git worktree add "$RUNNER_TEMP/base" "${{ github.event.pull_request.base.sha }}"
|
run: git worktree add "$RUNNER_TEMP/base" "${{ github.event.pull_request.base.sha }}"
|
||||||
|
|
||||||
- name: build closures and render diff
|
- name: build closures and render diff
|
||||||
run: |
|
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 }}\`" \
|
"### System closure diff vs \`${{ github.event.pull_request.base.ref }}\`" \
|
||||||
> "$RUNNER_TEMP/comment.md"
|
> "$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 }}\`" \
|
"### Inspection diff vs \`${{ github.event.pull_request.base.ref }}\`" \
|
||||||
>> "$RUNNER_TEMP/comment.md"
|
>> "$RUNNER_TEMP/comment.md"
|
||||||
|
|
||||||
@@ -42,4 +37,4 @@ jobs:
|
|||||||
API: ${{ github.api_url }}
|
API: ${{ github.api_url }}
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
PR: ${{ github.event.pull_request.number }}
|
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"
|
||||||
|
|||||||
@@ -9,17 +9,12 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
dix:
|
dix:
|
||||||
runs-on: ubuntu-latest
|
runs-on: nix
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- uses: cachix/install-nix-action@v31
|
|
||||||
with:
|
|
||||||
extra_nix_config: |
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
|
|
||||||
- name: diff latest tag against HEAD
|
- name: diff latest tag against HEAD
|
||||||
run: |
|
run: |
|
||||||
tag=$(git tag --sort=-creatordate | head -n1)
|
tag=$(git tag --sort=-creatordate | head -n1)
|
||||||
@@ -30,8 +25,8 @@ jobs:
|
|||||||
git worktree add "$RUNNER_TEMP/old" "$tag"
|
git worktree add "$RUNNER_TEMP/old" "$tag"
|
||||||
head=$(git rev-parse --short HEAD)
|
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\`"
|
"# 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\`"
|
"# Inspection diff: \`$tag\` -> \`$head\`"
|
||||||
} | tee -a "$GITHUB_STEP_SUMMARY"
|
} | tee -a "$GITHUB_STEP_SUMMARY"
|
||||||
|
|||||||
@@ -14,13 +14,8 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
flake-check:
|
flake-check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: nix
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: cachix/install-nix-action@v31
|
|
||||||
with:
|
|
||||||
extra_nix_config: |
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
|
|
||||||
- run: nix flake check -L
|
- run: nix flake check -L
|
||||||
|
|||||||
@@ -11,16 +11,11 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update:
|
update:
|
||||||
runs-on: ubuntu-latest
|
runs-on: nix
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: cachix/install-nix-action@v31
|
- run: nix flake update -L
|
||||||
with:
|
|
||||||
extra_nix_config: |
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
|
|
||||||
- run: nix flake update
|
|
||||||
|
|
||||||
- name: open/update PR
|
- name: open/update PR
|
||||||
env:
|
env:
|
||||||
@@ -29,5 +24,5 @@ jobs:
|
|||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
run: |
|
run: |
|
||||||
printf 'Automated `nix flake update`.\n' > "$RUNNER_TEMP/body.md"
|
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
|
flake-update "$GITHUB_REF_NAME" "flake.lock: update inputs" "$RUNNER_TEMP/body.md" automated
|
||||||
|
|||||||
@@ -15,15 +15,10 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: nix
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: cachix/install-nix-action@v31
|
|
||||||
with:
|
|
||||||
extra_nix_config: |
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
|
|
||||||
- name: pick reporter
|
- name: pick reporter
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.event_name }}" = pull_request ]; then
|
if [ "${{ github.event_name }}" = pull_request ]; then
|
||||||
@@ -33,9 +28,9 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: run linters
|
- name: run linters
|
||||||
run: nix run .#ci -- lint . "$RUNNER_TEMP/findings"
|
run: nix run -L .#ci -- lint . "$RUNNER_TEMP/findings"
|
||||||
|
|
||||||
- name: report findings
|
- name: report findings
|
||||||
env:
|
env:
|
||||||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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"
|
||||||
|
|||||||
@@ -11,18 +11,13 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
scan:
|
scan:
|
||||||
runs-on: ubuntu-latest
|
runs-on: nix
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: cachix/install-nix-action@v31
|
|
||||||
with:
|
|
||||||
extra_nix_config: |
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
|
|
||||||
- name: scan host closures
|
- name: scan host closures
|
||||||
id: scan
|
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
|
- name: file/update issue
|
||||||
if: steps.scan.outputs.count != '0'
|
if: steps.scan.outputs.count != '0'
|
||||||
@@ -30,7 +25,7 @@ jobs:
|
|||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
API: ${{ github.api_url }}
|
API: ${{ github.api_url }}
|
||||||
REPO: ${{ github.repository }}
|
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
|
- name: close resolved issue
|
||||||
if: steps.scan.outputs.count == '0'
|
if: steps.scan.outputs.count == '0'
|
||||||
@@ -38,4 +33,4 @@ jobs:
|
|||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
API: ${{ github.api_url }}
|
API: ${{ github.api_url }}
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
run: nix run .#ci -- close-issue vulnix
|
run: nix run -L .#ci -- close-issue vulnix
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ def run(*args, **kw):
|
|||||||
|
|
||||||
|
|
||||||
def nix(*args):
|
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):
|
def git(*args, check=True):
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ let
|
|||||||
inherit (dsl) mkContainer mkVm;
|
inherit (dsl) mkContainer mkVm;
|
||||||
inherit (hostInfo.paths) data secrets;
|
inherit (hostInfo.paths) data secrets;
|
||||||
|
|
||||||
|
pubSshPort = 23;
|
||||||
|
intSshPort = 23 + 8000;
|
||||||
|
|
||||||
ciRunnerData = "${data}/web/git-ci-runner";
|
ciRunnerData = "${data}/web/git-ci-runner";
|
||||||
ciRunnerSecrets = "${secrets}/ci-runner";
|
ciRunnerSecrets = "${secrets}/ci-runner";
|
||||||
in
|
in
|
||||||
@@ -17,8 +20,8 @@ in
|
|||||||
net.access = [ { to = "@internet"; } ];
|
net.access = [ { to = "@internet"; } ];
|
||||||
net.forward.tcp = [
|
net.forward.tcp = [
|
||||||
{
|
{
|
||||||
host = 23;
|
host = pubSshPort;
|
||||||
container = 8023;
|
container = intSshPort;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
svc.autoStart = true;
|
svc.autoStart = true;
|
||||||
@@ -38,7 +41,8 @@ in
|
|||||||
ROOT_URL = "https://git.floweytf.com/";
|
ROOT_URL = "https://git.floweytf.com/";
|
||||||
START_SSH_SERVER = true;
|
START_SSH_SERVER = true;
|
||||||
BUILTIN_SSH_SERVER_USER = "git";
|
BUILTIN_SSH_SERVER_USER = "git";
|
||||||
SSH_PORT = 8023;
|
SSH_PORT = pubSshPort;
|
||||||
|
SSH_LISTEN_PORT = intSshPort;
|
||||||
};
|
};
|
||||||
service.DISABLE_REGISTRATION = true;
|
service.DISABLE_REGISTRATION = true;
|
||||||
};
|
};
|
||||||
@@ -53,6 +57,7 @@ in
|
|||||||
|
|
||||||
ci-runner = mkVm {
|
ci-runner = mkVm {
|
||||||
name = "ci-runner";
|
name = "ci-runner";
|
||||||
|
includedInTests = false;
|
||||||
net.access = [
|
net.access = [
|
||||||
{
|
{
|
||||||
to = "git";
|
to = "git";
|
||||||
@@ -62,7 +67,7 @@ in
|
|||||||
];
|
];
|
||||||
svc.autoStart = true;
|
svc.autoStart = true;
|
||||||
resources.cpu = 4;
|
resources.cpu = 4;
|
||||||
resources.mem = "8G";
|
resources.mem = "32G";
|
||||||
resources.fs = [
|
resources.fs = [
|
||||||
{
|
{
|
||||||
proto = "virtiofs";
|
proto = "virtiofs";
|
||||||
@@ -80,7 +85,7 @@ in
|
|||||||
proto = "virtiofs";
|
proto = "virtiofs";
|
||||||
tag = "runner-state";
|
tag = "runner-state";
|
||||||
source = "${ciRunnerData}/runner-state";
|
source = "${ciRunnerData}/runner-state";
|
||||||
mountPoint = "/var/lib/gitea-runner";
|
mountPoint = "/var/lib/private/gitea-runner";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
proto = "virtiofs";
|
proto = "virtiofs";
|
||||||
@@ -100,20 +105,24 @@ in
|
|||||||
let
|
let
|
||||||
runnerInstanceName = "ci-runner";
|
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 {
|
ciJobImage = pkgs.dockerTools.buildLayeredImage {
|
||||||
name = "ci-job-image";
|
name = "ci-job-image";
|
||||||
tag = "latest";
|
tag = "latest";
|
||||||
contents = with pkgs; [
|
contents = ciJobContents;
|
||||||
bashInteractive
|
|
||||||
coreutils
|
|
||||||
gitMinimal
|
|
||||||
nixVersions.latest
|
|
||||||
nodejs
|
|
||||||
cacert
|
|
||||||
];
|
|
||||||
config = {
|
config = {
|
||||||
Cmd = [ "/bin/sh" ];
|
Cmd = [ "/bin/sh" ];
|
||||||
Env = [
|
Env = [
|
||||||
|
"PATH=${lib.makeBinPath ciJobContents}"
|
||||||
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
|
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
|
||||||
"NIX_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"
|
"NIX_REMOTE=daemon"
|
||||||
@@ -125,6 +134,10 @@ in
|
|||||||
boot.kernelModules = [ "kvm-intel" ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModprobeConfig = "options kvm_intel nested=1";
|
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";
|
microvm.writableStoreOverlay = "/nix/.rw-store";
|
||||||
|
|
||||||
nix.settings = {
|
nix.settings = {
|
||||||
@@ -142,7 +155,15 @@ in
|
|||||||
};
|
};
|
||||||
# nix.optimise.automatic = true; - doesn't work with microvm.writableStoreOverlay
|
# 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.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 = {
|
systemd.services.load-ci-job-image = {
|
||||||
description = "Load the CI job Docker image";
|
description = "Load the CI job Docker image";
|
||||||
|
|||||||
@@ -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";
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -553,6 +571,8 @@ rec {
|
|||||||
Destination = "0.0.0.0/0";
|
Destination = "0.0.0.0/0";
|
||||||
Gateway = hostAddr;
|
Gateway = hostAddr;
|
||||||
};
|
};
|
||||||
|
networkConfig.DNS = [ hostAddr ];
|
||||||
|
networkConfig.Domains = [ "~." "containers" ];
|
||||||
linkConfig.RequiredForOnline = if allowInternet then "routable" else "degraded";
|
linkConfig.RequiredForOnline = if allowInternet then "routable" else "degraded";
|
||||||
};
|
};
|
||||||
networking.enableIPv6 = false;
|
networking.enableIPv6 = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user