Compare commits

..

4 commits

Author SHA1 Message Date
Leonardo Eugênio a7608ace94 factorio: automate updating server 2024-10-31 19:59:35 -03:00
Leonardo Eugênio a989bacbd7 update 2024-10-31 01:40:45 -03:00
Leonardo Eugênio fb9ccce37a monolith: remove bluetooth dongle patch 2024-10-31 01:40:13 -03:00
Leonardo Eugênio fc320d3fd9 factorio: move hosting to monolith 2024-10-30 20:51:43 -03:00
12 changed files with 62 additions and 120 deletions

View file

@ -213,11 +213,11 @@
]
},
"locked": {
"lastModified": 1728334376,
"narHash": "sha256-CTKEKPzD/j8FK6H4DO3EjyixZd3HHvgAgfnCwpGFP5c=",
"lastModified": 1730190761,
"narHash": "sha256-o5m5WzvY6cGIDupuOvjgNSS8AN6yP2iI9MtUC6q/uos=",
"owner": "nix-community",
"repo": "disko",
"rev": "d39ee334984fcdae6244f5a8e6ab857479cbaefe",
"rev": "3979285062d6781525cded0f6c4ff92e71376b55",
"type": "github"
},
"original": {
@ -489,11 +489,11 @@
]
},
"locked": {
"lastModified": 1728263287,
"narHash": "sha256-GJDtsxz2/zw6g/Nrp4XVWBS5IaZ7ZUkuvxPOBEDe7pg=",
"lastModified": 1729999765,
"narHash": "sha256-LYsavZXitFjjyETZoij8usXjTa7fa9AIF3Sk3MJSX+Y=",
"owner": "Mic92",
"repo": "nix-index-database",
"rev": "5fce10c871bab6d7d5ac9e5e7efbb3a2783f5259",
"rev": "0e3a8778c2ee218eff8de6aacf3d2fa6c33b2d4f",
"type": "github"
},
"original": {
@ -531,11 +531,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1728193676,
"narHash": "sha256-PbDWAIjKJdlVg+qQRhzdSor04bAPApDqIv2DofTyynk=",
"lastModified": 1730137625,
"narHash": "sha256-9z8oOgFZiaguj+bbi3k4QhAD6JabWrnv7fscC/mt0KE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ecbc1ca8ffd6aea8372ad16be9ebbb39889e55b6",
"rev": "64b80bfb316b57cdb8919a9110ef63393d74382a",
"type": "github"
},
"original": {
@ -546,11 +546,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1728018373,
"narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=",
"lastModified": 1729880355,
"narHash": "sha256-RP+OQ6koQQLX5nw0NmcDrzvGL8HDLnyXt/jHhL1jwjM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bc947f541ae55e999ffdb4013441347d83b00feb",
"rev": "18536bf04cd71abd345f9579158841376fdd0c5a",
"type": "github"
},
"original": {
@ -837,11 +837,11 @@
},
"vpsadminos": {
"locked": {
"lastModified": 1728335559,
"narHash": "sha256-95/KJBA449oAjf6bLwaCvDgys7yE8vKXY3wHe/uUkiw=",
"lastModified": 1730290190,
"narHash": "sha256-a+op2lnWrCytuEhLOE24SKR/irRfjwDEHkpLyAL5P90=",
"owner": "vpsfreecz",
"repo": "vpsadminos",
"rev": "c928bdec26484e99621cc76cb165abb73aa7d029",
"rev": "63ac771b9667b45ab2ea87363f69ca7f85668e9b",
"type": "github"
},
"original": {

View file

@ -24,6 +24,7 @@ in
(modulesPath + "/installer/scan/not-detected.nix")
./partition.nix
./amdgpu.nix
./factorio-server.nix
];
boot.initrd.availableKernelModules = [
"nvme"
@ -38,13 +39,7 @@ in
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.extraModulePackages = with config.boot.kernelPackages; [
zenpower
(pkgs.linux-bluetooth.override {
kernel = config.boot.kernelPackages.kernel;
patches = [ ../../patches/linux/v2-Bluetooth-btusb-Fix-regression-with-CSR-controllers.diff ];
})
];
boot.extraModulePackages = with config.boot.kernelPackages; [ zenpower ];
boot.initrd.kernelModules = [ "amdgpu" ];
boot.kernelModules = [

View file

@ -0,0 +1,17 @@
{ config, pkgs, ... }:
{
services.factorio = {
enable = true;
package = pkgs.factorio-headless; # I override this in ./pkgs
public = true;
lan = true;
openFirewall = true;
admins = [ "lelgenio" ];
extraSettingsFile = config.age.secrets.factorio-settings.path;
};
age.secrets.factorio-settings = {
file = ../../secrets/factorio-settings.age;
mode = "777";
};
}

View file

@ -21,7 +21,6 @@
./invidious.nix
./davi.nix
./goofs.nix
./factorio-server.nix
];
networking.hostName = "phantom";

View file

@ -1,24 +0,0 @@
{ config, pkgs, ... }:
{
services.factorio = {
enable = true;
package = pkgs.unstable.factorio-headless.overrideAttrs (_: rec {
version = "2.0.12";
src = pkgs.fetchurl {
name = "factorio_headless_x64-${version}.tar.xz";
url = "https://www.factorio.com/get-download/${version}/headless/linux64";
hash = "sha256-0vgg5eJ6ZEFO0TUixNsByCs8YyPGOArgqnXbT5RIjTE=";
};
});
public = true;
lan = true;
openFirewall = true;
admins = [ "lelgenio" ];
extraSettingsFile = config.age.secrets.phantom-factorio-settings.path;
};
age.secrets.phantom-factorio-settings = {
file = ../../secrets/phantom-factorio-settings.age;
mode = "777";
};
}

View file

@ -1,24 +0,0 @@
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index c0b6ef8ee5da..f72218c1037e 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1366,10 +1366,15 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags)
if (!urb)
return -ENOMEM;
- /* Use maximum HCI Event size so the USB stack handles
- * ZPL/short-transfer automatically.
- */
- size = HCI_MAX_EVENT_SIZE;
+ if (le16_to_cpu(data->udev->descriptor.idVendor) == 0x0a12 &&
+ le16_to_cpu(data->udev->descriptor.idProduct) == 0x0001)
+ /* Fake CSR devices don't seem to support sort-transter */
+ size = le16_to_cpu(data->intr_ep->wMaxPacketSize);
+ else
+ /* Use maximum HCI Event size so the USB stack handles
+ * ZPL/short-transfer automatically.
+ */
+ size = HCI_MAX_EVENT_SIZE;
buf = kmalloc(size, mem_flags);
if (!buf) {

View file

@ -8,5 +8,7 @@ rec {
emmet-cli = pkgs.callPackage ./emmet-cli.nix { };
material-wifi-icons = pkgs.callPackage ./material-wifi-icons.nix { };
gnome-pass-search-provider = pkgs.callPackage ./gnome-pass-search-provider.nix { };
linux-bluetooth = pkgs.callPackage ./linux-bluetooth.nix { };
factorio-headless = pkgs.callPackage ./factorio-headless {
inherit (pkgs.unstable) factorio-headless;
};
}

View file

@ -0,0 +1,10 @@
{ factorio-headless, pkgs }:
factorio-headless.overrideAttrs (_: rec {
version = "2.0.13";
src = pkgs.fetchurl {
name = "factorio_headless_x64-${version}.tar.xz";
url = "https://www.factorio.com/get-download/${version}/headless/linux64";
hash = "sha256-J7NpAaOeWTrfKEGMAoYULGx6n4PRVpY8c2m9QFolx9E=";
};
})

View file

@ -0,0 +1,14 @@
#!/bin/sh
set -xe
cd "$(dirname $0)"
current_version="$(rg '^.*?version\s*=\s*"(.+)".*?$' --replace '$1' ./default.nix)"
current_hash="$(rg '^.*?hash\s*=\s*"(.+)".*?$' --replace '$1' ./default.nix)"
new_version="$(curl https://factorio.com/api/latest-releases | jq -r .stable.headless)"
new_hash="$(nix-hash --to-sri --type sha256 $(nix-prefetch-url --type sha256 https://www.factorio.com/get-download/${new_version}/headless/linux64))"
sd "$current_version" "$new_version" ./default.nix
sd "$current_hash" "$new_hash" ./default.nix

View file

@ -1,47 +0,0 @@
{
pkgs,
lib,
kernel ? pkgs.linuxPackages_latest.kernel,
patches ? [ ],
}:
pkgs.stdenv.mkDerivation {
pname = "bluetooth-kernel-module";
inherit (kernel)
src
version
postPatch
nativeBuildInputs
;
inherit patches;
kernel_dev = kernel.dev;
kernelVersion = kernel.modDirVersion;
modulePath = "drivers/bluetooth";
buildPhase = ''
BUILT_KERNEL=$kernel_dev/lib/modules/$kernelVersion/build
cp $BUILT_KERNEL/Module.symvers .
cp $BUILT_KERNEL/.config .
cp $kernel_dev/vmlinux .
make "-j$NIX_BUILD_CORES" modules_prepare
make "-j$NIX_BUILD_CORES" M=$modulePath modules
'';
installPhase = ''
make \
INSTALL_MOD_PATH="$out" \
XZ="xz -T$NIX_BUILD_CORES" \
M="$modulePath" \
modules_install
'';
meta = {
description = "Bluetooth kernel module";
license = lib.licenses.gpl3;
};
}

View file

@ -12,7 +12,7 @@ in
"monolith-forgejo-runner-token.age".publicKeys = [ main_ssh_public_key ];
"lelgenio-cachix.age".publicKeys = [ main_ssh_public_key ];
"monolith-nix-serve-privkey.age".publicKeys = [ main_ssh_public_key ];
"phantom-factorio-settings.age".publicKeys = [ main_ssh_public_key ];
"factorio-settings.age".publicKeys = [ main_ssh_public_key ];
"phantom-nextcloud.age".publicKeys = [ main_ssh_public_key ];
"phantom-writefreely.age".publicKeys = [ main_ssh_public_key ];
"phantom-renawiki.age".publicKeys = [ main_ssh_public_key ];