102 lines
3.9 KiB
Diff
102 lines
3.9 KiB
Diff
From 87eb53c446492fbd4ace80bda5bb6ec94c1e19e6 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 | 19 ++++++++--
|
|
2 files changed, 52 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..f76b47225d671 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,13 @@ 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 '"btrfs"' '"${lib.getExe' btrfs-progs "btrfs"}"' \
|
|
+ --replace-fail '"swapon"' '"${lib.getExe' util-linux "swapon"}"' \
|
|
+ --replace-fail '"swapoff"' '"${lib.getExe' util-linux "swapoff"}"'
|
|
|
|
substituteInPlace src/hhd/device/oxp/serial.py \
|
|
--replace-fail "udevadm" "${lib.getExe' systemd "udevadm"}"
|