some security patches + buzz updates

This commit is contained in:
ari committed 2026-09-20 20:55:17 -04:00
1 parent 7a3d64e645
commit df46627173
17 files changed
+62 -36

No files matched your search

+1 -1
View File
@@ -36,8 +36,8 @@ in
skyg.nixos.common.cachePush.enable = false;
# firmware updater
services.fwupd.enable = true;
skyg.nixos.common.networking.nfsServer.enable = true;
services.nfs.server = {
enable = true;
lockdPort = ports.lockdPort;
mountdPort = ports.mountdPort;
statdPort = ports.statdPort;
+1 -1
View File
@@ -45,6 +45,7 @@ in
core.qemu.enable = true;
nixos = {
common.ssh-server.enable = true;
common.cachePush.enable = true;
common.hardware = {
pipewire.enable = true;
amdgpu.enable = true;
@@ -118,7 +119,6 @@ in
};
users.users.ari.extraGroups = [
"input"
"disk"
"wheel"
"tty"
"dialout"
+6 -2
View File
@@ -33,11 +33,13 @@ let
bucket = "buzz-media";
};
# NFS-backed volume on tnas1 (repo pattern: compose volume with nfs driver_opts).
# The server must be in `device` (the local driver uses it as the mount source);
# `o = addr=...` alone is not honoured here.
nfsVolume = subpath: {
driver_opts = {
type = "nfs";
o = "addr=tnas1.lab.internal,rw,nfsvers=4.0,nolock,hard,noatime";
device = ":/mnt/SmallG/buzz/${subpath}";
o = "rw,nfsvers=4.0,nolock,hard,noatime";
device = "tnas1.lab.internal:/mnt/SmallG/buzz/${subpath}";
};
};
in
@@ -231,6 +233,8 @@ in
skyg.nixos.common.container-services.buzz = {
enable = true;
autoUpdate.enable = true;
# Image pulls on first start / after a tag moves can exceed the 120s default.
timeoutStartSec = 600;
networks = {
internal = { driver = "bridge"; };
+1 -1
View File
@@ -38,8 +38,8 @@ in
networking.firewall.allowedUDPPorts = openPorts;
networking.firewall.allowedTCPPorts = openPorts;
# NFS
skyg.nixos.common.networking.nfsServer.enable = true;
services.nfs.server = {
enable = true;
lockdPort = 4001;
mountdPort = 4002;
statdPort = 4000;
+2 -4
View File
@@ -73,9 +73,7 @@
}
];
nix.distributedBuilds = true;
# optional, useful when the builder has a faster internet connection than yours
nix.extraOptions = ''
builders-use-substitutes = true
'';
# useful when the builder has a faster internet connection than yours
nix.settings.builders-use-substitutes = true;
};
}
+10 -7
View File
@@ -11,11 +11,11 @@ Most leaf modules expose a `skyg.nixos.common.*` enable flag and stay inert unti
common/
├── default.nix # Imports everything below + always-on env defaults
├── core.nix # System packages, nh (clean + gc), nix-ld, timezone (Toronto), locale; skyg.nixos.common.minimal
├── networking.nix # skyg.core.hostName, NetworkManager, NFS server (skyg.nixos.common.networking.nfsServer)
├── networking.nix # skyg.core.hostName, NetworkManager, NFS server opt-in (skyg.nixos.common.networking.nfsServer, default false)
├── user.nix # skyg.user.createSystemUser — creates the system user/groups + zsh shell
├── fonts.nix # System font packages + fontconfig defaults (Fira Code, Noto, …); skyg.nixos.common.fonts.minimal
├── ssh-server.nix # skyg.nixos.common.ssh-server — hardened sshd + master pubkey
├── ssh-notify.nix # skyg.nixos.common.ssh-notify — forward notify-send from SSH sessions to a desktop client
├── ssh-server.nix # skyg.nixos.common.ssh-server — hardened sshd + master public keys (list)
├── ssh-notify.nix # skyg.nixos.common.ssh-notify — forward notify-send from SSH sessions to a desktop client (RemoteForward scoped to *.lab.internal)
├── qemu.nix # skyg.core.qemu — QEMU/quickemu + SPICE guest tooling
├── binary-cache.nix # skyg.nixos.common.cachePush — push finished builds to the bigbox2 cache
├── containers/ # Docker vs Podman runtime selection + host-created container networks
@@ -29,11 +29,14 @@ common/
`programs.nh` with auto-clean (`--keep-since 7d --keep 5`, overridable per host via
`programs.nh.clean.extraArgs`) as the single GC mechanism — no separate cron jobs or
`nix.gc.automatic`. `skyg.nixos.common.nh.flake` sets the flake path per host.
- **`networking.nix`** defines `skyg.core.hostName`, enables NetworkManager + the NFS server,
and disables the flaky `NetworkManager-wait-online` unit.
- **`networking.nix`** defines `skyg.core.hostName`, enables NetworkManager, and disables the
flaky `NetworkManager-wait-online` unit. The NFS server is **off by default**
(`skyg.nixos.common.networking.nfsServer.enable = false`); only hosts that export shares
opt in.
- **`user.nix`** creates the actual system user (in `wheel` + `networkmanager`) with zsh as
the login shell; gated by `skyg.user.createSystemUser` (default `true`).
- **`ssh-server.nix`** ships the master public key and a hardened sshd config
- **`ssh-server.nix`** ships the master public keys (`masterPubKeys`, a list so a key can be
rotated by adding the new one before dropping the old) and a hardened sshd config
(key-only auth, long keepalives). Disabled by default.
## Option Namespace
@@ -48,7 +51,7 @@ skyg.nixos.common.cachePush.* → binary-cache.nix
skyg.nixos.common.minimal → core.nix (skip heavy always-on system packages)
skyg.nixos.common.nh.flake → core.nix (flake path for 'nh os' commands, set per host)
skyg.nixos.common.fonts.minimal → fonts.nix (install only a minimal font set)
skyg.nixos.common.networking.nfsServer → networking.nix (enable/disable the NFS server)
skyg.nixos.common.networking.nfsServer → networking.nix (enable/disable the NFS server, default false)
skyg.nixos.common.containers.* → containers/
skyg.nixos.common.hardware.* → hardware/
skyg.nixos.common.pritunl.* → pritunl/
@@ -44,6 +44,10 @@ If adding a new per-service option:
- Each group gets **one** systemd unit (`container-services-<group>.service`) that manages the whole stack
- Group units are ordered after `container-networks.target`, so any network declared in
`skyg.nixos.common.containers.networks` exists before a stack starts
- Each unit puts the runtime CLI (`pkgs.podman`/`pkgs.docker`) and `coreutils` on `PATH`:
`podman-compose` shells out to a bare `podman`, and NixOS systemd services do not inherit
`/run/current-system/sw/bin` (Docker worked without this only because `docker-compose` v2
talks to the socket directly)
- Custom files are collected and written by a separate unit (`container-services-<group>-files.service`)
- Env file changes trigger a path unit that restarts the stack (`container-services-<group>-env-reload.*`)
- Compose files are rendered to the store and staged to `/var/lib/container-services/<group>/compose.yml`
@@ -13,6 +13,8 @@ let
composeBin = containerLib.composeBin containersCfg.runtime;
runtimeService = containerLib.runtimeService isDocker;
runtimeBin = containerLib.runtimeBin isDocker;
# Put the runtime CLI on each unit's PATH (podman-compose shells out to `podman`).
runtimePkg = if isDocker then pkgs.docker else pkgs.podman;
enabledGroups = lib.filterAttrs (_: g: g.enable) cfg;
autoUpdateGroups = lib.filterAttrs (_: g: g.autoUpdate.enable) enabledGroups;
@@ -82,7 +84,7 @@ in
in
lib.nameValuePair
"container-services-${groupName}"
(systemdLib.mkSystemdService groupName grpCfg effectiveComposeFile overridesFile composeBin runtimeService hasFiles))
(systemdLib.mkSystemdService groupName grpCfg effectiveComposeFile overridesFile composeBin runtimeService runtimePkg hasFiles))
enabledGroups
// lib.foldAttrs lib.recursiveUpdate { } (
lib.mapAttrsToList
@@ -102,7 +104,7 @@ in
)
// lib.mapAttrs'
(groupName: grpCfg:
let units = systemdLib.mkUpdateUnits groupName grpCfg (mkOverridesFileFor groupName grpCfg) composeBin runtimeBin;
let units = systemdLib.mkUpdateUnits groupName grpCfg (mkOverridesFileFor groupName grpCfg) composeBin runtimeBin runtimePkg;
in lib.nameValuePair "container-services-${groupName}-update" units.services."container-services-${groupName}-update")
autoUpdateGroups;
@@ -119,7 +121,7 @@ in
systemd.timers =
lib.mapAttrs'
(groupName: grpCfg:
let units = systemdLib.mkUpdateUnits groupName grpCfg (mkOverridesFileFor groupName grpCfg) composeBin runtimeBin;
let units = systemdLib.mkUpdateUnits groupName grpCfg (mkOverridesFileFor groupName grpCfg) composeBin runtimeBin runtimePkg;
in lib.nameValuePair "container-services-${groupName}-update" units.timers."container-services-${groupName}-update")
autoUpdateGroups;
};
@@ -74,6 +74,8 @@ rec {
"container-services-${groupName}-files" = {
description = "Write custom files for container service group '${groupName}'";
before = [ "container-services-${groupName}.service" ];
# The script uses bare mkdir/cat/chmod/dirname, so coreutils must be on PATH.
path = [ pkgs.coreutils ];
serviceConfig = {
Type = "oneshot";
ExecStart = scriptFile;
@@ -30,6 +30,12 @@
description = "Seconds to wait for 'compose down' before forcibly killing containers.";
};
timeoutStartSec = lib.mkOption {
type = lib.types.int;
default = 120;
description = "Seconds to wait for 'compose up -d' (image pulls included) before the unit is considered failed.";
};
composeFile = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
@@ -2,7 +2,8 @@
{
# Create a systemd oneshot service that manages the compose stack.
mkSystemdService = groupName: grpCfg: composeFile: overridesFile: composeBin: runtimeService: hasFiles:
# `runtimePkg` is put on PATH because podman-compose shells out to `podman`.
mkSystemdService = groupName: grpCfg: composeFile: overridesFile: composeBin: runtimeService: runtimePkg: hasFiles:
let
stateDir = grpCfg.stateDir;
fileServiceDep = if hasFiles then "container-services-${groupName}-files.service" else null;
@@ -25,12 +26,13 @@
++ lib.optional hasFiles fileServiceDep;
requires = [ runtimeService ]
++ lib.optional hasFiles fileServiceDep;
path = [ runtimePkg pkgs.coreutils ];
startLimitIntervalSec = 300; # 5 minutes window
startLimitBurst = 6; # allow 6 failures before giving up
serviceConfig = {
Restart = "on-failure";
RestartSec = "15s";
TimeoutStartSec = "120s";
TimeoutStartSec = grpCfg.timeoutStartSec;
Type = "oneshot";
RemainAfterExit = true;
TimeoutStopSec = grpCfg.timeoutStopSec;
@@ -44,7 +46,7 @@
};
# Create the update service + timer for a group's autoUpdate config.
mkUpdateUnits = groupName: grpCfg: overridesFile: composeBin: runtimeBin:
mkUpdateUnits = groupName: grpCfg: overridesFile: composeBin: runtimeBin: runtimePkg:
let
auCfg = grpCfg.autoUpdate;
stateDir = grpCfg.stateDir;
@@ -60,6 +62,7 @@
description = "Pull latest images and recreate container service group '${groupName}'";
after = [ "container-services-${groupName}.service" ];
requires = [ "container-services-${groupName}.service" ];
path = [ runtimePkg pkgs.coreutils ];
serviceConfig = {
Type = "oneshot";
ExecStart =
+1
View File
@@ -21,6 +21,7 @@
nixpkgs.config.allowUnfree = true;
nix = {
optimise.automatic = true;
optimise.dates = [ "weekly" ];
settings.experimental-features = [ "nix-command" "flakes" ];
};
programs.nh = {
+2 -2
View File
@@ -12,9 +12,9 @@ in
};
skyg.nixos.common.networking = {
nfsServer.enable = lib.mkOption {
description = "Enable the NFS server (services.nfs.server).";
description = "Enable the NFS server (services.nfs.server). Off by default; opt in on hosts that export shares.";
type = lib.types.bool;
default = true;
default = false;
};
};
};
+6 -2
View File
@@ -55,9 +55,13 @@ in
# to the shared local listener, and tell the server-side wrapper (via
# SetEnv, expanded here with the same %C the RemoteForward bind uses)
# which socket to connect to.
# Scoped to lab hosts: without the Match, every outbound ssh (GitHub,
# work bastions, …) tries the forward, logs failures, and may leave a
# socket behind on hosts that accept it.
programs.ssh.extraConfig = lib.mkIf isClient ''
RemoteForward ${remoteSocketPath} ${localSocketPath}
SetEnv SSH_NOTIFY_SOCK=${remoteSocketPath}
Match host *.lab.internal
RemoteForward ${remoteSocketPath} ${localSocketPath}
SetEnv SSH_NOTIFY_SOCK=${remoteSocketPath}
'';
# Server: accept the SSH_NOTIFY_SOCK env var forwarded by the client
+7 -9
View File
@@ -7,9 +7,11 @@ in
skyg.nixos.common.ssh-server = {
enable = lib.mkEnableOption
"enable ssh server";
masterPubKey = lib.mkOption {
type = lib.types.str;
default = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCuatskL9qXvgvS3E8zRwosFnpcN0f8PkKl8syAvpn297V2iPk6mi8yK3EE7xPpxaKKlwUuBHDj3BNUCoLgdRFKUgroRDzr3BMm+gZTHy6CuEZBY9zBRTmH+aOV6FZ96QPW4zba0BW5YPkPNy/FhYibjpXyZ3nX4/LWSbPKQJ7wTnUJZgq4VFmevBOttvhzUJUgTziMFsGXn6I38fAi6LI8qwI+zOOdsNjtKgr/TIlO/7VqcH7GYnQEwlthl577sDd1V6+XWz649qoiBYyq0Ahm09dwYx2iGQwLo8IYFbSy4aJRK/PI0+ytnPBoF5QCl+ILb5E8uV3e6Wb9WpXl9Hv2iLx91/9iq5hykHPnfVtkq3MK0C2vqkvX1qFOIkKM7vmxvXGbaDZDGK3G+/zkQ7GUw8ydbl9wGwE9cKbm9miqs4w2Ry/+3IZasE6G2TI97bSzSYInQd2RwoglqBOaJojbUqgI9wvNdKxGhADNFbZah2+s6SSe1ByQRN3b9wtmqu0= ari@shared";
masterPubKeys = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCuatskL9qXvgvS3E8zRwosFnpcN0f8PkKl8syAvpn297V2iPk6mi8yK3EE7xPpxaKKlwUuBHDj3BNUCoLgdRFKUgroRDzr3BMm+gZTHy6CuEZBY9zBRTmH+aOV6FZ96QPW4zba0BW5YPkPNy/FhYibjpXyZ3nX4/LWSbPKQJ7wTnUJZgq4VFmevBOttvhzUJUgTziMFsGXn6I38fAi6LI8qwI+zOOdsNjtKgr/TIlO/7VqcH7GYnQEwlthl577sDd1V6+XWz649qoiBYyq0Ahm09dwYx2iGQwLo8IYFbSy4aJRK/PI0+ytnPBoF5QCl+ILb5E8uV3e6Wb9WpXl9Hv2iLx91/9iq5hykHPnfVtkq3MK0C2vqkvX1qFOIkKM7vmxvXGbaDZDGK3G+/zkQ7GUw8ydbl9wGwE9cKbm9miqs4w2Ry/+3IZasE6G2TI97bSzSYInQd2RwoglqBOaJojbUqgI9wvNdKxGhADNFbZah2+s6SSe1ByQRN3b9wtmqu0= ari@shared"
];
};
};
};
@@ -30,11 +32,7 @@ in
settings.MaxSessions = 64;
settings.MaxStartups = "64:30:128";
};
users.users.${config.skyg.user.name}.openssh.authorizedKeys.keys = [
cfg.masterPubKey
];
users.users.root.openssh.authorizedKeys.keys = [
cfg.masterPubKey
];
users.users.${config.skyg.user.name}.openssh.authorizedKeys.keys = cfg.masterPubKeys;
users.users.root.openssh.authorizedKeys.keys = cfg.masterPubKeys;
};
}
+2
View File
@@ -50,6 +50,8 @@ skyg.nixos.desktop.fixes.* → fixes/
## Notes
- The desktop user's `extraGroups` deliberately **excludes `disk`**: raw block-device access
is equivalent to root and nothing here needs it. Do not re-add it.
- The old `packages.nix`, `wayland.nix`, and `x11/` modules were folded into `default.nix`:
the desktop apps and Xorg/XWayland now install only in full (non-slim) mode.
- Tiler app groups (`control`, `gnome`, `media`) and Hyprland shell `tools` are opt-in — see
-1
View File
@@ -10,7 +10,6 @@ let
environment.sessionVariables.NIXOS_OZONE_WL = "1";
users.users.${skygUser.name}.extraGroups = [
"input"
"disk"
"wheel"
"tty"
"dialout"