In json-c 0.19, json_object_put calls the function that frees detached JSON objects inside assert(). Release builds with NDEBUG skip that call. Sway's frequent IPC replies then leak memory, eventually making workspace switches lag. Patching json-c in the main package set changes the library's store path and forces dependent packages, including Firefox and Chromium, to rebuild. Keep the pin with SPDK 26.09 and build the ABI-compatible fix separately. Rewrite runtime references in NixOS systems and standalone Home Manager generations to reuse their existing binaries. Drop the replacement when the pinned nixpkgs includes the fix. https://github.com/NixOS/nixpkgs/pull/586077
296 lines
8.9 KiB
Nix
296 lines
8.9 KiB
Nix
{ lib, pkgsFlake, pkgs, pkgs', self, inputs, config, ... }:
|
|
let
|
|
inherit (lib) mkIf mkDefault mkMerge optionalAttrs versionOlder;
|
|
inherit (lib.my) mkDefault';
|
|
|
|
jsonCRuntimeReplacements = import ../../lib/json-c-runtime.nix { inherit lib pkgs pkgsFlake; };
|
|
in
|
|
{
|
|
options = with lib.types; {
|
|
my = { };
|
|
};
|
|
|
|
imports = [
|
|
inputs.impermanence.nixosModules.default
|
|
inputs.ragenix.nixosModules.age
|
|
inputs.copyparty.nixosModules.default
|
|
inputs.harmonia.nixosModules.harmonia
|
|
inputs.bootvine.nixosModules.default
|
|
inputs.paseo.nixosModules.paseo
|
|
];
|
|
|
|
config = mkMerge [
|
|
(optionalAttrs (jsonCRuntimeReplacements != [ ]) {
|
|
system.replaceDependencies.replacements = jsonCRuntimeReplacements;
|
|
})
|
|
|
|
{
|
|
system = {
|
|
stateVersion = "22.05";
|
|
configurationRevision = with inputs; mkIf (self ? rev) self.rev;
|
|
};
|
|
|
|
home-manager = {
|
|
# Installs packages in the system config instead of in the local profile on activation
|
|
useUserPackages = mkDefault true;
|
|
};
|
|
|
|
users = {
|
|
mutableUsers = false;
|
|
};
|
|
|
|
security = {
|
|
sudo.enable = mkDefault false;
|
|
doas = {
|
|
enable = mkDefault true;
|
|
wheelNeedsPassword = mkDefault false;
|
|
};
|
|
|
|
# TODO: Add this to fix login
|
|
# pam = {
|
|
# services = {
|
|
# kmscon.rules. = mkIf config.services.kmscon.config.libseat {
|
|
|
|
# };
|
|
# };
|
|
# };
|
|
};
|
|
|
|
nix = {
|
|
package = pkgs'.mine.determinate-nix;
|
|
channel.enable = false;
|
|
settings = with lib.my.c.nix; determinateSettings // {
|
|
trusted-users = [ "@wheel" ];
|
|
experimental-features = [ "nix-command" "flakes" "ca-derivations" ];
|
|
extra-substituters = cache.substituters;
|
|
extra-trusted-public-keys = cache.keys;
|
|
connect-timeout = 5;
|
|
fallback = true;
|
|
};
|
|
registry = {
|
|
pkgs = {
|
|
to = {
|
|
type = "path";
|
|
path = "${pkgsFlake}";
|
|
};
|
|
exact = true;
|
|
};
|
|
};
|
|
gc = {
|
|
options = mkDefault "--max-freed $((8 * 1024**3))";
|
|
automatic = mkDefault true;
|
|
};
|
|
};
|
|
nixpkgs = {
|
|
overlays = [
|
|
inputs.deploy-rs.overlays.default
|
|
# TODO: Re-enable when borgthin is updated
|
|
# inputs.borgthin.overlays.default
|
|
inputs.boardie.overlays.default
|
|
inputs.copyparty.overlays.default
|
|
inputs.hass-west-wood.overlays.default
|
|
# inputs.pi-agent.overlays.default
|
|
(final: prev: {
|
|
# TODO: Drop the override once getpaseo/paseo#7673 is fixed. The build runs npm with
|
|
# `--ignore-scripts`, so the web UI's `postinstall` patch is never applied.
|
|
paseo = inputs.paseo.packages.${prev.stdenv.hostPlatform.system}.default.overrideAttrs (old: {
|
|
preBuild = (old.preBuild or "") + "\nnpm run postinstall\n";
|
|
});
|
|
})
|
|
];
|
|
config = {
|
|
allowUnfree = true;
|
|
};
|
|
};
|
|
|
|
documentation = {
|
|
enable = mkDefault true;
|
|
nixos = {
|
|
enable = mkDefault true;
|
|
options.warningsAreErrors = mkDefault false;
|
|
};
|
|
};
|
|
|
|
time.timeZone = mkDefault "Europe/Dublin";
|
|
i18n.defaultLocale = "en_IE.UTF-8";
|
|
|
|
boot = {
|
|
# Use latest LTS release by default
|
|
kernelPackages = mkDefault (lib.my.c.kernel.lts pkgs);
|
|
|
|
# Containers share the host kernel. Block SCTP on the system that owns it.
|
|
# TODO: Lift once every kernel in use carries the NGINX2Root SCTP use-after-free fix,
|
|
# upstream f2540da93a11 ("sctp: do not free a new asoc peeled off while sendmsg slept").
|
|
# Not in 6.18.64 or 7.3.5 or their stable queues (checked 2026-11-22).
|
|
extraModprobeConfig = mkIf (!config.boot.isContainer) ''
|
|
install sctp ${pkgs.coreutils}/bin/false
|
|
'';
|
|
kernelParams = mkIf (!config.boot.isContainer) [ "module_blacklist=sctp" ];
|
|
|
|
kernel = {
|
|
sysctl = {
|
|
"net.ipv6.route.max_size" = mkDefault 16384;
|
|
};
|
|
};
|
|
|
|
loader = {
|
|
efi = {
|
|
efiSysMountPoint = mkDefault "/boot";
|
|
# Should generally be enough with just /EFI/BOOT/BOOTX64.EFI in place
|
|
canTouchEfiVariables = mkDefault false;
|
|
};
|
|
grub = {
|
|
memtest86.enable = mkDefault true;
|
|
};
|
|
systemd-boot = {
|
|
enable = mkDefault true;
|
|
editor = mkDefault true;
|
|
consoleMode = mkDefault "max";
|
|
configurationLimit = mkDefault 10;
|
|
memtest86.enable = mkDefault true;
|
|
};
|
|
};
|
|
|
|
initrd = {
|
|
systemd = {
|
|
emergencyAccess = mkDefault true;
|
|
} // optionalAttrs (versionOlder pkgsFlake.lib.trivial.release "26.11") {
|
|
# TODO: Remove when 26.11 is stable. Newer NixOS always uses systemd stage 1.
|
|
enable = mkDefault true;
|
|
};
|
|
services.lvm.enable = mkDefault true;
|
|
};
|
|
};
|
|
system = {
|
|
nixos = {
|
|
distroName = mkDefault' "JackOS";
|
|
};
|
|
};
|
|
|
|
environment.etc = {
|
|
"nixos/flake.nix".source = "/run/nixfiles/flake.nix";
|
|
};
|
|
environment.systemPackages = with pkgs; mkMerge [
|
|
[
|
|
bash-completion
|
|
git
|
|
python3
|
|
unzip
|
|
tcpdump
|
|
]
|
|
(mkIf config.services.netdata.enable [ netdata ])
|
|
];
|
|
|
|
programs = {
|
|
# This will enable generating completions at build time and prevent home-manager fish from generating them
|
|
# locally
|
|
fish.enable = mkDefault true;
|
|
# TODO: This is expecting to look up the channel for the database...
|
|
command-not-found.enable = mkDefault false;
|
|
vim = {
|
|
enable = true;
|
|
defaultEditor = true;
|
|
};
|
|
};
|
|
|
|
services = {
|
|
# TODO: Remove if-else when 26.11 releases
|
|
kmscon = if (pkgsFlake.lib.trivial.release == "26.11") then {
|
|
enable = mkDefault false;
|
|
config = {
|
|
hwaccel = config.hardware.graphics.enable;
|
|
font-name = "SauceCodePro Nerd Font Mono";
|
|
};
|
|
} else { };
|
|
getty.greetingLine = mkDefault' ''<<< Welcome to ${config.system.nixos.distroName} ${config.system.nixos.label} (\m) - \l >>>'';
|
|
|
|
# Needs a console TTY, which containers don't have
|
|
bootvine.enable = !config.boot.isContainer;
|
|
|
|
openssh = {
|
|
enable = mkDefault true;
|
|
settings = {
|
|
PermitRootLogin = mkDefault "no";
|
|
PasswordAuthentication = mkDefault false;
|
|
StrictModes = mkDefault true;
|
|
};
|
|
};
|
|
|
|
netdata = {
|
|
config = {
|
|
global = {
|
|
"memory mode" = "dbengine";
|
|
"page cache size" = 32;
|
|
"dbengine multihost disk space" = 256;
|
|
};
|
|
"plugin:cgroups" = {
|
|
"cgroups to match as systemd services" =
|
|
" /system.slice/system-*.slice/*.service !/system.slice/*/*.service /system.slice/*.service";
|
|
};
|
|
};
|
|
configDir = {
|
|
"go.d.conf" = mkDefault (pkgs.writeText "netdata-go.d.conf" ''
|
|
modules:
|
|
systemdunits: yes
|
|
'');
|
|
|
|
"go.d/systemdunits.conf" = mkDefault (pkgs.writeText "netdata-systemdunits.conf" ''
|
|
jobs:
|
|
- name: service-units
|
|
include:
|
|
- '*.service'
|
|
|
|
- name: socket-units
|
|
include:
|
|
- '*.socket'
|
|
'');
|
|
};
|
|
};
|
|
};
|
|
|
|
systemd = {
|
|
tmpfiles.rules = [
|
|
"d /nix/tmp 0775 root nixbld 24h"
|
|
];
|
|
services = {
|
|
nix-daemon.environment.TMPDIR = "/nix/tmp";
|
|
netdata = mkIf config.services.netdata.enable {
|
|
# python.d plugin script does #!/usr/bin/env bash
|
|
path = with pkgs; [ bash ];
|
|
};
|
|
|
|
nixfiles-mutable = {
|
|
description = "Mutable nixfiles";
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
RemainAfterExit = true;
|
|
};
|
|
|
|
path = with pkgs; [ util-linux ];
|
|
script = ''
|
|
nixfilesDir="${self}"
|
|
|
|
mkdir -p /run/nixfiles{,/.rw,/.work}
|
|
mount -t overlay overlay -o lowerdir="$nixfilesDir",upperdir=/run/nixfiles/.rw,workdir=/run/nixfiles/.work /run/nixfiles
|
|
chmod -R u+w /run/nixfiles
|
|
'';
|
|
preStop = ''
|
|
umount /run/nixfiles
|
|
rm -rf /run/nixfiles
|
|
'';
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
};
|
|
};
|
|
};
|
|
}
|
|
(mkIf config.services.kmscon.enable {
|
|
fonts.packages = with pkgs; [
|
|
nerd-fonts.sauce-code-pro
|
|
];
|
|
})
|
|
];
|
|
|
|
meta.buildDocsInSandbox = false;
|
|
}
|