Flake: remove unneeded patch

This commit is contained in:
Toast 2025-01-31 10:48:05 +01:00
parent ac36661d4e
commit 6adbd2d38c
2 changed files with 1 additions and 108 deletions

View file

@ -100,9 +100,7 @@
nixpkgs-unstable-patched = nixpkgs-raw.legacyPackages.x86_64-linux.applyPatches {
name = "patched-nixpkgs-unstable";
src = nixpkgs-unstable-raw;
patches = [
./nixpkgs-patches/update-hhd.patch
];
patches = [];
};
nixpkgs-patched = nixpkgs-raw.legacyPackages.x86_64-linux.applyPatches {
name = "patched-nixpkgs";

View file

@ -1,105 +0,0 @@
From 32d076a87fa6611f62e050047442564b27d36bc1 Mon Sep 17 00:00:00 2001
From: Toast <39011842+toast003@users.noreply.github.com>
Date: Tue, 14 Jan 2025 10:18:45 +0100
Subject: [PATCH] handheld-daemon: 3.9.0 -> 3.10.2
---
.../0001-remove-selinux-fixes.patch | 37 +++++++++++++++++++
pkgs/by-name/ha/handheld-daemon/package.nix | 22 +++++++++--
2 files changed, 55 insertions(+), 4 deletions(-)
create mode 100644 pkgs/by-name/ha/handheld-daemon/0001-remove-selinux-fixes.patch
diff --git a/pkgs/by-name/ha/handheld-daemon/0001-remove-selinux-fixes.patch b/pkgs/by-name/ha/handheld-daemon/0001-remove-selinux-fixes.patch
new file mode 100644
index 0000000000000..2fe3ae78a1a47
--- /dev/null
+++ b/pkgs/by-name/ha/handheld-daemon/0001-remove-selinux-fixes.patch
@@ -0,0 +1,37 @@
+diff --git a/src/hhd/plugins/power/power.py b/src/hhd/plugins/power/power.py
+index 5ece857..be41542 100644
+--- a/src/hhd/plugins/power/power.py
++++ b/src/hhd/plugins/power/power.py
+@@ -79,12 +79,6 @@ def create_subvol():
+ )
+ return
+
+- # Fixup selinux for swap
+- subprocess.run(
+- ["semanage", "fcontext", "-a", "-t", "var_t", HHD_SWAP_SUBVOL],
+- )
+- subprocess.run(["restorecon", HHD_SWAP_SUBVOL])
+-
+ logger.info(f"Creating swap subvolume {HHD_SWAP_SUBVOL}")
+ os.system(f"btrfs subvolume create {HHD_SWAP_SUBVOL}")
+
+@@ -153,19 +147,6 @@ def create_temporary_swap():
+ subprocess.run(["chmod", "600", HHD_SWAP_FILE], check=True)
+ subprocess.run(["mkswap", HHD_SWAP_FILE], check=True)
+
+- # Fixup selinux for swap
+- subprocess.run(
+- [
+- "semanage",
+- "fcontext",
+- "-a",
+- "-t",
+- "swapfile_t",
+- HHD_SWAP_FILE,
+- ],
+- )
+- subprocess.run(["restorecon", HHD_SWAP_FILE])
+-
+ # Enable swap
+ subprocess.run(["swapon", HHD_SWAP_FILE], check=True)
+
diff --git a/pkgs/by-name/ha/handheld-daemon/package.nix b/pkgs/by-name/ha/handheld-daemon/package.nix
index 1c11cd3b59b28..aad4a57e50c22 100644
--- a/pkgs/by-name/ha/handheld-daemon/package.nix
+++ b/pkgs/by-name/ha/handheld-daemon/package.nix
@@ -11,19 +11,25 @@
efibootmgr,
dbus,
lsof,
+ btrfs-progs,
+ util-linux,
}:
python3Packages.buildPythonApplication rec {
pname = "handheld-daemon";
- version = "3.9.0";
+ version = "3.10.2";
pyproject = true;
src = fetchFromGitHub {
owner = "hhd-dev";
repo = "hhd";
tag = "v${version}";
- hash = "sha256-y3CxdWqQEwdNYs4m1NEUeRjTvvhEpS5S739wyFlluWo=";
+ hash = "sha256-6BjXqqNe2u/rh1cnuJ13L/1KimprcyatIr53b0GOBSM=";
};
+ # Handheld-daemon runs some selinux-related utils which are not in nixpkgs.
+ # NixOS doesn't support selinux so we can safely remove them
+ patches = [ ./0001-remove-selinux-fixes.patch ];
+
# This package relies on several programs expected to be on the user's PATH.
# We take a more reproducible approach by patching the absolute path to each of these required
# binaries.
@@ -41,8 +47,16 @@ python3Packages.buildPythonApplication rec {
substituteInPlace src/hhd/controller/physical/imu.py \
--replace-fail '"modprobe' '"${lib.getExe' kmod "modprobe"}'
- substituteInPlace src/hhd/plugins/overlay/power.py \
- --replace-fail '"efibootmgr"' '"${lib.getExe' efibootmgr "id"}"'
+ substituteInPlace src/hhd/plugins/power/power.py \
+ --replace-fail '"efibootmgr"' '"${lib.getExe' efibootmgr "id"}"' \
+ --replace-fail '"systemctl"' '"${lib.getExe' systemd "systemctl"}"' \
+ --replace-fail '"stat"' '"${lib.getExe' coreutils "stat"}"' \
+ --replace-fail '"swapon"' '"${lib.getExe' util-linux "swapon"}"' \
+ --replace-fail '"swapoff"' '"${lib.getExe' util-linux "swapoff"}"' \
+ --replace-fail '"fallocate"' '"${lib.getExe' util-linux "fallocate"}"' \
+ --replace-fail '"chmod"' '"${lib.getExe' coreutils "chmod"}"' \
+ --replace-fail '"mkswap"' '"${lib.getExe' util-linux "mkswap"}"' \
+ --replace-fail '"btrfs",' '"${lib.getExe' btrfs-progs "btrfs"}",'
substituteInPlace src/hhd/device/oxp/serial.py \
--replace-fail "udevadm" "${lib.getExe' systemd "udevadm"}"