Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d00b1b3727 | ||
|
|
0bda3d3712 |
@@ -26,6 +26,7 @@ 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"
|
||||||
|
|||||||
@@ -163,10 +163,9 @@ in
|
|||||||
trusted-public-keys = [ "microvm.cachix.org-1:oXnBc6hRE3eX5rSYdRyMYXnfzcCxC7yKPTbZXALsqys=" ];
|
trusted-public-keys = [ "microvm.cachix.org-1:oXnBc6hRE3eX5rSYdRyMYXnfzcCxC7yKPTbZXALsqys=" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
nix.gc = {
|
nix.settings = {
|
||||||
automatic = true;
|
min-free = 5 * 1024 * 1024 * 1024;
|
||||||
dates = "daily";
|
max-free = 10 * 1024 * 1024 * 1024;
|
||||||
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
|
||||||
|
|
||||||
|
|||||||
@@ -61,27 +61,16 @@ 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;
|
isolation.nixDaemon = nixDaemon;
|
||||||
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 {
|
||||||
@@ -132,25 +121,6 @@ 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,17 +228,6 @@ 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`.
|
||||||
@@ -283,8 +272,6 @@ 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;
|
||||||
@@ -381,12 +368,7 @@ rec {
|
|||||||
kind = "nspawn";
|
kind = "nspawn";
|
||||||
miscProperties = flattenMiscProp self miscProperties;
|
miscProperties = flattenMiscProp self miscProperties;
|
||||||
nixosContainer = {
|
nixosContainer = {
|
||||||
inherit
|
inherit autoStart privateUsers;
|
||||||
autoStart
|
|
||||||
privateUsers
|
|
||||||
allowedDevices
|
|
||||||
additionalCapabilities
|
|
||||||
;
|
|
||||||
bindMounts = { };
|
bindMounts = { };
|
||||||
extraFlags = bindMountExtraFlags;
|
extraFlags = bindMountExtraFlags;
|
||||||
privateNetwork = true;
|
privateNetwork = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user