mirror of
https://github.com/elwrcl/copnix.git
synced 2026-10-31 06:18:03 +03:00
common changes
This commit is contained in:
7 files changed
+7
-176
No files matched your search
@@ -1,5 +1,4 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake.nixosModules.common-agenix = inputs.agenix.nixosModules.default;
|
||||
flake.darwinModules.common-agenix = inputs.agenix.darwinModules.default;
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
flake.nixosModules.common-crashlog =
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
netconsole = pkgs.writeShellApplication {
|
||||
name = "netconsole-on";
|
||||
runtimeInputs = [
|
||||
pkgs.iproute2
|
||||
pkgs.kmod
|
||||
];
|
||||
text = ''
|
||||
TARGET_DIR=/sys/kernel/config/netconsole/copland
|
||||
usage() {
|
||||
echo "usage: netconsole-on <ip> <target-mac> [interface] [port]" >&2
|
||||
echo " netconsole-on off" >&2
|
||||
echo "" >&2
|
||||
echo " e.g.: netconsole-on 192.168.1.10 aa:bb:cc:dd:ee:ff" >&2
|
||||
echo " on the receiving side: nc -u -l 6666" >&2
|
||||
echo "" >&2
|
||||
echo " target-mac: if the target is on the same network, use the target's MAC" >&2
|
||||
echo " otherwise use the gateway's MAC (find it with ip neigh)" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "''${1:-}" = "off" ]; then
|
||||
if [ -d "$TARGET_DIR" ]; then
|
||||
echo 0 > "$TARGET_DIR/enabled" || true
|
||||
rmdir "$TARGET_DIR"
|
||||
echo "netconsole disabled"
|
||||
else
|
||||
echo "netconsole already disabled"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
[ "$#" -ge 2 ] || usage
|
||||
|
||||
TARGET_IP="$1"
|
||||
TARGET_MAC="$2"
|
||||
IFACE="''${3:-enp8s0}"
|
||||
PORT="''${4:-6666}"
|
||||
|
||||
LOCAL_IP="$(ip -4 -o addr show dev "$IFACE" | awk '{print $4}' | cut -d/ -f1 | head -1)"
|
||||
if [ -z "$LOCAL_IP" ]; then
|
||||
echo "error: no IPv4 address on $IFACE (is the cable plugged in?)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
modprobe netconsole
|
||||
[ -d "$TARGET_DIR" ] && { echo 0 > "$TARGET_DIR/enabled" || true; rmdir "$TARGET_DIR"; }
|
||||
mkdir -p "$TARGET_DIR"
|
||||
|
||||
echo 1 > "$TARGET_DIR/extended"
|
||||
echo "$IFACE" > "$TARGET_DIR/dev_name"
|
||||
echo "$LOCAL_IP" > "$TARGET_DIR/local_ip"
|
||||
echo "$TARGET_IP" > "$TARGET_DIR/remote_ip"
|
||||
echo "$TARGET_MAC" > "$TARGET_DIR/remote_mac"
|
||||
echo "$PORT" > "$TARGET_DIR/remote_port"
|
||||
echo 1 > "$TARGET_DIR/enabled"
|
||||
|
||||
echo "netconsole enabled: $IFACE ($LOCAL_IP) -> $TARGET_IP:$PORT"
|
||||
echo "listen on receiver: nc -u -l $PORT"
|
||||
echo "test it: echo 'netconsole test' | sudo tee /dev/kmsg"
|
||||
'';
|
||||
};
|
||||
|
||||
panicInflate =
|
||||
pkgs.writers.writePython3Bin "drm-panic-inflate"
|
||||
{
|
||||
flakeIgnore = [ "E501" ];
|
||||
}
|
||||
''
|
||||
import sys
|
||||
import zlib
|
||||
|
||||
data = sys.stdin.buffer.read()
|
||||
if not data:
|
||||
sys.exit("Could not read QR: try a clearer, straighter photo")
|
||||
for wbits in (-15, 15, 47):
|
||||
try:
|
||||
sys.stdout.buffer.write(zlib.decompress(data, wbits))
|
||||
break
|
||||
except zlib.error:
|
||||
continue
|
||||
else:
|
||||
sys.stderr.write("warning: could not decompress, printing raw bytes\n")
|
||||
sys.stdout.buffer.write(data)
|
||||
'';
|
||||
|
||||
drmPanicDecode = pkgs.writeShellApplication {
|
||||
name = "drm-panic-decode";
|
||||
runtimeInputs = [
|
||||
pkgs.zbar
|
||||
panicInflate
|
||||
];
|
||||
text = ''
|
||||
if [ "$#" -lt 1 ]; then
|
||||
echo "usage: drm-panic-decode <panic-screen-photo>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
zbarimg --raw -q --oneshot -Sbinary "$1" | drm-panic-inflate
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [
|
||||
netconsole
|
||||
drmPanicDecode
|
||||
];
|
||||
|
||||
boot.kernelParams = [
|
||||
"reserve_mem=8M:4096:oops"
|
||||
"drm.panic_screen=qr_code"
|
||||
"efi_pstore.pstore_disable=1"
|
||||
];
|
||||
|
||||
boot.kernelModules = [
|
||||
"ramoops"
|
||||
"iTCO_wdt"
|
||||
];
|
||||
boot.extraModprobeConfig = ''
|
||||
options ramoops mem_name=oops record_size=262144 max_reason=3 ecc=1
|
||||
'';
|
||||
|
||||
boot.kernel.sysctl = {
|
||||
"kernel.panic" = 30;
|
||||
|
||||
"kernel.hardlockup_panic" = 1;
|
||||
|
||||
"kernel.softlockup_panic" = 1;
|
||||
|
||||
"kernel.hung_task_panic" = 0;
|
||||
|
||||
"kernel.hung_task_timeout_secs" = 300;
|
||||
|
||||
"kernel.sysrq" = 184;
|
||||
};
|
||||
systemd.settings.Manager = {
|
||||
RuntimeWatchdogSec = "60s";
|
||||
RebootWatchdogSec = "10min";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
{ ... }:
|
||||
{
|
||||
commonModules.common-git =
|
||||
flake.nixosModules.common-git =
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
base = ''
|
||||
gitconfig = pkgs.writeText "gitconfig" ''
|
||||
[user]
|
||||
name = elwrcl
|
||||
email = elwerici@proton.me
|
||||
@@ -12,21 +12,9 @@
|
||||
gpgsign = true
|
||||
[tag]
|
||||
gpgsign = true
|
||||
'';
|
||||
|
||||
darwinExtra = ''
|
||||
[credential]
|
||||
helper = osxkeychain
|
||||
'';
|
||||
|
||||
linuxExtra = ''
|
||||
[credential]
|
||||
helper = ${pkgs.gitFull}/bin/git-credential-libsecret
|
||||
'';
|
||||
|
||||
gitconfig = pkgs.writeText "gitconfig" (
|
||||
base + (if pkgs.stdenv.isDarwin then darwinExtra else linuxExtra)
|
||||
);
|
||||
in
|
||||
{
|
||||
environment.variables.GIT_CONFIG_SYSTEM = "${gitconfig}";
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
services.kmscon = {
|
||||
enable = true;
|
||||
# kmscon ignores console.keyMap; take the layout (tr) from xkb instead
|
||||
useXkbConfig = true;
|
||||
config = {
|
||||
font-name = "JetBrainsMono Nerd Font";
|
||||
font-size = 18;
|
||||
|
||||
@@ -22,29 +22,17 @@
|
||||
substituters = [
|
||||
"https://cache.nixos.org"
|
||||
"https://nix-community.cachix.org"
|
||||
"https://ezkea.cachix.org"
|
||||
"https://noctalia.cachix.org"
|
||||
"https://hyprland.cachix.org"
|
||||
"https://soryu-kernel.cachix.org"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"ezkea.cachix.org-1:ioBmUbJTZIKsHmWWXPe1FSFbeVe+afhfgqgTSNd34eI="
|
||||
"noctalia.cachix.org-1:pCOR47nnMEo5thcxNDtzWpOxNFQsBRglJzxWPp3dkU4="
|
||||
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
||||
"soryu-kernel.cachix.org-1:2/Tm90ibGjLQWo/uX4qo/kbFB5yjQG/CzfE1oelHdWw="
|
||||
];
|
||||
};
|
||||
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "Mon 03:00";
|
||||
options = "--delete-older-than 14d";
|
||||
persistent = true;
|
||||
randomizedDelaySec = "45min";
|
||||
};
|
||||
|
||||
documentation = {
|
||||
man.enable = true;
|
||||
doc.enable = false;
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
}:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
# apps
|
||||
# random
|
||||
onlyoffice-desktopeditors
|
||||
telegram-desktop
|
||||
davinci-resolve
|
||||
prismlauncher
|
||||
gparted-full
|
||||
moonlight-qt
|
||||
@@ -26,11 +25,12 @@
|
||||
gimp
|
||||
wine
|
||||
|
||||
# file-manager
|
||||
# kde
|
||||
kdePackages.kdegraphics-thumbnailers
|
||||
kdePackages.plasma-integration
|
||||
kdePackages.breeze-icons
|
||||
kdePackages.kio-extras
|
||||
kdePackages.kdenlive
|
||||
kdePackages.qtwayland
|
||||
kdePackages.kio-admin
|
||||
kdePackages.kio-fuse
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
"libvirtd"
|
||||
"scanner"
|
||||
"plugdev"
|
||||
"docker"
|
||||
"video"
|
||||
"input"
|
||||
"audio"
|
||||
|
||||
Reference in new issue
Block a user