diff --git a/flake.lock b/flake.lock index 5e74698..54aac8d 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { diff --git a/hosts/monolith/default.nix b/hosts/monolith/default.nix index 962addc..f4fde3a 100644 --- a/hosts/monolith/default.nix +++ b/hosts/monolith/default.nix @@ -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 = [ diff --git a/hosts/monolith/factorio-server.nix b/hosts/monolith/factorio-server.nix new file mode 100644 index 0000000..3c893a5 --- /dev/null +++ b/hosts/monolith/factorio-server.nix @@ -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"; + }; +} diff --git a/hosts/phantom/default.nix b/hosts/phantom/default.nix index 6a246e4..e5570ee 100644 --- a/hosts/phantom/default.nix +++ b/hosts/phantom/default.nix @@ -21,7 +21,6 @@ ./invidious.nix ./davi.nix ./goofs.nix - ./factorio-server.nix ]; networking.hostName = "phantom"; diff --git a/hosts/phantom/factorio-server.nix b/hosts/phantom/factorio-server.nix deleted file mode 100644 index a4b13b5..0000000 --- a/hosts/phantom/factorio-server.nix +++ /dev/null @@ -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"; - }; -} diff --git a/patches/linux/v2-Bluetooth-btusb-Fix-regression-with-CSR-controllers.diff b/patches/linux/v2-Bluetooth-btusb-Fix-regression-with-CSR-controllers.diff deleted file mode 100644 index ae1adeb..0000000 --- a/patches/linux/v2-Bluetooth-btusb-Fix-regression-with-CSR-controllers.diff +++ /dev/null @@ -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) { diff --git a/pkgs/default.nix b/pkgs/default.nix index 530d1cb..b702886 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -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; + }; } diff --git a/pkgs/factorio-headless/default.nix b/pkgs/factorio-headless/default.nix new file mode 100644 index 0000000..b6d34ef --- /dev/null +++ b/pkgs/factorio-headless/default.nix @@ -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="; + }; +}) diff --git a/pkgs/factorio-headless/update.sh b/pkgs/factorio-headless/update.sh new file mode 100755 index 0000000..9f7bce9 --- /dev/null +++ b/pkgs/factorio-headless/update.sh @@ -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 diff --git a/pkgs/linux-bluetooth.nix b/pkgs/linux-bluetooth.nix deleted file mode 100644 index 609e775..0000000 --- a/pkgs/linux-bluetooth.nix +++ /dev/null @@ -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; - }; -} diff --git a/secrets/phantom-factorio-settings.age b/secrets/factorio-settings.age similarity index 100% rename from secrets/phantom-factorio-settings.age rename to secrets/factorio-settings.age diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 65f495a..f64fb4b 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -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 ];